Skip to content

Run PR CI per affected sample, in parallel - #2298

Draft
David Pine (IEvangelist) wants to merge 6 commits into
mainfrom
ievangelist-optimize-pr-ci
Draft

David Pine (IEvangelist) wants to merge 6 commits into
mainfrom
ievangelist-optimize-pr-ci

Conversation

@IEvangelist

@IEvangelist David Pine (IEvangelist) commented Dec 6, 2026 •

Copy link
Copy Markdown
Member

PR CI used to run every sample serially in one Ubuntu job. The last 15 green PR runs had a median of 23.9 min (20.4 to 31.9), and the integration tests alone took about 18.7 min because every AppHost ran one after another.

This PR plans the run from the PR diff and gives each affected sample its own job. It also upgrades the samples to .NET 11.

CI

  • build/ci-plan.ps1 maps changed paths to samples:
    • A change inside one sample runs only that sample.
    • Doc-only changes run nothing.
    • Changes under tests/ run every sample, Linux only.
    • Shared inputs (ci.yml, build/, samples/Directory.Build.props, nuget.config, unknown paths) run everything.
    • Pushes, scheduled runs, and manual runs validate everything. The new samples input narrows a manual run.
  • Each sample gets a Linux (<sample>) job and a Windows (<sample>) job. Each installs only what that sample needs:
    • Functions Core Tools only for the Functions sample.
    • .NET 10 only for TypeScript AppHosts, because the Aspire 17 CLI builds their integrations for net10.0.
    • Go, Java and Node only where they're used.
  • Build.proj and SamplesIntegrationTests.csproj take -p:SampleName=<dir>. Without it they behave as before, so the internal pipeline is unchanged. Tests are scoped with a vstest filter on the AppHost name, plus AppHost/Category traits on facts that aren't parameterized by AppHost.
  • AppHostRunsCleanly now only covers AppHosts without endpoint tests. TestEndpointsReturnOk already starts, waits for, and stops the same app, so every AppHost with endpoint tests was booting twice.
  • Linux jobs pre-pull the sample's container images (from its committed manifests) in the background while it builds. They use the runner's Docker instead of installing the latest version.
  • Maven tests run on Linux only, since they're platform-neutral.
  • Binlogs are uploaded only on failure.
  • CI Gate is still the single required check. It requires plan to succeed and accepts skipped sample jobs.

Issues that isolating samples exposed

  • A sample's solution and its file-based apps share projects such as ServiceDefaults, and building them in parallel raced. They now build sequentially within a sample.
  • File-based AppHosts resolved packages with platform-specific assets (Microsoft.Data.SqlClient) to the platform-neutral stub. It only worked before because another sample's AppHost project put the real one in the test's deps. AppHostAssemblyLoader now loads the asset each AppHost's own deps.json selects.

.NET 11

  • Every project and file-based app targets net11.0.
  • .NET-band packages (ASP.NET Core, EF Core, Npgsql EF, Microsoft.Extensions) are on 11.x, and Microsoft.OpenApi is on 3.x, which ASP.NET Core OpenApi 11 needs.
  • Azure Functions moved to Azure.Functions.Sdk, because the Worker SDK rejects net11.0. The two remaining net10.0-windows projects were also retargeted.
  • READMEs and the devcontainer were updated. Orleans stays on 10.4.2 because there's no 11.x.

Plan the run from the PR diff (build/ci-plan.ps1) and validate each affected sample in its own Linux and Windows job, installing only the toolchains that sample needs. Documentation-only changes validate nothing; shared inputs validate every sample. Build.proj and the integration test project accept -p:SampleName to scope to one sample.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
- Skip AppHostRunsCleanly for AppHosts with endpoint tests; TestEndpointsReturnOk already starts, waits for and stops them.
- Pre-pull each sample's container images from its committed manifests while it builds.
- Use the runner's Docker instead of installing the latest version.
- Validate Java only on Linux; Maven tests are platform-neutral.
- Build a single sample's solution and file-based apps sequentially, since they share projects such as ServiceDefaults.
- Resolve file-based AppHost dependencies from their own deps.json, instead of relying on other samples' AppHost projects.
- Install .NET 10 only for samples with TypeScript AppHosts.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Retarget every project and file-based app to net11.0, and bump .NET-band packages (ASP.NET Core, EF Core, Npgsql EF, Microsoft.Extensions) to their 11.x releases. Microsoft.OpenApi moves to 3.x, which ASP.NET Core OpenApi 11 requires. Azure Functions moves to Azure.Functions.Sdk, because Microsoft.Azure.Functions.Worker.Sdk rejects net11.0. Also update READMEs and the devcontainer image.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The test host resolves file-based AppHost dependencies from the output directory, which for packages like Microsoft.Data.SqlClient is the platform-neutral stub. Preload the asset each AppHost's deps.json selects.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@IEvangelist

Copy link
Copy Markdown
Member Author

Timings from actual runs on this branch, against a 23.9 min median for the last 15 green PR runs:

Scenario Run Wall clock Speedup
Every sample (this PR, since it touches ci.yml), 59 jobs 47593726028 4.1 min 5.8x
One sample, aspire-shop (heaviest integration tests) 47594125398 2.6 min 9.2x
One sample, volume-mount 47594134874 2.4 min of jobs (5.0 min wall, 151s of that was waiting for a runner) ~10x
Docs-only change n/a plan + gate, about 20s ~70x

Most PRs here touch a single sample, so they land in the second or third row.

Before this, the integration tests were 18.7 min of a single serial job. The slowest job now is about 3.5 min (Windows maildev-mailkit), and the whole run is bounded by that rather than by the sum of every sample.

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