Skip to content

ci: install only the workloads each job needs - #5784

Closed
ric-oliv wants to merge 3 commits into
mainfrom
ci/restore-workloads-per-leg
Closed

ric-oliv wants to merge 3 commits into
mainfrom
ci/restore-workloads-per-leg

Conversation

@ric-oliv

@ric-oliv ric-oliv commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

Setup Environment runs dotnet workload restore without a project, so it evaluates every project in Sentry.slnx, whatever the leg builds. From the logs of run 39858273561:

  • The three Linux legs without mobile targets install android, maui-android, maui-tizen, macos, wasm-tools and wasm-tools-net9, which takes 83 to 113 seconds.
  • Windows installs ios, maccatalyst and macos, but it only builds Android and Windows targets.
  • Every leg installs maui-tizen, which nothing targets, and macos, which only Sentry.Samples.MacOS needs.
  • Every leg restores the Android test app, which only the macOS and linux-x64 filters need, because they include Sentry.Android.AssemblyReader.Tests.

This PR scopes the step to what the leg builds:

  • build-sentry passes its solution filter to Setup Environment, and the step restores the workloads for the projects in it. dotnet workload restore rejects a solution filter with "Couldn't find a project", so the step passes the filter's projects instead. I checked locally that this installs only what those projects need. If it finds no projects in the filter, the step stops with an error that names the filter.
  • The Android test app restore runs only when the filter includes the tests that build it.
  • The legs without mobile targets skip Java and the Android SDK.
  • Every other job that uses Setup Environment passes what it builds too. More on that below.

This PR leaves Mono alone, and #5794 removes it. The MAUI integration test restores its own workloads in CI, so it isn't affected.

Measured on two runs of this PR, against the median of 7 main runs from October 22 and 23:

Setup Environment main Run 1 Run 2
macOS 3.1 min 2.6 2.6
win-x64 5.4 3.3 4.3
win-arm64 8.7 6.5 4.8
linux-x64 3.4 2.7 2.8
linux-arm64 3.4 2.0 1.9
linux-musl-x64 2.8 1.1 1.8
linux-musl-arm64 3.0 1.2 1.4

This overlaps #5782 on Windows, which changes where .NET is installed, and both skip the Android test app there. I'm keeping them apart so we can see what each one is worth, and I'll resolve the conflict when the second one merges.

Every job now restores only what it builds

The environment action now requires projects, the solution filters or project files the job builds, separated by spaces. Jobs that build everything pass Sentry.slnx, and a job that passes nothing fails with an error that says what to pass. That way every workflow follows the same rule, instead of only the build legs.

  • CodeQL, format-code and verify-api no longer run a second, unfiltered dotnet workload restore after the action.
  • The Playwright job restores only its test project's workloads.
  • dotnet workload restore doesn't see the Android test app, because Sentry.Android.AssemblyReader.Tests builds it with an MSBuild task rather than a project reference. The action still adds it for Sentry.slnx, and for jobs that pass those tests or the app.

On top of the other CI changes, Setup Environment went from about 190 to 89 seconds in the trim job and from 170-180 to 71-78 in the Android device test build.

#skip-changelog

@codecov

codecov Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.12%. Comparing base (ff0355e) to head (6a78073).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5784      +/-   ##
==========================================
- Coverage   76.13%   76.12%   -0.02%     
==========================================
  Files         528      528              
  Lines       19579    19579              
  Branches     3829     3829              
==========================================
- Hits        14906    14904       -2     
- Misses       3791     3792       +1     
- Partials      882      883       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Setup Environment runs dotnet workload restore without a project, so it
evaluates every project in Sentry.slnx on every leg. The three Linux legs
without mobile targets install android, maui-android, maui-tizen, macos,
wasm-tools and wasm-tools-net9. Windows installs ios, maccatalyst and macos.
Every leg installs maui-tizen, which nothing targets, and macos, which only
the macOS sample needs.

The build legs now pass their solution filter, and the step restores the
workloads for the projects in it. dotnet workload restore doesn't accept a
solution filter, so the step passes its projects. The Android test app is
restored only when the filter includes the tests that build it, and the legs
without mobile targets skip Java and the Android SDK.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The step reads the project paths out of the solution filter. If that
found none, grep's exit code already failed the step, but without a
message. It now names the filter it couldn't read.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The environment action now requires the solution filters or project files the job builds, and installs only their workloads. Jobs that build everything pass Sentry.slnx. Before, every job without a filter restored the workloads for all of Sentry.slnx, and CodeQL, format-code and verify-api ran a second, unfiltered workload restore after the action. The Playwright job restores the workloads of its test project only.

Measured on top of the other CI changes, Setup Environment went from about 190 to 89 seconds in the trim job and from 170-180 to 71-78 in the Android device test build.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ric-oliv ric-oliv changed the title ci: install only the workloads each build leg needs ci: install only the workloads each job needs Oct 25, 2026
@ric-oliv

Copy link
Copy Markdown
Member Author

I'm continuing this in #5807, part 1 of 6 in #5806, so the CI changes can be reviewed in a few steps instead of 13 PRs. The measurements here stay as the record.

@ric-oliv ric-oliv closed this Oct 25, 2026
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