Skip to content

Commit 1f1ab14

Browse files
fix: resolve test duration cache issues in CI workflows (#3506)
1 parent 1a70f16 commit 1f1ab14

File tree

2 files changed

+20
-11
lines changed

2 files changed

+20
-11
lines changed

.github/workflows/tests.yml

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ jobs:
2222
steps:
2323
- name: Checkout code
2424
uses: actions/checkout@v4
25+
with:
26+
fetch-depth: 0 # Fetch all history for proper diff
2527

2628
- name: Restore global uv cache
2729
id: cache-restore
@@ -49,22 +51,29 @@ jobs:
4951
uses: actions/cache/restore@v4
5052
with:
5153
path: .test_durations_py*
52-
key: test-durations-py${{ matrix.python-version }}-
53-
restore-keys: |
54-
test-durations-py${{ matrix.python-version }}-
54+
key: test-durations-py${{ matrix.python-version }}
5555

5656
- name: Run tests (group ${{ matrix.group }} of 8)
5757
run: |
5858
PYTHON_VERSION_SAFE=$(echo "${{ matrix.python-version }}" | tr '.' '_')
5959
DURATION_FILE=".test_durations_py${PYTHON_VERSION_SAFE}"
6060
61-
if [ -f "$DURATION_FILE" ]; then
62-
echo "Using cached test durations for optimal splitting"
63-
DURATIONS_ARG="--durations-path=${DURATION_FILE}"
64-
else
65-
echo "No cached durations found, tests will be split evenly"
66-
DURATIONS_ARG=""
67-
fi
61+
# Temporarily always skip cached durations to fix test splitting
62+
# When durations don't match, pytest-split runs duplicate tests instead of splitting
63+
echo "Using even test splitting (duration cache disabled until fix merged)"
64+
DURATIONS_ARG=""
65+
66+
# Original logic (disabled temporarily):
67+
# if [ ! -f "$DURATION_FILE" ]; then
68+
# echo "No cached durations found, tests will be split evenly"
69+
# DURATIONS_ARG=""
70+
# elif git diff origin/${{ github.base_ref }}...HEAD --name-only 2>/dev/null | grep -q "^tests/.*\.py$"; then
71+
# echo "Test files have changed, skipping cached durations to avoid mismatches"
72+
# DURATIONS_ARG=""
73+
# else
74+
# echo "No test changes detected, using cached test durations for optimal splitting"
75+
# DURATIONS_ARG="--durations-path=${DURATION_FILE}"
76+
# fi
6877
6978
uv run pytest \
7079
--block-network \

.github/workflows/update-test-durations.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ jobs:
5858
uses: actions/cache/save@v4
5959
with:
6060
path: .test_durations_py*
61-
key: test-durations-py${{ matrix.python-version }}-${{ github.sha }}
61+
key: test-durations-py${{ matrix.python-version }}
6262

6363
- name: Save uv caches
6464
if: steps.cache-restore.outputs.cache-hit != 'true'

0 commit comments

Comments
 (0)