Skip to content

Optimize CI by categorizing tests and parallelizing builds - #5718

Closed
johnsimons wants to merge 9 commits into
masterfrom
john/build_once
Closed

Optimize CI by categorizing tests and parallelizing builds#5718
johnsimons wants to merge 9 commits into
masterfrom
john/build_once

Conversation

@johnsimons

Copy link
Copy Markdown
Member

This refactors the CI workflow to improve efficiency and reduce execution time.

Test projects are now assigned TestCategory properties, enabling matrix jobs to dynamically select, build, and run only the relevant projects for their category. This significantly reduces build times and resource consumption.

A new compile job ensures the entire src directory remains buildable. The build step for test jobs is now backgrounded to overlap with infrastructure setup, further improving parallelization.

Also corrects inconsistent PostgreSQL casing to PostgreSql in the workflow.

This refactors the CI workflow to improve efficiency and reduce execution time.

Test projects are now assigned `TestCategory` properties, enabling matrix jobs to dynamically select, build, and run only the relevant projects for their category. This significantly reduces build times and resource consumption.

A new `compile` job ensures the entire `src` directory remains buildable. The build step for test jobs is now backgrounded to overlap with infrastructure setup, further improving parallelization.

Also corrects inconsistent `PostgreSQL` casing to `PostgreSql` in the workflow.
Refines the CI workflow by breaking down the broad `Default` and `RabbitMQ` test categories into more granular ones. This addresses instances where these categories were running several slow assemblies in a single job.

- `Default` is split into `DefaultCore`, `DefaultAudit`, and `DefaultMonitoring`.
- `RabbitMQ` is split into `RabbitMQClassicConventional`, `RabbitMQClassicDirect`, `RabbitMQQuorumConventional`, and `RabbitMQQuorumDirect`.

This change enables finer-grained parallelization of tests in the CI workflow, which reduces overall execution time and improves efficiency. It also standardizes test category declarations across projects using the `<TestCategory>` property and `IncludeInTestCategory` attribute, and updates CI conditions accordingly.
This change introduces new composite GitHub Actions to set up RabbitMQ and IBM MQ in containers.

It enables IBM MQ to run on Windows runners by utilizing Docker within WSL2. The RabbitMQ setup is also updated to use a local container action, replacing the external `Particular/setup-rabbitmq-action` and ensuring consistent container-based provisioning across Linux and Windows via WSL2.

As a result, these services no longer require Azure authentication in the CI workflow.
The `ServiceControl.MultiInstance.AcceptanceTests` now explicitly creates both the primary and audit event sources on Windows.

This ensures the necessary EventLog sources are available for the tests. Previously, the audit event source was implicitly created by other acceptance tests, which is no longer guaranteed due to CI changes like parallelization.
Notifications settings are rarely read and primarily edited by hand. Aggressive caching, which invalidates asynchronously via the Changes API, could lead to stale reads immediately following a save. This change ensures the latest settings are always retrieved, preventing potential consistency issues.
Improves the reliability of GitHub Actions for IBM MQ and RabbitMQ.

IBM MQ's health check now directly probes the listener port, as Docker's internal check was insufficient for detecting connectivity issues, especially on Windows/WSL.

RabbitMQ setup is made more robust by automatically restarting the container once if it hangs during boot within 90 seconds.

Additionally, WSL memory allocation is increased to 8GB to provide more headroom and prevent resource-related failures during concurrent builds.
Introduces a dedicated `compile` job that builds the entire solution on Linux and caches the resulting binaries. Subsequent test jobs now restore NuGet packages and download these pre-compiled artifacts instead of rebuilding. This significantly reduces redundant compilation across the test matrix, improving overall CI efficiency. The RavenDB server download is also centralized to this `compile` job.
@johnsimons johnsimons self-assigned this Aug 8, 2026
The custom local `setup-rabbitmq` action is replaced by the official `Particular/setup-rabbitmq-action@v2.0.0`. This change signifies that the external action now provides the necessary WSL2 support for Windows runners, simplifying maintenance and leveraging upstream improvements.

The RavenDB server cache key is refined to use the explicit `RavenDB.Embedded` package version and the hash of the download script. This ensures the cache is invalidated only when relevant changes occur, reducing unnecessary re-downloads and improving CI performance.

Additionally, the `Particular/setup-wsl-action` is updated to v1.1.0.
Enables `enableCrossOsArchive` for the build output cache. This is crucial for Windows test jobs to successfully restore the cache, which is initially created on Linux. Without this setting, the cache archive is platform-specific, leading to consistent misses on Windows.

Additionally, refactors the PowerShell script responsible for reporting build output size. The previous `Get-ChildItem -Path src/*/bin -Recurse` command did not correctly resolve the `bin` directories due to how PowerShell handles wildcards within the path argument, treating the leaf `bin` as a filter during recursion. The updated script explicitly resolves the `bin` directories first, ensuring accurate reporting and inclusion in the cache.
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.

1 participant