Skip to content

Commit 57e8651

Browse files
ericallamTrigger.dev RepoOps
authored andcommitted
perf(webapp): run unit and e2e test files in parallel on fewer shards
Runs webapp unit test files in parallel (half the available cores) and cuts that CI matrix from 24 shards to 6. Webapp e2e files run four at a time on one shard instead of one at a time on two. Mono-RevId: e62ad92a646140b8f97d75ed6978d4f698e14238
1 parent 11436a3 commit 57e8651

5 files changed

Lines changed: 12 additions & 15 deletions

File tree

‎.github/workflows/e2e-webapp.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ jobs:
1919
strategy:
2020
fail-fast: false
2121
matrix:
22-
shardIndex: [1, 2]
23-
shardTotal: [2]
22+
shardIndex: [1]
23+
shardTotal: [1]
2424
env:
2525
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
2626
SHARD_INDEX: ${{ matrix.shardIndex }}

‎.github/workflows/unit-tests-webapp.yml‎

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,15 @@ on:
1414
jobs:
1515
unitTests:
1616
name: "🧪 Unit Tests: Webapp"
17-
# Webapp test throughput is limited per-machine (one docker daemon + disk absorbing
18-
# all the per-file Postgres/ClickHouse container spin-up), so many machines beats
19-
# few big ones - fewer/bigger (3x32) measured slower than 10x8. The 16x (vs 8x)
20-
# gives the fork pool the CPU headroom the 8x runners lacked.
17+
# Files run in parallel (half the cores) and share one Postgres per runner, so a
18+
# few machines are enough; per-file Redis and ClickHouse boots are what's left.
2119
runs-on: warp-ubuntu-latest-x64-16x
2220
strategy:
2321
# one flaky shard shouldn't cancel its siblings - lets us re-run only the failed shard
2422
fail-fast: false
2523
matrix:
26-
shardIndex:
27-
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24]
28-
shardTotal: [24]
24+
shardIndex: [1, 2, 3, 4, 5, 6]
25+
shardTotal: [6]
2926
env:
3027
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
3128
SHARD_INDEX: ${{ matrix.shardIndex }}

‎apps/webapp/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"db:seed:queue-metrics": "varlock run --inject vars -- tsx seed-queue-metrics.mts",
2727
"db:seed:webhooks": "varlock run --inject vars -- tsx seed-webhook-deliveries.ts",
2828
"upload:sourcemaps": "bash ./upload-sourcemaps.sh",
29-
"test": "cross-env NODE_ENV=test varlock run --inject vars -- vitest --no-file-parallelism",
29+
"test": "cross-env NODE_ENV=test varlock run --inject vars -- vitest",
3030
"test:perf": "cross-env NODE_ENV=test varlock run --inject vars -- vitest --config ./vitest.perf.config.ts --run",
3131
"eval:dev": "cross-env NODE_ENV=test varlock run --inject vars -- evalite watch",
3232
"test:bench": "cross-env NODE_ENV=test varlock run --inject vars -- vitest --config ./vitest.bench.config.ts --run"

‎apps/webapp/vitest.config.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ export default defineConfig({
4949
],
5050
globals: true,
5151
pool: "forks",
52+
maxWorkers: "50%",
5253
setupFiles: ["./test/setup.ts"], // test fallbacks and isolation
5354
},
5455
// @ts-ignore

‎apps/webapp/vitest.e2e.config.ts‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,11 @@ export default defineConfig({
99
globals: true,
1010
pool: "forks",
1111
/**
12-
* Each e2e file boots its own Docker stack (Postgres, Redis, s2-lite,
13-
* MinIO) plus a webapp process. Running files in parallel boots several
14-
* stacks at once and thrashes the CI runner into a timeout, so run them
15-
* one at a time, matching the repo's `pnpm test --no-file-parallelism`.
12+
* Each e2e file boots a webapp process plus Redis, s2-lite and MinIO, and
13+
* clones its database from the shared test Postgres. A few files at a time
14+
* keeps the runner from thrashing.
1615
*/
17-
fileParallelism: false,
16+
maxWorkers: 4,
1817
},
1918
// @ts-ignore
2019
plugins: [tsconfigPaths({ projects: ["./tsconfig.json"] })],

0 commit comments

Comments
 (0)