Skip to content

Run CI test projects in parallel again with isolated concurrency tests - #4604

Merged
akira28 merged 12 commits into
mainfrom
feature/harden-changelog-concurrency-tests
Oct 27, 2026
Merged

akira28 merged 12 commits into
mainfrom
feature/harden-changelog-concurrency-tests

Conversation

@akira28

@akira28 akira28 commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Two concurrency tests in Elastic.Changelog.Tests now run on their own, and one uses dedicated threads. With that, CI runs test projects in parallel again, which saves about 70s on Linux and 80s on Windows in the Test step.

Affects: Automation

Prompt summary: Make the changelog tests that timed out under parallel CI runs independent of the thread pool, so CI can run test projects in parallel again.

Why

When #4601 ran test projects in parallel, two tests failed on the Windows and macOS runners and passed on Linux. Both wait for background work with a fixed deadline, and that work needs a free thread-pool thread. On a 3-4 core runner, other tests in the same process block pool threads, and the background work starts too late. #4601 worked around this by running CI test projects one at a time.

What

The DecisionLog dispose test no longer uses the thread pool

Dispose_AnotherThreadIsStillLogging_WaitsForItToFinish blocks a thread inside its logger on purpose. Its recording and disposing work now runs on dedicated threads (TaskCreationOptions.LongRunning), so a starved pool can't delay it. It also runs on its own, without other tests.

The WaitForDrain test runs on its own

In WaitForDrain_AfterStartAsync_WaitsForReaderEvenIfNotStartedYet, the product code starts the background reader on the thread pool. The reader must come up within the 2s deadline in WaitForDrain. The test now runs on its own ([NotInParallel] without a key), so no other test in the process can hold pool threads while it waits. The product code is unchanged.

CI runs test projects in parallel again

The Test step drops --test-parallelism=1, so CI runs as many test projects at once as the runner has cores.

Risk: I can't reproduce the original failures locally, even with every core saturated and a 3-core thread pool. Only repeated CI runs on Windows and macOS show whether this is enough. If they still fail, add --test-parallelism=1 back to the Test step in ci.yml.

Verify

dotnet test tests/Elastic.Changelog.Tests/ -c release
# DecisionLogTests.Dispose_AnotherThreadIsStillLogging_WaitsForItToFinish
# DiagnosticsCollectorDisposeTests.WaitForDrain_AfterStartAsync_WaitsForReaderEvenIfNotStartedYet

🤖 Generated with Claude Code

akira28 and others added 11 commits October 27, 2026 12:38
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]>
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]>
…allel

Two concurrency tests wait for background work with a fixed deadline. On
busy 3-4 core runners, other tests blocking pool threads delayed that
work past the deadline. Both now run alone, and the DecisionLog test uses
dedicated threads, so CI can run test projects in parallel again.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@akira28
akira28 requested a review from a team as a code owner October 27, 2026 14:31
@akira28 akira28 added the automation packaging, ci/cd. label Oct 27, 2026
@akira28
akira28 requested a review from bmorelli25 October 27, 2026 14:31
Base automatically changed from feature/reduce-duration-pr-ci to main October 27, 2026 14:47
…log-concurrency-tests

# Conflicts:
#	.github/workflows/ci.yml
@github-actions

Copy link
Copy Markdown
Contributor

@akira28
akira28 merged commit c01c553 into main Oct 27, 2026
35 checks passed
@akira28
akira28 deleted the feature/harden-changelog-concurrency-tests branch October 27, 2026 15:44
Mpdreamz added a commit that referenced this pull request Nov 11, 2026
Sequential projects take 22 seconds on this machine and four at a time take 7 to 8, and #4604 put CI back on the parallel run. `concurrentlyAtMost` replaces the hand-written process pool and keeps the per-project `::group::` output and the report of every failure.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Mpdreamz added a commit that referenced this pull request Nov 11, 2026
* Move the F# build to Nullean.Make.Fs and Proc.Fs shell blocks

Argu and Bullseye go away: one `Target` union now holds the targets, their help text and their dependencies, and each target body is a `shell { }` block. Test projects still run with buffered output through `concurrentlyAtMost`.

Command names are kebab-case now (`publish-containers`, `publish-zip`, `run-local-container`), and `--test-parallelism=4` is `--parallelism 4`. The callers in `ci.yml`, `release.yml`, `prerelease.yml` and the docs use the new names. `FSharp.Core` moves to 11.0.101 because Make.Fs needs it.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* Reject an unknown --suite value before the build starts

Make.Fs hands the option over only after the Compile dependency has run, so a typo such as `--suite unti` used to build the whole solution before it failed. The entry point now checks the value first and exits with code 2, as Argu did.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* Run test projects one after the other and type the test suite

TUnit already runs the tests of one project in parallel, so the buffered pool of projects goes, along with `--parallelism`. `--suite` is now a `TestSuite` enum instead of a string.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* Check the --suite value against the TestSuite enum

The fast-fail check listed the values by hand; it now parses them as `TestSuite`, so the enum stays the only list.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* Reject numeric and list values for --suite

Enum.TryParse accepts "7" and "unit,integration", so those slipped past the fail-fast check and ran every suite. The check now requires a declared name, and testProjects matches All explicitly and fails on any other value.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* Drop the Fake packages from the build

The build used Fake for a version type, one `git` call, an environment lookup, a folder clean and a zip. Each is a few lines of `Proc.Fs` or the framework now, so `Fake.Tools.Git` and `Fake.IO.Zip` go.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* Accept only declared names for --suite

`Enum.TryParse` takes `1` as `Unit` and passes `IsDefined`, so the number slipped through. The check compares with `Enum.GetNames` instead.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* Run test projects concurrently again with --test-parallelism

Sequential projects take 22 seconds on this machine and four at a time take 7 to 8, and #4604 put CI back on the parallel run. `concurrentlyAtMost` replaces the hand-written process pool and keeps the per-project `::group::` output and the report of every failure.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* Run the tests as one dotnet test call over a generated solution filter

`dotnet test --solution` with the Microsoft.Testing.Platform runner runs the test modules in parallel and prints one summary, so the hand-written project loop goes. The filter is generated in `.artifacts/tests.slnf` from the same directory scan, so there is no file to keep in step with the solution.

`--parallelism` belongs to `test`, `unit-test` and `integrate` only, and CI ignores it and runs one module at a time.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

---------

Co-authored-by: Claude Sonnet 5.5 <[email protected]>
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