mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-08 23:58:34 +00:00
feat(tests): add duration caching for pytest-split
- Cache test durations for optimized splitting
This commit is contained in:
20
.github/workflows/tests.yml
vendored
20
.github/workflows/tests.yml
vendored
@@ -45,14 +45,34 @@ jobs:
|
||||
- name: Install the project
|
||||
run: uv sync --all-groups --all-extras
|
||||
|
||||
- name: Restore test durations
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: .test_durations_py*
|
||||
key: test-durations-py${{ matrix.python-version }}-
|
||||
restore-keys: |
|
||||
test-durations-py${{ matrix.python-version }}-
|
||||
|
||||
- name: Run tests (group ${{ matrix.group }} of 8)
|
||||
run: |
|
||||
PYTHON_VERSION_SAFE=$(echo "${{ matrix.python-version }}" | tr '.' '_')
|
||||
DURATION_FILE=".test_durations_py${PYTHON_VERSION_SAFE}"
|
||||
|
||||
if [ -f "$DURATION_FILE" ]; then
|
||||
echo "Using cached test durations for optimal splitting"
|
||||
DURATIONS_ARG="--durations-path=${DURATION_FILE}"
|
||||
else
|
||||
echo "No cached durations found, tests will be split evenly"
|
||||
DURATIONS_ARG=""
|
||||
fi
|
||||
|
||||
uv run pytest \
|
||||
--block-network \
|
||||
--timeout=30 \
|
||||
-vv \
|
||||
--splits 8 \
|
||||
--group ${{ matrix.group }} \
|
||||
$DURATIONS_ARG \
|
||||
--durations=10 \
|
||||
-n auto \
|
||||
--maxfail=3
|
||||
|
||||
Reference in New Issue
Block a user