Skip to content

Commit f4c2586

Browse files
committed
perf(ci): run apps/sim as three test shards
1 parent c43e842 commit f4c2586

1 file changed

Lines changed: 17 additions & 12 deletions

File tree

‎.github/workflows/test-build.yml‎

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -182,17 +182,17 @@ jobs:
182182
# without `--coverage`. See the Codecov note below.
183183
#
184184
# apps/sim runs only its first shard here; `test-shard` below runs the
185-
# other. That suite is bound by the single Vite server thread that feeds
185+
# others. That suite is bound by the single Vite server thread that feeds
186186
# every worker — wall time is flat from 4 to 13 workers — so a bigger
187-
# runner buys nothing and a second runner halves it.
187+
# runner buys nothing and each extra runner takes a proportional slice.
188188
- name: Run tests
189189
env:
190190
NODE_OPTIONS: '--no-warnings --max-old-space-size=8192'
191191
NEXT_PUBLIC_APP_URL: 'https://www.sim.ai'
192192
DATABASE_URL: 'postgresql://postgres:postgres@localhost:5432/simstudio'
193193
ENCRYPTION_KEY: '0000000000000000000000000000000000000000000000000000000000000000' # dummy key for CI only
194194
TURBO_CACHE_DIR: .turbo
195-
SIM_TEST_SHARD: 1/2
195+
SIM_TEST_SHARD: 1/3
196196
run: bun run test
197197

198198
- name: Check schema and migrations are in sync
@@ -208,15 +208,20 @@ jobs:
208208
fi
209209
echo "✅ Schema and migrations are in sync"
210210
211-
# The second half of apps/sim's Vitest suite. Everything else — lint, the
212-
# audits, type-check, the other workspaces' suites — lives in `test-build`
213-
# with shard 1; this job exists only because that suite cannot go faster on
214-
# one machine (see the "Run tests" note there). The Turbo cache disk gets
215-
# its own key so the two shards' entries do not evict each other.
211+
# The remaining shards of apps/sim's Vitest suite. Everything else — lint,
212+
# the audits, type-check, the other workspaces' suites — lives in
213+
# `test-build` with shard 1; these jobs exist only because that suite cannot
214+
# go faster on one machine (see the "Run tests" note there). Three shards
215+
# put each runner at roughly the fixed cost of checkout + install. The Turbo
216+
# cache disk gets its own key so the shards' entries do not evict each other.
216217
test-shard:
217-
name: Test (shard 2)
218+
name: Test (shard ${{ matrix.shard }})
218219
runs-on: ${{ (vars.CI_PROVIDER == '' || vars.CI_PROVIDER == 'blacksmith') && 'blacksmith-8vcpu-ubuntu-2404' || 'ubuntu-latest' }}
219220
timeout-minutes: 15
221+
strategy:
222+
fail-fast: false
223+
matrix:
224+
shard: [2, 3]
220225

221226
steps:
222227
- name: Checkout code
@@ -250,7 +255,7 @@ jobs:
250255
uses: ./.github/actions/cache-mount
251256
with:
252257
provider: ${{ vars.CI_PROVIDER }}
253-
key: ${{ github.repository }}-turbo-cache-shard-${{ github.event_name }}${{ github.event.pull_request.head.repo.fork && '-fork' || '' }}
258+
key: ${{ github.repository }}-turbo-cache-shard-${{ matrix.shard }}-${{ github.event_name }}${{ github.event.pull_request.head.repo.fork && '-fork' || '' }}
254259
path: ./.turbo
255260

256261
- name: Install dependencies
@@ -259,14 +264,14 @@ jobs:
259264
- name: Install ripgrep
260265
run: command -v rg || (sudo apt-get update && sudo apt-get install -y ripgrep)
261266

262-
- name: Run tests (apps/sim shard 2/2)
267+
- name: Run tests (apps/sim shard ${{ matrix.shard }}/3)
263268
env:
264269
NODE_OPTIONS: '--no-warnings --max-old-space-size=8192'
265270
NEXT_PUBLIC_APP_URL: 'https://www.sim.ai'
266271
DATABASE_URL: 'postgresql://postgres:postgres@localhost:5432/simstudio'
267272
ENCRYPTION_KEY: '0000000000000000000000000000000000000000000000000000000000000000' # dummy key for CI only
268273
TURBO_CACHE_DIR: .turbo
269-
SIM_TEST_SHARD: 2/2
274+
SIM_TEST_SHARD: ${{ matrix.shard }}/3
270275
run: bunx turbo run test --filter=@sim/app
271276

272277
# Next.js production build, in parallel with lint + tests. Sticky disks are

0 commit comments

Comments
 (0)