CI Sharding¶
Split your test suite across multiple CI nodes for faster parallel runs.
Usage¶
Strategies¶
Slice (ordered)¶
Splits tests into sequential chunks. Deterministic — same tests always go to the same shard.
testx --partition slice:1/4 # First quarter
testx --partition slice:2/4 # Second quarter
testx --partition slice:3/4 # Third quarter
testx --partition slice:4/4 # Last quarter
Hash (stable)¶
Assigns tests to shards by hashing the test name. When you add or remove tests, existing tests stay on the same shard.
GitHub Actions example¶
jobs:
test:
strategy:
fail-fast: false
matrix:
shard: [1, 2, 3, 4]
steps:
- uses: actions/checkout@v4
- run: testx --partition slice:${{ matrix.shard }}/4
GitLab CI example¶
Notes¶
- All shards combined cover 100% of tests with no overlap
- Combine with
--cacheto skip unchanged shards - Combine with
--affectedto skip shards entirely when nothing changed