mirror of
https://github.com/crewAIInc/crewAI.git
synced 2025-12-16 04:18:35 +00:00
89 lines
2.4 KiB
YAML
89 lines
2.4 KiB
YAML
name: Run Tests
|
|
|
|
on: [pull_request]
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
env:
|
|
OPENAI_API_KEY: fake-api-key
|
|
PYTHONUNBUFFERED: 1
|
|
|
|
jobs:
|
|
tests:
|
|
name: tests (${{ matrix.python-version }})
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 15
|
|
strategy:
|
|
fail-fast: true
|
|
matrix:
|
|
python-version: ['3.10', '3.11', '3.12', '3.13']
|
|
group: [1, 2, 3, 4, 5, 6, 7, 8]
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Restore global uv cache
|
|
id: cache-restore
|
|
uses: actions/cache/restore@v4
|
|
with:
|
|
path: |
|
|
~/.cache/uv
|
|
~/.local/share/uv
|
|
.venv
|
|
key: uv-main-py${{ matrix.python-version }}-${{ hashFiles('uv.lock') }}
|
|
restore-keys: |
|
|
uv-main-py${{ matrix.python-version }}-
|
|
|
|
- name: Install uv
|
|
uses: astral-sh/setup-uv@v6
|
|
with:
|
|
version: "0.8.4"
|
|
python-version: ${{ matrix.python-version }}
|
|
enable-cache: false
|
|
|
|
- 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
|
|
|
|
- name: Save uv caches
|
|
if: steps.cache-restore.outputs.cache-hit != 'true'
|
|
uses: actions/cache/save@v4
|
|
with:
|
|
path: |
|
|
~/.cache/uv
|
|
~/.local/share/uv
|
|
.venv
|
|
key: uv-main-py${{ matrix.python-version }}-${{ hashFiles('uv.lock') }}
|