You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
CI: run tests in parallel within each shard (xdist) on the free 4-vCPU runners #2001
Core CI takes 13 to 27 minutes per push. In a recent slow run, "Test Postgres Unit (Python 3.14, shard 1/6)" spent 940 seconds in its test step. The other shards finished in about 9 to 11 minutes, and the Windows SQLite shards took about 11 minutes.
Each shard runs pytest in a single process. pytest-xdist is already in the dev dependencies, but neither test.yml nor the justfile passes -n. GitHub's free runners for public repos (ubuntu-latest and windows-latest) have 4 vCPU and 16 GB, so most of each runner sits idle.
Paid runners were considered and set aside: Depot runners cost $0.024/min at 8 vCPU (vs $0.006 at 2), and core's CI is free on GitHub. Re-splitting shards by duration was also set aside, because the testmon/shard work took a long time before.
Plan
SQLite first. Add -n 4 to one SQLite unit shard in test.yml (through the just test-unit-sqlite recipe) and compare its test-step time with the current run. SQLite tests use per-test database files, so they should already be worker-safe.
Roll out to the SQLite jobs if the speedup holds, including Windows.
Postgres. The Postgres jobs share one service container, so each xdist worker needs its own database (for example, named from PYTEST_XDIST_WORKER). Make the Postgres fixtures worker-aware, then add -n 4 to the Postgres shards.
Check the reporting that CI depends on: junit XML, --durations, and the shard file lists.
Done when
SQLite and Postgres shards run with xdist on the free runners.
The slowest shard's test step is measurably shorter (baseline: 940s for Postgres Unit 1/6).
No new flaky failures from shared state across a week of pushes.
Component: Testing / CI infrastructure (not Cloud)
Priority: Medium. It cuts CI wall-clock time (13–27 min per push) but nothing is broken.
Complexity: Medium
The SQLite rollout should be simple, because per-test database files are already worker-safe.
The Postgres work is the harder part. Each xdist worker needs its own database on the shared service container, so the Postgres fixtures have to become PYTEST_XDIST_WORKER-aware.
Duplicates: A search for existing issues on xdist and parallel CI found none.
Notes for whoever picks this up
Run the SQLite shard through just test-unit-sqlite first, as the plan says, and compare its test-step time with the current run.
Check that junit XML output, --durations reporting and the shard file lists still work under -n 4. Also check that per-worker output doesn't break testmon.
The repo requires 100% coverage. Confirm that coverage combining works across xdist workers.
Changes to .github/workflows/test.yml need a maintainer. Automated agents can't modify workflow files.
No clarifying questions are needed. The plan and the done-when criteria are clear.
Activity
claude commentedon Oct 30, 2026
Claude finished @phernandez's task in 17s —— View job
Triage
PYTEST_XDIST_WORKER-aware.Notes for whoever picks this up
just test-unit-sqlitefirst, as the plan says, and compare its test-step time with the current run.--durationsreporting and the shard file lists still work under-n 4. Also check that per-worker output doesn't break testmon..github/workflows/test.ymlneed a maintainer. Automated agents can't modify workflow files.No clarifying questions are needed. The plan and the done-when criteria are clear.