Skip to content

Commit

Permalink
shard unit tests in CI for faster CI runs (#5572)
Browse files Browse the repository at this point in the history
* split main unit tests across 2 processes to increase ci speed

* use 3 shards for regular tests and 2 shards for slow tests

* explicitly define each shard

the strategy.job_total figure can easily change, which would cause pretty big
problems with our tests. if we manually define the entire shard piece instead
of trying to calculate it, this makes the job more robust to future changes.
  • Loading branch information
mat-if authored Oct 23, 2024
1 parent 06fc04b commit e43cb00
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ jobs:
test:
name: Test
runs-on: ubuntu-latest
strategy:
matrix:
shard: [1/3, 2/3, 3/3]

steps:
- name: Check out Git repository
Expand All @@ -63,7 +66,7 @@ jobs:
run: yarn --non-interactive --frozen-lockfile

- name: Run tests
run: yarn test:coverage --maxWorkers=2 --workerIdleMemoryLimit=2000MB
run: yarn test:coverage --maxWorkers=2 --workerIdleMemoryLimit=2000MB --shard=${{ matrix.shard }}

- name: Check for missing fixtures
run: |
Expand All @@ -84,6 +87,9 @@ jobs:
testslow:
name: Slow Tests
runs-on: ubuntu-latest
strategy:
matrix:
shard: [1/2, 2/2]

steps:
- name: Check out Git repository
Expand All @@ -105,7 +111,7 @@ jobs:
run: yarn --non-interactive --frozen-lockfile

- name: Run slow tests & coverage
run: yarn test:slow:coverage --maxWorkers=2 --workerIdleMemoryLimit=2000MB
run: yarn test:slow:coverage --maxWorkers=2 --workerIdleMemoryLimit=2000MB --shard=${{ matrix.shard }}

- name: Check for missing fixtures
run: |
Expand Down

0 comments on commit e43cb00

Please sign in to comment.