Skip to content

ci: move sonarcloud.yml tests + build to ubuntu-latest - #1139

Merged
ooples merged 2 commits into
masterfrom
ci/tests-on-ubuntu
Apr 16, 2026
Merged

ooples merged 2 commits into
masterfrom
ci/tests-on-ubuntu

Conversation

@ooples

@ooples ooples commented Apr 14, 2026 •

Copy link
Copy Markdown
Owner

Summary

The test-net10-sharded job chain in .github/workflows/sonarcloud.yml was pinned to windows-latest and gated behind a build-windows job. 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.0 which is fully cross-platform. The only Windows-specific concern is net471 cross-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 (formerly build-windows): runs-on: ubuntu-latest. Keeps multi-target net10.0;net471 build.
    • Drops -p:UseSharedCompilation=false -p:nodeReuse=false and the dotnet build-server shutdown step — 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-sonarscanner is cross-platform.
  • size-check: needs: build (was needs: build-windows).
  • All shell: powershell → shell: pwsh. PowerShell Core is pre-installed on ubuntu runners and runs the existing .github/scripts/report-slow-tests.ps1 plus inline scripts without modification.
  • Windows-style \scanner paths → /scanner forward slashes; the scanner invocation is wrapped with & to tolerate spaced paths under pwsh.
  • Stale comments updated.

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

  • Workflow YAML structure unchanged beyond the runner swap and pwsh rename.
  • Once this merges, any open PR's next CI run exercises the new config.
  • If net471 cross-compile has any rough edges on Linux, we can add Microsoft.NETFramework.ReferenceAssemblies explicitly to Directory.Packages.props as a follow-up. Modern SDK should pull it in transitively.

Refs #1136

Summary by CodeRabbit

  • Chores
    • CI updated to use Linux-based runners and simplified build workflow.
    • Test execution and analysis tooling migrated to Linux shells; path handling normalized for POSIX environments.

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
Copilot AI review requested due to automatic review settings April 14, 2026 15:29
@vercel

vercel Bot commented Apr 14, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Actions Updated (UTC)
aidotnet_website Ignored Ignored Preview Apr 14, 2026 5:39pm
aidotnet-playground-api Ignored Ignored Preview Apr 14, 2026 5:39pm

@coderabbitai

coderabbitai Bot commented Apr 14, 2026 •

Copy link
Copy Markdown
Contributor

Walkthrough

The CI workflow migrates the primary build and downstream jobs from Windows (windows-latest, PowerShell) to Ubuntu (ubuntu-latest, pwsh), removes Windows-specific MSBuild steps/flags, and converts SonarCloud scanner/cache paths and shells to POSIX form.

Changes

Cohort / File(s) Summary
SonarCloud workflow
.github/workflows/sonarcloud.yml
Replaced Windows build-windows job with build on ubuntu-latest; updated downstream job dependencies (test-net10-sharded, sonarcloud, size-check) to depend on build; removed dotnet build-server shutdown and MSBuild flags -p:UseSharedCompilation=false, -p:nodeReuse=false; switched shells from powershell to pwsh; converted scanner/cache and temp paths from Windows backslashes to POSIX forward slashes (~\sonar\cache → ~/sonar/cache, ${{ runner.temp }}\scanner\... → ${{ runner.temp }}/scanner/...).

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
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Poem

🐧 Runners swapped boots, Ubuntu takes the stage,
Paths turned forward, cleaner on each page,
pwsh whispers where PowerShell once sang,
Sonar scans hum a POSIX refrain,
CI flows smoother — a small pipeline fandango.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'ci: move sonarcloud.yml tests + build to ubuntu-latest' accurately and concisely describes the main change—migrating CI jobs from Windows to Ubuntu runners in the SonarCloud workflow.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ci/tests-on-ubuntu

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 72f425a and c85c45b.

📒 Files selected for processing (1)
  • .github/workflows/sonarcloud.yml

Comment thread .github/workflows/sonarcloud.yml Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) to build and moves it to ubuntu-latest.
  • Moves test-net10-sharded and sonarcloud jobs to ubuntu-latest and updates needs: dependencies accordingly.
  • Switches workflow scripting from powershell to cross-platform pwsh and 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 thread .github/workflows/sonarcloud.yml Outdated
… 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>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

♻️ Duplicate comments (1)
.github/workflows/sonarcloud.yml (1)

4-5: ⚠️ Potential issue | 🟡 Minor

Fix 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

📥 Commits

Reviewing files that changed from the base of the PR and between c85c45b and 482989d.

📒 Files selected for processing (1)
  • .github/workflows/sonarcloud.yml

@ooples
ooples merged commit 3bf1088 into master Apr 16, 2026
25 of 45 checks passed
@ooples
ooples deleted the ci/tests-on-ubuntu branch April 16, 2026 12:12
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.

3 participants