Files
crewAI/.github/workflows/update-test-durations.yml
Matt Aitchison 0bdc5a093e ci: optimize test workflows — reduce jobs, share venv via artifact
- Restructure tests.yml: install once per Python version, share .venv
  via artifact instead of 32 independent installs
- Reduce test groups from 8 to 4 (tests only take ~60s per group)
- Only test Python 3.12+3.13 on PRs; full matrix on push to main
- Switch all workflows from manual actions/cache to setup-uv built-in
  caching, eliminating cache race conditions
- Add --frozen flag to uv sync for deterministic CI installs
- Re-enable duration-based test splitting with least_duration algorithm
  (was disabled due to a bug in the path filter)
- Fix update-test-durations path filter (tests/**/*.py never matched
  actual test dirs under lib/)
- Add concurrency group with cancel-in-progress for PR runs
- Add gate jobs to satisfy existing branch protection required checks
2026-02-25 16:14:38 -06:00

52 lines
1.3 KiB
YAML

name: Update Test Durations
on:
push:
branches:
- main
paths:
- 'lib/crewai/tests/**/*.py'
- 'lib/crewai-tools/tests/**/*.py'
- 'lib/crewai-files/tests/**/*.py'
workflow_dispatch:
permissions:
contents: read
jobs:
update-durations:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10', '3.11', '3.12', '3.13']
env:
OPENAI_API_KEY: fake-api-key
PYTHONUNBUFFERED: 1
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
version: "0.8.4"
python-version: ${{ matrix.python-version }}
enable-cache: true
- name: Install the project
run: uv sync --all-groups --all-extras --frozen
- name: Run all tests and store durations
run: |
PYTHON_VERSION_SAFE=$(echo "${{ matrix.python-version }}" | tr '.' '_')
uv run --frozen pytest --store-durations --durations-path=.test_durations_py${PYTHON_VERSION_SAFE} -n auto
continue-on-error: true
- name: Save durations to cache
if: always()
uses: actions/cache/save@v4
with:
path: .test_durations_py*
key: test-durations-py${{ matrix.python-version }}