mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-25 00:51:20 +00:00
Reduces CI wall time by running the test suite as 4 parallel matrix
jobs instead of a single job. Each shard runs ~3,000 tests in
parallel, so total wall time drops from ~4min to ~60-90s.
Changes:
- Add pytest-split to dev extras (deterministic test splitting,
composes with pytest-xdist's -n auto inside each shard).
- Matrix-split tests.yml 'test' job into 4 groups. Each shard runs
'pytest ... --splits 4 --group N' and parallelizes inside with
the -n auto already in pyproject.toml's addopts.
- fail-fast: false so all shards finish even if one fails
(consistent with current behavior when there's no matrix).
Expected CI timing:
Before: 243s single-job (4m03s)
After: ~60-90s per shard in parallel + ~25s install overhead
\u2192 total CI ~90-115s
No test-file changes. Deterministic hash-based distribution (no
.test_durations file yet; can add one later for better balance).
The e2e job is unchanged — it's already small (20s) and runs
separately.
82 lines
2.1 KiB
YAML
82 lines
2.1 KiB
YAML
name: Tests
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
branches: [main]
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
# Cancel in-progress runs for the same PR/branch
|
|
concurrency:
|
|
group: tests-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
test:
|
|
name: test (${{ matrix.group }}/4)
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 10
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
group: [1, 2, 3, 4]
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
|
|
|
- name: Install system dependencies
|
|
run: sudo apt-get update && sudo apt-get install -y ripgrep
|
|
|
|
- name: Install uv
|
|
uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # v5
|
|
|
|
- name: Set up Python 3.11
|
|
run: uv python install 3.11
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
uv venv .venv --python 3.11
|
|
source .venv/bin/activate
|
|
uv pip install -e ".[all,dev]"
|
|
|
|
- name: Run tests (shard ${{ matrix.group }}/4)
|
|
run: |
|
|
source .venv/bin/activate
|
|
python -m pytest tests/ -q --ignore=tests/integration --ignore=tests/e2e --tb=short \
|
|
--splits 4 --group ${{ matrix.group }}
|
|
env:
|
|
# Ensure tests don't accidentally call real APIs
|
|
OPENROUTER_API_KEY: ""
|
|
OPENAI_API_KEY: ""
|
|
NOUS_API_KEY: ""
|
|
|
|
e2e:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 10
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
|
|
|
- name: Install uv
|
|
uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # v5
|
|
|
|
- name: Set up Python 3.11
|
|
run: uv python install 3.11
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
uv venv .venv --python 3.11
|
|
source .venv/bin/activate
|
|
uv pip install -e ".[all,dev]"
|
|
|
|
- name: Run e2e tests
|
|
run: |
|
|
source .venv/bin/activate
|
|
python -m pytest tests/e2e/ -v --tb=short
|
|
env:
|
|
OPENROUTER_API_KEY: ""
|
|
OPENAI_API_KEY: ""
|
|
NOUS_API_KEY: ""
|