Skip to content

ci: skip the macOS and Windows unit test jobs when the plan selects nothing - #344105

Merged
Alexandru Dima (alexdima) merged 1 commit into
mainfrom
ripple/skip-empty-selection
Oct 25, 2026
Merged

Alexandru Dima (alexdima) merged 1 commit into
mainfrom
ripple/skip-empty-selection

Conversation

@alexdima

@alexdima Alexandru Dima (alexdima) commented Oct 25, 2026 •

Copy link
Copy Markdown
Member

What

Follow-up to #342907. When the unit test plan selects no file, the four macOS and Windows unit test jobs (macOS (run) / Electron-Unit, macOS (unit) / Browser, Windows (run) / Electron-Unit, Windows (unit) / Browser) still check out, restore node_modules, transpile and set up Electron or Playwright, and only then skip their test steps: 8.9 VM minutes per push that selects nothing, for nothing (see Savings). This skips those jobs instead.

How

  • The Check ripple step of Detect Changes now also reports selects-nothing=true when the plan of a working ripple selects no file: the ripple build did not fail, the plan step succeeded, and plan.json has select: true and an empty unit list. A missing, failed or run-everything plan (select: false) reports false.
  • A new Detect Changes output, selected-unit-tests, is unit-tests == 'true' && selects-nothing != 'true', so a missing value runs the jobs.
  • The four jobs read selected-unit-tests instead of unit-tests in their if, and so do their parts in required-checks, which accepts a skipped job only when change detection succeeded and the job's output is 'false'. The Linux unit test jobs keep unit-tests and run every unit test.
  • Those four jobs run nothing but unit tests: their integration, smoke, Agent Host E2E and WSL steps are all off, and they save no cache. Skipping them whole loses nothing. Their test steps keep the plan conditions as a fallback.
  • detectChanges.test.ts checks the new output's expression and that exactly the jobs that pass unit_test_selection: true (the four above, never Linux) skip through it. The existing test checks the shape of their if.
  • The Detect Changes summary and build/ripple/README.md mention the skip.

This pull request changes .github/workflows/pr.yml, which is in runEverything, so its own CI runs every unit test and cannot show the skip. The sibling live test #344098 shows what the four jobs do today on an empty plan.

Savings

