ci: move sonarcloud.yml tests + build to ubuntu-latest - #1139
Conversation
The `test-net10-sharded` job chain was pinned to windows-latest and gated
behind `build-windows`, so every Diffusion / NeuralNetworks / Unit shard on
every PR waited for a Windows build to finish before it could start. Since
these tests run net10.0 (fully cross-platform) and the only Windows-specific
concern is net471 cross-compilation — which the modern .NET SDK handles via
its auto-included reference assembly pack — there's no reason to keep them
on windows runners. Linux runners also start faster, cost less, and parallel
better.
Changes:
- `build` job (formerly `build-windows`): `runs-on: ubuntu-latest`. Keeps
multi-target net10.0+net471 `dotnet build`. Drops the Windows-only MSBuild
flags `-p:UseSharedCompilation=false -p:nodeReuse=false` (file-locking
workarounds that don't apply on Linux) and the `dotnet build-server
shutdown` step that existed for the same reason.
- `test-net10-sharded`: `runs-on: ubuntu-latest`, `needs: build`.
- `sonarcloud`: `runs-on: ubuntu-latest`, `needs: [build, test-net10-sharded]`.
Same `dotnet-sonarscanner` tool works cross-platform.
- `size-check`: `needs: build` (was `needs: build-windows`).
- All `shell: powershell` steps switched to `shell: pwsh`. PowerShell Core
is pre-installed on ubuntu-latest runners and runs the existing
`.github/scripts/report-slow-tests.ps1` and inline scripts without
modification.
- Windows-style `\scanner` paths converted to `/scanner` forward-slash paths;
the `& "${{ runner.temp }}/scanner/dotnet-sonarscanner" end` invocation is
wrapped in `&` to tolerate paths with spaces under pwsh.
- Stale top-level and in-line comments updated to reflect ubuntu-based CI.
Gains: cancelled test shards no longer queue behind a slow Windows build;
ubuntu runners are typically ~30% faster and free up the Windows queue for
the few jobs that actually need it. Combined with the lazy-init fixes in
PR #1137 and PR #1138, this should clear the 45-minute wall-clock
cancellations on the Diffusion / NeuralNetworks / Unit-03 / Unit-08e shards.
Refs #1136
|
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
WalkthroughThe CI workflow migrates the primary build and downstream jobs from Windows ( Changes
Sequence Diagram(s)sequenceDiagram
participant Actions as GitHub Actions (ubuntu-latest)
participant Dotnet as dotnet CLI
participant Tests as Test Runner (pwsh)
participant Sonar as SonarCloud Scanner
participant Cache as Actions Cache
Actions->>Dotnet: restore & build (POSIX paths, no Windows flags)
Dotnet-->>Actions: build artifacts
Actions->>Tests: run sharded tests (pwsh), produce reports
Tests-->>Actions: test results & artifacts
Actions->>Sonar: run dotnet-sonarscanner (POSIX temp/scanner path)
Sonar->>Cache: read/write sonar cache (~/sonar/cache)
Sonar-->>Actions: analysis report
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/workflows/sonarcloud.yml:
- Around line 549-552: The comment in the SonarCloud workflow incorrectly states
that .NET Framework reference assemblies are "auto-included by the SDK on
Linux"; update that comment block to accurately describe the real mechanism used
for cross-compilation (for example mention that cross-compilation relies on the
Microsoft.NETFramework.ReferenceAssemblies NuGet package or whatever specific
approach your build uses), and replace the misleading sentence in the comment
section (the three-line block referencing net471 tests and auto-included
reference assembly pack) with a precise note that references the actual package
or method enabling reference assemblies for net471 on Linux.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 374b0788-e6e0-45c9-abb6-f804278ad0bf
📒 Files selected for processing (1)
.github/workflows/sonarcloud.yml
There was a problem hiding this comment.
Pull request overview
This PR updates the repo’s primary CI workflow (sonarcloud.yml) to run the build/test/SonarCloud chain on ubuntu-latest instead of being gated behind a Windows build, aiming to reduce queue wait and overall shard wall-clock time.
Changes:
- Renames the Windows-gated build job (
build-windows) tobuildand moves it toubuntu-latest. - Moves
test-net10-shardedandsonarcloudjobs toubuntu-latestand updatesneeds:dependencies accordingly. - Switches workflow scripting from
powershellto cross-platformpwshand normalizes Windows path separators to POSIX-style paths for the Sonar scanner.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
… comment SonarCloud cache path: change ~/sonar/cache to ~/.sonar/cache to match the default dotnet-sonarscanner cache location. Without this the cache action was writing/reading the wrong directory and every analysis run re-downloaded the SonarScanner cache from scratch. Reference assembly comment: replace "auto-included reference assembly pack" with the accurate mechanism — the Microsoft.NETFramework.ReferenceAssemblies NuGet package that provides the .NET Framework targeting pack on Linux runners. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
♻️ Duplicate comments (1)
.github/workflows/sonarcloud.yml (1)
4-5:⚠️ Potential issue | 🟡 MinorFix stale net471 cross-compilation comments ("auto-included reference assembly pack").
Line 4 and Line 134 still describe an SDK “auto-included” mechanism, which is misleading and inconsistent with the accurate note at Line 550-552. Please align both comments to the actual mechanism used in-repo.
Suggested comment-only patch
-# Runs on ubuntu-latest; net471 targets cross-compile via the modern .NET SDK's -# auto-included reference assembly pack (no Windows runner required). +# Runs on ubuntu-latest; net471 targets cross-compile via +# Microsoft.NETFramework.ReferenceAssemblies (no Windows runner required). ... - # aren't needed on Linux. net471 cross-compiles on Linux via the modern SDK's - # auto-included reference assembly pack. + # aren't needed on Linux. net471 cross-compiles on Linux via + # Microsoft.NETFramework.ReferenceAssemblies.#!/bin/bash set -euo pipefail # Verify workflow comment consistency around net471/Linux reference assemblies rg -n "auto-included reference assembly pack|Microsoft\.NETFramework\.ReferenceAssemblies|net471.*Linux" .github/workflows/sonarcloud.yml # Verify whether the package is explicitly declared in central package management or project files rg -n "Microsoft\.NETFramework\.ReferenceAssemblies" --iglob "Directory.Packages.props" --iglob "*.csproj"Also applies to: 132-135
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/sonarcloud.yml around lines 4 - 5, Update the stale comment text about net471 cross-compilation to accurately describe the repository's actual mechanism: replace mentions of "auto-included reference assembly pack" with a note that the Linux build uses explicit Microsoft.NETFramework.ReferenceAssemblies (or the repo's declared package) for .NET Framework reference assemblies, and make the same edit for the other occurrence around the net471/Linux comment; search for the strings "auto-included reference assembly pack", "Microsoft.NETFramework.ReferenceAssemblies", and "net471" in .github/workflows/sonarcloud.yml and change the lines that reference the outdated mechanism so they consistently state that reference assemblies are provided via the explicit package declared in central package management/project files rather than automatically by the SDK.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Duplicate comments:
In @.github/workflows/sonarcloud.yml:
- Around line 4-5: Update the stale comment text about net471 cross-compilation
to accurately describe the repository's actual mechanism: replace mentions of
"auto-included reference assembly pack" with a note that the Linux build uses
explicit Microsoft.NETFramework.ReferenceAssemblies (or the repo's declared
package) for .NET Framework reference assemblies, and make the same edit for the
other occurrence around the net471/Linux comment; search for the strings
"auto-included reference assembly pack",
"Microsoft.NETFramework.ReferenceAssemblies", and "net471" in
.github/workflows/sonarcloud.yml and change the lines that reference the
outdated mechanism so they consistently state that reference assemblies are
provided via the explicit package declared in central package management/project
files rather than automatically by the SDK.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: fce13679-b094-4e5a-8b48-8d0a193df9c6
📒 Files selected for processing (1)
.github/workflows/sonarcloud.yml
Summary
The
test-net10-shardedjob chain in.github/workflows/sonarcloud.ymlwas pinned towindows-latestand gated behind abuild-windowsjob. Every ModelFamily / Unit shard on every PR waited for a Windows build to finish before it could start — and those shards were hitting the 45-min wall clock partly because of that queue wait.Those tests run
net10.0which is fully cross-platform. The only Windows-specific concern isnet471cross-compilation, and the modern .NET SDK handles that on Linux via its auto-included reference assembly pack. Linux runners are also faster and cheaper.This PR moves the whole build+test+sonarscan chain to
ubuntu-latest.Changes
build(formerlybuild-windows):runs-on: ubuntu-latest. Keeps multi-targetnet10.0;net471build.-p:UseSharedCompilation=false -p:nodeReuse=falseand thedotnet build-server shutdownstep — they existed to work around MSBuild file-locking on Windows and aren't needed on Linux.test-net10-sharded:runs-on: ubuntu-latest,needs: build.sonarcloud:runs-on: ubuntu-latest,needs: [build, test-net10-sharded].dotnet-sonarscanneris cross-platform.size-check:needs: build(wasneeds: build-windows).shell: powershell→shell: pwsh. PowerShell Core is pre-installed on ubuntu runners and runs the existing.github/scripts/report-slow-tests.ps1plus inline scripts without modification.\scannerpaths →/scannerforward slashes; the scanner invocation is wrapped with&to tolerate spaced paths under pwsh.Independent of code fixes
This PR only touches
.github/workflows/sonarcloud.yml. It stacks naturally with the two open perf PRs for the CI unblock:Combined, the lazy-init code changes cut peak memory and this workflow change cuts queue-wait. Expected outcome: the cancelled shards on the Diffusion / NeuralNetworks / Unit-03 / Unit-08e jobs start sooner and finish within budget.
Verification
pwshrename.Microsoft.NETFramework.ReferenceAssembliesexplicitly toDirectory.Packages.propsas a follow-up. Modern SDK should pull it in transitively.Refs #1136
Summary by CodeRabbit