From 9b7b3681f6e6511e3fb4e0039c08f71aa03ac4a2 Mon Sep 17 00:00:00 2001 From: Elliot Slusky <44592435+ElliotSlusky@users.noreply.github.com> Date: Mon, 22 Jun 2026 13:58:46 -0700 Subject: [PATCH] ci: parallelize the test suite and cut install/coverage overhead (#580) Run pytest with -n auto (pytest-xdist) and COVERAGE_CORE=sysmon, enable the uv cache, and switch test output to -q. Cuts the test job from ~40min to ~4min without changing what's tested or the 60% coverage gate. --- .github/workflows/ci.yml | 13 ++++++++++++- pyproject.toml | 1 + 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index de995b2c..82c3bbb9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,6 +23,8 @@ jobs: - name: Install uv uses: astral-sh/setup-uv@v8.0.0 + with: + enable-cache: true - name: Install dependencies run: uv sync --extra dev --extra framework-comparison --extra server @@ -55,6 +57,8 @@ jobs: - name: Install uv uses: astral-sh/setup-uv@v8.0.0 + with: + enable-cache: true - name: Install dependencies run: uv sync --extra dev --extra framework-comparison --extra server @@ -63,8 +67,13 @@ jobs: run: uv run maturin develop --manifest-path rust/crates/openjarvis-python/Cargo.toml - name: Run tests + # COVERAGE_CORE=sysmon uses CPython 3.12's sys.monitoring backend, + # which is dramatically cheaper than the default C trace function. + # -n auto fans the suite out across all runner cores via pytest-xdist. + env: + COVERAGE_CORE: sysmon run: | - uv run pytest tests/ -v --tb=short -m "not live and not cloud and not hub" \ + uv run pytest tests/ -n auto -q --tb=short -m "not live and not cloud and not hub" \ --cov=openjarvis \ --cov-report=term-missing \ --cov-report=xml \ @@ -107,6 +116,8 @@ jobs: - name: Install uv uses: astral-sh/setup-uv@v8.0.0 + with: + enable-cache: true - name: Install dependencies run: uv sync --extra dev --extra server diff --git a/pyproject.toml b/pyproject.toml index c0c0ee7d..3d3c94a8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -48,6 +48,7 @@ dev = [ "pytest>=8", "pytest-asyncio>=0.24", "pytest-cov>=5", + "pytest-xdist>=3", "respx>=0.22", "ruff>=0.4", "pre-commit>=3.0",