Repository navigation
ci: shard the PR browser unit tests - #343816
Logan Ramos (lramos15) wants to merge 1 commit into
Conversation
82ea4b4 to
79dd06f
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Invalid shard coordinates can produce a successful run without executing any tests.
1 open issue
What changed in this PR
This PR reduces browser unit-test time in VS Code’s pull-request CI by running two parallel shards per operating system.
Changes:
- Adds
--testSplit <i>/<n>to distribute browser test files round-robin. - Creates two browser unit-test jobs each for Linux, macOS, and Windows.
- Passes shard coordinates through the reusable OS workflows.
| File | Description |
|---|---|
test/unit/browser/index.js |
Adds shard selection and CLI help. |
.github/workflows/pr.yml |
Defines two browser unit-test shards per OS. |
.github/workflows/pr-win32-test.yml |
Passes shard arguments to Chromium tests on Windows. |
.github/workflows/pr-linux-test.yml |
Passes shard arguments to Chromium tests on Linux. |
.github/workflows/pr-darwin-test.yml |
Passes shard arguments to WebKit tests on macOS. |
Review effort: Balanced
79dd06f to
d20477d
Compare
dcfe9d3 to
94f7801
Compare
d20477d to
7fcc1f4
Compare
The browser unit tests took 8 to 10 min per platform on one machine. The browser test runner gets a --testSplit option, like the Electron one, and each platform runs them in two shards. The runner rejects a part outside 1 <= i <= n, such as 3/2, which would select no test files and pass. Failed tests are still rerun from their own files, and on macOS and Windows the split divides only the test files that the unit test plan selects. Co-authored-by: Copilot <[email protected]>
7fcc1f4 to
4b91a68
Compare
94f7801 to
43b58ea
Compare
|
Closing: this split doesn't shorten the run. Across 16 CI runs of the stack, the browser unit tests took 11–12.5 minutes unsplit on Linux (max 14.9), 10.9–12.1 on Windows (max 12.8) and about 9.6 on macOS (max 11.4). That's below the slowest job of the run, which with the rest of the stack is a Windows Agent Host E2E shard or the WSL smoke shard (median run time about 18.3 min). A Monte Carlo replay of the measured job times shows no change to the median or p90 with or without this split on any platform, so it would only add jobs and macOS/Windows runner minutes. The rest of the stack is in #343812 → #343813 → #343814 → #343815. |

The browser unit tests took 8–10 min on one machine per OS.
test/unit/browser/index.jsgets a--testSplit <i>/<n>option like the Electron runner's, which deals out the test files in turn, and each OS runs<OS> (unit 1/2) / Browserand<OS> (unit 2/2) / Browser.The Windows Agent Host E2E sharding that this PR first had moved down to #343812.
Saves: median −0.7 min (13.4 → 12.7), for 3 more jobs and about 24 more runner-minutes per run.
Validation
node test/unit/browser/index.js --browser chromium --testSplit 150/150 --reporter dot: 103 passing.npm run eslint -- test/unit/browser/index.js: clean.cd build && node --test lib/test/agentHostTestSelection.test.ts lib/test/detectChanges.test.ts lib/test/detectMissingCaches.test.ts: 22 passed.actionlinton the changed workflows: nothing new.Part of a stack to speed up PR CI
GitHub stack #343905: #343812 → #343813 → #343814 → #343815 → #343816 (#343817 is separate). Each PR shows only its own changes, and CI runs on every layer as if it targeted
main.Estimated cumulative savings, from replaying step timings of 60 PR runs (Oct 21–23):
Measured so far: one run of the whole stack, before the Dev Drive, took 18.4 min. Its Windows jobs lost 2.2–4.3 min each to restoring
node_modules, which the Dev Drive fixes, and 2.3–3.1 min to a burst of six concurrent PR runs waiting for runners. The required<OS> / <job>checks don't change.