mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-09 08:08:32 +00:00
fix: resolve test duration cache issues in CI workflows (#3506)
Some checks failed
Notify Downstream / notify-downstream (push) Has been cancelled
Some checks failed
Notify Downstream / notify-downstream (push) Has been cancelled
This commit is contained in:
29
.github/workflows/tests.yml
vendored
29
.github/workflows/tests.yml
vendored
@@ -22,6 +22,8 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0 # Fetch all history for proper diff
|
||||||
|
|
||||||
- name: Restore global uv cache
|
- name: Restore global uv cache
|
||||||
id: cache-restore
|
id: cache-restore
|
||||||
@@ -49,22 +51,29 @@ jobs:
|
|||||||
uses: actions/cache/restore@v4
|
uses: actions/cache/restore@v4
|
||||||
with:
|
with:
|
||||||
path: .test_durations_py*
|
path: .test_durations_py*
|
||||||
key: test-durations-py${{ matrix.python-version }}-
|
key: test-durations-py${{ matrix.python-version }}
|
||||||
restore-keys: |
|
|
||||||
test-durations-py${{ matrix.python-version }}-
|
|
||||||
|
|
||||||
- name: Run tests (group ${{ matrix.group }} of 8)
|
- name: Run tests (group ${{ matrix.group }} of 8)
|
||||||
run: |
|
run: |
|
||||||
PYTHON_VERSION_SAFE=$(echo "${{ matrix.python-version }}" | tr '.' '_')
|
PYTHON_VERSION_SAFE=$(echo "${{ matrix.python-version }}" | tr '.' '_')
|
||||||
DURATION_FILE=".test_durations_py${PYTHON_VERSION_SAFE}"
|
DURATION_FILE=".test_durations_py${PYTHON_VERSION_SAFE}"
|
||||||
|
|
||||||
if [ -f "$DURATION_FILE" ]; then
|
# Temporarily always skip cached durations to fix test splitting
|
||||||
echo "Using cached test durations for optimal splitting"
|
# When durations don't match, pytest-split runs duplicate tests instead of splitting
|
||||||
DURATIONS_ARG="--durations-path=${DURATION_FILE}"
|
echo "Using even test splitting (duration cache disabled until fix merged)"
|
||||||
else
|
DURATIONS_ARG=""
|
||||||
echo "No cached durations found, tests will be split evenly"
|
|
||||||
DURATIONS_ARG=""
|
# Original logic (disabled temporarily):
|
||||||
fi
|
# if [ ! -f "$DURATION_FILE" ]; then
|
||||||
|
# echo "No cached durations found, tests will be split evenly"
|
||||||
|
# DURATIONS_ARG=""
|
||||||
|
# elif git diff origin/${{ github.base_ref }}...HEAD --name-only 2>/dev/null | grep -q "^tests/.*\.py$"; then
|
||||||
|
# echo "Test files have changed, skipping cached durations to avoid mismatches"
|
||||||
|
# DURATIONS_ARG=""
|
||||||
|
# else
|
||||||
|
# echo "No test changes detected, using cached test durations for optimal splitting"
|
||||||
|
# DURATIONS_ARG="--durations-path=${DURATION_FILE}"
|
||||||
|
# fi
|
||||||
|
|
||||||
uv run pytest \
|
uv run pytest \
|
||||||
--block-network \
|
--block-network \
|
||||||
|
|||||||
2
.github/workflows/update-test-durations.yml
vendored
2
.github/workflows/update-test-durations.yml
vendored
@@ -58,7 +58,7 @@ jobs:
|
|||||||
uses: actions/cache/save@v4
|
uses: actions/cache/save@v4
|
||||||
with:
|
with:
|
||||||
path: .test_durations_py*
|
path: .test_durations_py*
|
||||||
key: test-durations-py${{ matrix.python-version }}-${{ github.sha }}
|
key: test-durations-py${{ matrix.python-version }}
|
||||||
|
|
||||||
- name: Save uv caches
|
- name: Save uv caches
|
||||||
if: steps.cache-restore.outputs.cache-hit != 'true'
|
if: steps.cache-restore.outputs.cache-hit != 'true'
|
||||||
|
|||||||
Reference in New Issue
Block a user