Skip to content

Cut PR CI wall time with parallel jobs and test projects - #4601

Merged
akira28 merged 10 commits into
mainfrom
feature/reduce-duration-pr-ci
Oct 27, 2026
Merged

akira28 merged 10 commits into
mainfrom
feature/reduce-duration-pr-ci

Conversation

@akira28

@akira28 akira28 commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

PR CI starts its slow jobs at the same time as lint. The lambda Docker builds now skip PRs that don't touch their inputs, and a local ./build.sh unit-test runs test projects in parallel. Windows and macOS reuse one Linux frontend build and skip the unit tests on PRs without .NET changes. PR runs also stop saving NuGet caches that evicted the main caches. Locally, the unit-test step drops from 56s to about 28s.

Affects: Automation

Prompt summary: Reduce the duration of PR CI by fixing the low-hanging fruit. The goal is quicker feedback on pull requests without dropping any coverage that matters.

Why

The ci workflow is the slowest check on a PR, at about 20 minutes, and the Windows build job sets that time. Every job except npm waits for lint, and both lambda Docker builds run on every PR. Running npm ci inside the Windows compile alone takes about 6 minutes. Each PR also saves its own NuGet cache for each OS, which is about 3 GB in total. That pushes the repository past the 10 GB cache limit and evicts the main caches. So Windows PR runs often restore nothing, then spend about 90s uploading a new cache.

What

Jobs no longer wait for lint

The build matrix, validate-assembler, and both lambda builds start as soon as the workflow starts. A lint failure still fails the run. The trade-off is that other jobs keep using runner minutes on a PR that fails lint. validate-assembler now builds docs-builder once and runs both validations against that build.

Lambda builds run only when their inputs change

A new changes job compares the PR's merge commit with its base. Each lambda builds only when the PR touches one of these:

  • the lambda's own folder
  • a project it references, directly or indirectly
  • config/ (link-index lambda only)
  • its build workflow
  • a shared build input such as global.json, the Directory.*.props files, or ci.yml

A rename counts both its old and new path, and the root .dockerignore counts as a shared input. The same job decides whether Windows and macOS run the unit tests and whether they build the frontend natively, so every path rule lives in one place. Pushes to main always build both lambdas. A skipped job still passes a required status check.

Windows and macOS do less repeated work

A new frontend job on Linux builds the frontend assets once. The Linux build job always reuses them, because the frontend job is already a native Linux build. On most PRs, the Windows and macOS build jobs reuse them too, building with SkipNpmBuild=true. Windows and macOS build the frontend natively when the PR changes package.json, package-lock.json, the Vite or Tailwind config, or .nvmrc. Pushes to main also build it natively. Packages such as esbuild, rolldown and lightningcss ship separate native binaries for each OS, so these changes can break the build on one OS only. Running npm ci takes about 6 minutes on Windows and blocks most of the compile, while the Vite output is the same on every OS. The frontend job runs the Site project's own MSBuild target, so the assets carry the same MinVer version as the .NET build. Every build job now waits for frontend, which takes about 1.5 minutes. The npm job keeps its lint, format, typecheck and Vitest steps, but no longer runs its own Vite build.

On a PR, the Windows and macOS build jobs still compile, but they skip the unit tests unless the PR changes .NET code, build inputs, or anything under tests/ or build/. Linux runs the unit tests on every PR, and pushes to main run them on all three OSes. A PR that changes only docs, frontend assets, or config/ no longer waits about 8 minutes for Windows tests.

Test projects can run in parallel

A local ./build.sh unit-test runs one test project per CPU core at a time. A new --test-parallelism flag sets the limit. CI passes --test-parallelism=1: on 3-4 core runners, concurrent test projects starve the .NET thread pool, and two concurrency tests in Elastic.Changelog.Tests time out. Each project's output is printed as one collapsible block in the GitHub log, so the logs don't interleave. A failing project still fails the build, and every failure is listed at the end. In CI, the Test step passes --single-target, so it no longer recompiles the solution that the Compile step just built. That recompile cost 13 to 33 seconds per OS.

PRs restore the NuGet cache without saving it

On pull requests, the bootstrap action now uses actions/cache/restore. Only pushes and other events save the NuGet cache. The main caches stay under the size limit, and PR jobs skip the upload step that runs after the job. The assembler-preview and docs-preview-local workflows now set NUGET_PACKAGES. Before, they restored the cache into a folder that NuGet never read.

Risk: The path lists for the lambdas are maintained by hand. If a lambda gets a new project reference, add it to the list, or PRs that change only that project will skip the lambda build. A docs-only or config-only PR could expose a Windows-only bug that is already in the code. That failure appears on main instead of on the PR.

Verify

./build.sh unit-test

🤖 Generated with Claude Code

Jobs no longer wait on `lint`, the lambda Docker builds skip PRs that do
not touch their inputs, and `unit-test` runs test projects concurrently.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@akira28
akira28 requested a review from a team as a code owner October 27, 2026 11:39
@akira28
akira28 requested a review from bmorelli25 October 27, 2026 11:39
@akira28 akira28 added the automation packaging, ci/cd. label Oct 27, 2026
akira28 and others added 2 commits October 27, 2026 12:41
Each PR saved its own ~1GB per-OS NuGet cache, pushing the repo past the
10GB cache limit and evicting the main caches PRs restore from. Windows
PR runs then restored nothing and spent ~90s uploading a fresh cache.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The bootstrap action restores the NuGet cache into the workspace, but
these workflows never set NUGET_PACKAGES, so NuGet ignored it and
downloaded every package again.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Comment thread .github/workflows/ci.yml Resolved
Comment thread .github/workflows/ci.yml Resolved
@github-actions

Copy link
Copy Markdown
Contributor

akira28 and others added 7 commits October 27, 2026 12:55
Linux still runs the unit tests on every PR. The lambda change filter now
also counts renamed-away inputs and the root .dockerignore.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
`npm ci` takes about 6 minutes on Windows runners and sits on the
critical path of the compile. A Linux job now builds `_static` with the
Site project's own targets, and Windows and macOS reuse it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…hanges

Native npm packages such as esbuild, rolldown and lightningcss can break
on one OS only. PRs that change package.json, the lockfile, the Vite or
Tailwind config, or .nvmrc now build natively, and so do pushes to main.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The Linux leg already waits for the `frontend` job, which is itself a
native Linux build, so building the frontend again there only added a
minute of `npm ci`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
`build` already waits for `frontend`, so reading the path filters from
the `changes` job adds no wait and keeps every rule in one place. The
`npm` job drops its Vite build, which `frontend` already covers, and
`validate-assembler` builds `docs-builder` once.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The Compile step already builds everything, but `unit-test` recompiled
before testing, costing 13-33s per OS. `--single-target` skips that
dependency.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
On 3-4 core runners, concurrent test projects starve the thread pool,
and two concurrency tests in Elastic.Changelog.Tests time out on Windows
and macOS. A new `--test-parallelism` flag sets how many projects run at
once; CI uses 1, local runs keep the processor count.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@akira28
akira28 merged commit 0016359 into main Oct 27, 2026
35 checks passed
@akira28
akira28 deleted the feature/reduce-duration-pr-ci branch October 27, 2026 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automation packaging, ci/cd.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant