Skip to content

perf(ci): parallelize backend pytest with xdist - #1111

Merged
DerrickF merged 1 commit into
developfrom
perf/backend-pytest-xdist
Sep 14, 2026
Merged

DerrickF merged 1 commit into
developfrom
perf/backend-pytest-xdist

Conversation

@DerrickF

Copy link
Copy Markdown
Contributor

What

Runs the backend pytest suite (~3k tests across 469 files) with pytest-xdist -n auto on the PR gate (tests.yml), so it fans across all runner cores instead of running single-threaded — the backend job is the PR long pole, and the same suite re-runs as the deploy gate, so both get faster.

Changes

  • backend/pyproject.toml: add pytest-xdist==3.6.1 to dev deps (+ regenerated uv.lock)
  • .github/workflows/tests.yml: backend job now uv run pytest tests/ -n auto
  • backend/pytest.ini: drop -v from addopts (thousands of PASSED lines, no diagnostic value)

Deliberately NOT changed

  • The nightly coverage run (scripts/backend/test.sh) stays serial — xdist + coverage combining is a separate change with its own edge cases.

Verified

  • xdist parallelizes locally (created: 2/2 workers); targeted tests/costs (218) and tests/security (167) green under -n auto. Full suite runs on CI.

Run the backend suite with pytest-xdist -n auto on the PR gate so the ~3k tests fan across all runner cores instead of running single-threaded. Also drop -v from backend/pytest.ini (it produced thousands of PASSED lines with no diagnostic value). The nightly coverage run (scripts/backend/test.sh) is left serial on purpose.
@DerrickF
DerrickF merged commit 356e11c into develop Sep 14, 2026
6 checks passed
DerrickF added a commit that referenced this pull request Sep 15, 2026
Make ts-jest transpile-only (isolatedModules) so jest workers stop re-type-checking the whole project each — the dominant cost of the infra suite (the long pole once backend went parallel in #1111). Add a single 'tsc --noEmit' (npm run build) step to the infra CI job so type safety is preserved on PRs (previously only ts-jest enforced it; tsc ran only in teardown.yml). Workers stay at 2 (the --maxWorkers bump regressed 2.5x in #1112). No const enum in the tree, so isolatedModules is safe. Verified: tsc clean; 178 tests green transpile-only.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant