Skip to content

Framework for orchestrating role-playing, autonomous AI agents. By fostering collaborative intelligence, CrewAI empowers agents to work together seamlessly, tackling complex tasks.

Speed up GitHub Actions tests with parallelization (#3107)

Greyson LaLondea0fcc0c8d19d
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index ea69d01d0..86c0d374a 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -7,14 +7,18 @@ permissions:
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
@@ -23,6 +27,9 @@ jobs:
uses: astral-sh/setup-uv@v3
with:
enable-cache: true
+ cache-dependency-glob: |
+ **/pyproject.toml
+ **/uv.lock
- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}
@@ -30,5 +37,14 @@ jobs:
- name: Install the project
run: uv sync --dev --all-extras
- - name: Run tests
- run: uv run pytest --block-network --timeout=60 -vv
+ - name: Run tests (group ${{ matrix.group }} of 8)
+ run: |
+ uv run pytest \
+ --block-network \
+ --timeout=30 \
+ -vv \
+ --splits 8 \
+ --group ${{ matrix.group }} \
+ --durations=10 \
+ -n auto \
+ --maxfail=3
diff --git a/pyproject.toml b/pyproject.toml
index 826aaee47..111d738a4 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -83,6 +83,8 @@ dev-dependencies = [
"pytest-recording>=0.13.2",
"pytest-randomly>=3.16.0",
"pytest-timeout>=2.3.1",
+ "pytest-xdist>=3.6.1",
+ "pytest-split>=0.9.0",
]
[project.scripts]