The "selects nothing" live test (#344098, run 40172614560, see its result) measured what the four jobs cost on a push whose plan selected nothing. That is what this change saves on such pushes:

Job Duration, every test step skipped
macOS (run) / Electron-Unit 93 s
macOS (unit) / Browser 90 s
Windows (run) / Electron-Unit 180 s
Windows (unit) / Browser 168 s
Total 8.9 VM minutes

516 s of that is setup before the test steps, and restoring the node_modules cache alone takes 55–62% of each job. The time outside the test steps of the same jobs in 40 recent runs agrees (median 7.6, mean 9.1 minutes per push).

  • Per push: about 17% of pushes select nothing, so this saves about 1.5 VM minutes per push on average, two thirds of them on Windows. Pushes whose changes cannot affect the unit tests (unit-tests: false) already skip these jobs, and they were 2 of 120 recent runs. If the 17% includes them, the saving is still at least 1.35 minutes per push.
  • Per day: in the last 7 days, pr.yml ran about 2,500 times for pull requests. 240 runs a day completed, 91 were cancelled by a newer push, and 34 waited for approval and ran nothing. That makes about 330 to 360 VM minutes a day (5.5 to 6 hours) for the completed runs. Counting cancelled runs whose jobs had already set up, it's up to 500. Weekdays see about 1.2 times the daily average.
  • macOS runs on GitHub-hosted macos-26-xlarge runners, which bill each job by the started minute: 2 billed minutes per job here, so 4 per push that selects nothing (about 160 a day). The Windows minutes are 1ES pool VM time, not counting provisioning.
  • Skipping these jobs does not shorten the run, because the Linux jobs set its duration. It saves runner time, not wall-clock time.

Validation

  • cd build && node --test lib/test/detectChanges.test.ts lib/test/agentHostTestSelection.test.ts lib/test/detectMissingCaches.test.ts: passed, 23 tests in 4 suites. Three mutations of pr.yml each fail it: gating a Linux unit test job by the plan, letting a missing selects-nothing skip, and leaving a macOS job's if on unit-tests.

  • actionlint 1.7.12 with shellcheck 0.11.0 on pr.yml, pr-darwin-test.yml and pr-win32-test.yml: same findings as main, the 6 self-hosted runner label warnings and 3 SC2086 infos in steps this change does not touch. Check ripple writes its three outputs in one redirect group, as shellcheck asks (SC2129).

  • node --experimental-strip-types build/hygiene.ts .github/workflows/pr.yml build/lib/test/detectChanges.test.ts build/ripple/README.md: no hygiene-eligible files. Hygiene's filters cover none of these files: .github/** is outside its scope, build/lib/** is excluded from its indentation, copyright and formatting checks, and so is Markdown. The pre-commit hygiene hook passed. npm run eslint -- build/lib/test/detectChanges.test.ts: passed.

  • Local simulation. ripple built from this branch planned real commits on top of main. The harness ran the actual Plan unit tests, Check ripple and required-checks scripts from the edited pr.yml with bash -eo pipefail, and the real detect.ts change detectors. It then evaluated the workflow's own expressions (job outputs, job and step if conditions, hashFiles) with GitHub's comparison semantics:

    Scenario Plan selects-nothing selected-unit-tests macOS and Windows unit test jobs Linux unit test jobs Required checks
    Selection (body of MoveCaretCommand.getEditOperations) success, select, 1 file false true run the planned file run every unit test 15/15 pass
    Empty selection (comment in strings.ts) success, select, 0 files true false skipped (on main: run and skip every test step) run every unit test 15/15 pass
    Empty selection, README only (unit-tests: false) success, select, 0 files true false skipped, as on main skipped, as on main 15/15 pass
    Run everything (scripts/test.sh) success, no select false true run every unit test run every unit test 15/15 pass
    Run everything (a module ripple cannot parse) success, no select, warning false true run every unit test run every unit test 15/15 pass
    Failed plan (ripple build failed, no binary) failure, warning false true run every unit test run every unit test 15/15 pass

    Against main's pr.yml, the same scenarios differ only in the empty src selection row. required-checks logs macos-electron-unit-tests was skipped because the changes cannot affect it (selected-unit-tests: false).

  • CI of this pull request (run 40174651599): passed. Detect Changes planned running every unit test: test job definition (.github/workflows/pr.yml) and uploaded no plan. Check ripple ran the new script (BUILD: skipped, PLAN: success) without a warning. The four macOS and Windows unit test jobs ran every unit test and passed (macOS Electron-Unit 15.9 min, Windows Electron-Unit 20.3 min), and so did the required macOS and Windows Electron-Unit and Browser checks. The Ripple check ran because this changes build/ripple/README.md, and passed.

Two theoretical cases still run the four jobs with every test step skipped, as on main. One is a ripple that writes an empty plan and then fails. The other is a plan that succeeds although the ripple build step failed (which leaves no binary in practice). In both, Upload unit test plan uploads the plan because it only checks select. This change leaves that as is (selects-nothing is false in both), but checking steps.plan.outcome == 'success' there would close the first case.

…othing

When the unit test plan selects no file, the macOS and Windows unit test
jobs still checked out, restored node_modules, transpiled and set up
Electron or Playwright before skipping their test steps. Detect Changes
now reports whether the plan of a working ripple selects nothing
(selects-nothing in the Check ripple step), and its selected-unit-tests
output skips those four jobs, which run nothing but unit tests. A
missing, failed or run-everything plan still runs them, and Linux keeps
running every unit test. required-checks accepts the skips through the
same output.

Co-authored-by: Copilot <[email protected]>
Copilot AI balanced review requested due to automatic review settings October 25, 2026 07:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The scoped changes keep job gating and required-check reporting consistent while preserving failure fallbacks and Linux coverage.

No open issues 🎉

What changed in this PR

This follow-up to #342907 avoids unnecessary setup by skipping the four macOS and Windows unit test jobs when a successful ripple plan selects no tests.

Changes:

  • Adds selected-unit-tests gating while preserving failure fallbacks and Linux’s existing full-suite behavior.
  • Aligns the four job conditions with required-check reporting.
  • Adds workflow regression assertions and documents the job-level skip.

No actionable findings remain.

File Description
build/​ripple/​README.md Documents skipping jobs when the plan selects no tests.
build/​lib/​test/​detectChanges.test.ts Checks the output expression and the exact jobs eligible for plan-based skipping.
.github/​workflows/​pr.yml Detects empty successful plans and updates job gating, required checks, and summary text.

Review effort: Balanced

@alexdima
Alexandru Dima (alexdima) merged commit 7e4e9d8 into main Oct 25, 2026
61 checks passed
@alexdima
Alexandru Dima (alexdima) deleted the ripple/skip-empty-selection branch October 25, 2026 08:26
@vs-code-engineering vs-code-engineering Bot added this to the 1.144.0 milestone Oct 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants