Commit 71be244
ci(test): shard the Vitest suite across 4 runners (#2641)
The Test job is the whole of CI's critical path: ~8.3 min of a ~9 min
wall clock. Its cost is almost entirely fixed per-file overhead rather
than the assertions — a recent PR run reported 495s of which only 178s
was `tests`, against `setup` 831s, `import` 199s and `environment` 156s
(cumulative across workers). Those are paid once per test file because
`isolate: true` re-executes the module graph for every file, and
isolation has to stay on (vitest.config.mts records the order-dependent
failures that turning it off caused).
So rather than touch isolation, split the 559 files across 4 runners:
- test: a 4-shard matrix, PR-only, running `pnpm test --shard=N/4`.
Fixed overhead per job here is only ~30s (checkout + Node + install
off a warm pnpm store), so 4 shards trade ~26% more runner minutes for
~3x less wall clock. fail-fast: false so one broken shard doesn't mask
the others.
- test-coverage: the former push-only coverage path, split into its own
unsharded job. Nothing blocks on it, so it keeps feeding Codecov one
complete report instead of needing a blob-report merge.
Vitest shards by hashing each test file's path, so unit/dom files
interleave and the shards self-balance. Verified that `vitest run
--shard` really splits and conserves the file/test totals across
projects — note `vitest list` ignores --shard, so it cannot be used to
check this. Nothing (branch protection, `needs:`, workflow_run)
references the old `Test` check name, so the rename is safe.
Co-authored-by: Jack Zhuang <277994282+os-zhuang@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>1 parent 12e980c commit 71be244
1 file changed
Lines changed: 58 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
38 | 50 | | |
39 | | - | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
40 | 55 | | |
41 | 56 | | |
42 | | - | |
43 | | - | |
44 | | - | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
45 | 65 | | |
46 | 66 | | |
47 | 67 | | |
| |||
64 | 84 | | |
65 | 85 | | |
66 | 86 | | |
67 | | - | |
68 | | - | |
| 87 | + | |
69 | 88 | | |
70 | 89 | | |
71 | 90 | | |
72 | | - | |
73 | | - | |
74 | | - | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
75 | 123 | | |
76 | | - | |
77 | | - | |
78 | | - | |
| 124 | + | |
79 | 125 | | |
80 | 126 | | |
81 | 127 | | |
82 | | - | |
83 | 128 | | |
84 | 129 | | |
85 | 130 | | |
| |||
0 commit comments