Repository navigation
Cut PR CI wall time with parallel jobs and test projects - #4601
Merged
Merged
Conversation
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]>
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]>
Contributor
Docs preview (local build)Handbook preview: https://docs-v3-preview.elastic.dev/elastic/docs-builder/pull/4601/ |
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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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-testruns 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 themaincaches. 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
ciworkflow is the slowest check on a PR, at about 20 minutes, and the Windowsbuildjob sets that time. Every job exceptnpmwaits forlint, and both lambda Docker builds run on every PR. Runningnpm ciinside 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 themaincaches. So Windows PR runs often restore nothing, then spend about 90s uploading a new cache.What
Jobs no longer wait for lint
The
buildmatrix,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-assemblernow buildsdocs-builderonce and runs both validations against that build.Lambda builds run only when their inputs change
A new
changesjob compares the PR's merge commit with its base. Each lambda builds only when the PR touches one of these:config/(link-index lambda only)global.json, theDirectory.*.propsfiles, orci.ymlA rename counts both its old and new path, and the root
.dockerignorecounts 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 tomainalways build both lambdas. A skipped job still passes a required status check.Windows and macOS do less repeated work
A new
frontendjob on Linux builds the frontend assets once. The Linuxbuildjob always reuses them, because thefrontendjob is already a native Linux build. On most PRs, the Windows and macOSbuildjobs reuse them too, building withSkipNpmBuild=true. Windows and macOS build the frontend natively when the PR changespackage.json,package-lock.json, the Vite or Tailwind config, or.nvmrc. Pushes tomainalso build it natively. Packages such asesbuild,rolldownandlightningcssship separate native binaries for each OS, so these changes can break the build on one OS only. Runningnpm citakes about 6 minutes on Windows and blocks most of the compile, while the Vite output is the same on every OS. Thefrontendjob runs the Site project's own MSBuild target, so the assets carry the same MinVer version as the .NET build. Everybuildjob now waits forfrontend, which takes about 1.5 minutes. Thenpmjob keeps its lint, format, typecheck and Vitest steps, but no longer runs its own Vite build.On a PR, the Windows and macOS
buildjobs still compile, but they skip the unit tests unless the PR changes .NET code, build inputs, or anything undertests/orbuild/. Linux runs the unit tests on every PR, and pushes tomainrun them on all three OSes. A PR that changes only docs, frontend assets, orconfig/no longer waits about 8 minutes for Windows tests.Test projects can run in parallel
A local
./build.sh unit-testruns one test project per CPU core at a time. A new--test-parallelismflag 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 inElastic.Changelog.Teststime 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, theTeststep passes--single-target, so it no longer recompiles the solution that theCompilestep 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. Themaincaches stay under the size limit, and PR jobs skip the upload step that runs after the job. Theassembler-previewanddocs-preview-localworkflows now setNUGET_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
maininstead of on the PR.Verify
🤖 Generated with Claude Code