Skip to content

ci: run only OS-specific work on Windows and macOS pull request jobs - #7582

Merged
thomhurst merged 1 commit into
mainfrom
ci/os-specific-only
Nov 4, 2026
Merged

thomhurst merged 1 commit into
mainfrom
ci/os-specific-only

Conversation

@thomhurst

@thomhurst thomhurst commented Nov 4, 2026 •

Copy link
Copy Markdown
Owner

Ubuntu runs every test suite on every pull request, so Windows and macOS only need to cover what can behave differently on their OS. They were still building the whole CI solution and, on Windows, running every platform-neutral suite again on net10.0. macOS runners are the scarcest: on #7580 the macOS job waited 65 minutes for a runner.

Changes

  • --os-specific-only pipeline switch (PipelineScope). Windows and macOS pull request jobs pass it:
    • Windows runs PlatformNeutral suites only on their .NET Framework TFMs. That keeps the .Net4_7 source-generator, assertions-generator and public-API snapshots, which only Windows can produce, and drops the net10.0 runs Ubuntu already does.
    • macOS skips PlatformNeutral outright. This replaces the category ignore added in ci: run one general macOS job per pull request push #7578.
    • Template tests (no net472 variant) are left to Ubuntu.
  • Narrower build on those jobs. A new Select projects step writes a solution filter that leaves out the projects of suites the job won't run. That includes the Linux-only Aspire/ASP.NET example modules, examples/ and benchmarks/. macOS builds 59 of the 87 projects. The list names what to exclude, so a new project still builds everywhere until someone adds it. Project references still build what an included project needs.
  • Manual (workflow_dispatch) runs, which publish, are unchanged: every suite runs on every OS.

Still on Windows/macOS: unit tests, ASP.NET Core, OpenTelemetry, Playwright and RPC tests, engine tests (aot.yml, plus macOS in this job), AOT and the Windows package tests.

Trade-off: OS-specific quirks inside platform-neutral suites, such as CRLF handling in code fixers on Windows, now surface on Ubuntu runs only. The net472 generator snapshots still run on Windows.

Validation

  • TUnit.Pipeline builds; --help lists the new option.
  • Generated the macOS filter locally and ran dotnet restore + dotnet build -c Release -graphBuild:True on it: 0 errors.
  • This PR's own CI run exercises both new paths. Compare the Windows/macOS job durations against Expect source operators to bind in AOT in the tuple conversion matrix #7580's run (Windows 16.5 min, macOS 16 min).

Summary by CodeRabbit

  • New Features
    • Added an option to run an OS-specific subset of pipeline checks. In this mode, Windows runs platform-neutral suites only on .NET Framework targets, while macOS skips those suites and template tests.
  • Documentation
    • Clarified how platform-neutral suites are handled across Ubuntu, Windows, and macOS pull-request runs.

Ubuntu runs every suite, so the Windows and macOS pipelines on pull requests
now pass --os-specific-only: PlatformNeutral suites run only their .NET
Framework TFMs (Windows), and those jobs build only the projects they test.

Co-Authored-By: Claude <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-04T10:48:35.387918Z 43dac9f PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The pipeline adds an OS-specific-only option. Windows and macOS pull-request runs use selected solution filters and apply platform-specific test handling. Platform-neutral modules run only .NET Framework targets on Windows, while non-Windows runs skip them. Template tests are skipped in OS-specific-only scopes.

Changes: OS-specific pipeline runs

Layer / File(s) Summary
Define the OS-specific scope
tools/TUnit.Pipeline/Program.cs, tools/TUnit.Pipeline/PipelineScope.cs
The pipeline accepts --os-specific-only and stores the option in PipelineScope. When categories are not explicitly selected, non-Windows runs with this option ignore PlatformNeutral.
Apply the scope to test modules
tools/TUnit.Pipeline/Modules/Abstract/TestBaseModule.cs, tools/TUnit.Pipeline/Modules/RunTemplateTestsModule.cs, tools/TUnit.Pipeline/PipelineCategories.cs
Platform-neutral modules run only .NET Framework targets in an OS-specific-only scope. Template tests return without running in that scope. The PlatformNeutral documentation describes the Windows and macOS pull-request behavior.
Configure pull-request runs
.github/actions/execute-pipeline/action.yml, .github/workflows/dotnet.yml
The action maps its optional input to the pipeline flag. The workflow selects the full solution or a filtered solution and enables the option for Windows and macOS pull-request runs. The macOS pull-request category exclusions no longer include PlatformNeutral; the existing Reflection-mode engine-test and package-test exclusions remain.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Other

Sequence Diagram(s)

sequenceDiagram
  participant DotnetWorkflow as dotnet.yml
  participant PipelineAction as execute-pipeline action
  participant PipelineProgram as Program
  participant TestBaseModule
  participant RunTemplateTestsModule
  DotnetWorkflow->>PipelineAction: Set os-specific-only for Windows and macOS pull requests
  PipelineAction->>PipelineProgram: Pass --os-specific-only when input is true
  PipelineProgram->>TestBaseModule: Set PipelineScope.OsSpecificOnly
  TestBaseModule->>TestBaseModule: Select .NET Framework targets for platform-neutral modules
  PipelineProgram->>RunTemplateTestsModule: Set PipelineScope.OsSpecificOnly
  RunTemplateTestsModule->>RunTemplateTestsModule: Return without running template tests
Loading

Possibly related issues

Possibly related PRs

  • thomhurst/TUnit#7578: This PR changes how the same PlatformNeutral category is handled in the macOS pull-request pipeline.
  • thomhurst/TUnit#7364: This PR adds the EngineTests category and job that the current workflow continues to exclude from the modular pipeline on macOS.
Merge Risk: Minimal · up to 43dac

No merge-blocking issue was established in the narrower Windows and macOS pipeline runs.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: Windows and macOS pull-request jobs run only OS-specific work.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 2 functions across 5 files. (2 skipped: 2 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches
Generate docstrings
  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

A rabbit checks the runner’s gate,
And sorts the tests by OS state.
Windows hops through .NET Framework,
While macOS skips the template work.
The pipeline flags are tucked in tight,
Then carrots crunch beneath the moonlight.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 38785084-2c67-47f6-bb01-bef2c27ee3b3
Commits

Reviewing files that changed from the base of the PR and between 551917e and 43dac9f.

Files selected for processing: 7
  • .github/actions/execute-pipeline/action.yml
  • .github/workflows/dotnet.yml
  • tools/TUnit.Pipeline/Modules/Abstract/TestBaseModule.cs
  • tools/TUnit.Pipeline/Modules/RunTemplateTestsModule.cs
  • tools/TUnit.Pipeline/PipelineCategories.cs
  • tools/TUnit.Pipeline/PipelineScope.cs
  • tools/TUnit.Pipeline/Program.cs

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Review

The design is sound. Filtering on the PlatformNeutral category, with Windows keeping only the net4xx TFMs, matches how the modules are declared. I checked the modules that override TestableFrameworks. Only SourceGenerator, AssertionsSourceGenerator and PublicAPI use ModernAndNetFrameworks, and those three projects stay in the Windows build. Every other neutral module defaults to modern TFMs only. That means they run zero frameworks on Windows, and their projects are safely excluded from the build.

Suggestions, none blocking:

  1. Exclusion list and module list can drift. The excluded array in dotnet.yml has to match the set of PlatformNeutral modules by hand. If someone later gives an excluded project a net472 TFM, Windows will try to run it with --no-build against a project that was never built. That gives a confusing failure instead of a clear one. A cheap guard would be a pipeline-side check that fails with a clear message when the test project's output is missing. Alternatively, have the pipeline emit the project list (for example a --print-excluded-projects option) so there is one source of truth.
  2. Substring matching. grep -vFf matches substrings. tests/TUnit.Aspire.Tests and tests/TUnit.Mocks. are intentionally prefix-style, but a future project sharing one of those prefixes would be dropped silently. Anchoring the patterns (Path=\"<prefix>) would remove that risk.
  3. Global mutable state. PipelineScope.OsSpecificOnly is a static setter. Registering it as a small options singleton in DI would be more testable and consistent with how the pipeline is built. It works as is.
  4. dotnet restore / dotnet build on a .slnf. You validated this locally on macOS. Please confirm that the Windows job in this PR's CI also builds the .Net4_7 snapshot projects.

Overall this looks good, and the CI run on this PR exercises both new paths.

@greptile-apps

greptile-apps Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issues were found.

Summary

This PR narrows Windows and macOS pull request jobs while leaving Ubuntu and manual runs unchanged.

  • Windows and macOS pull requests skip tests Ubuntu already covers.
  • Windows and macOS pull requests build only projects their jobs need.

Acknowledged trade-off: thomhurst explicitly accepts losing Windows-specific checks inside the skipped modern platform-neutral suites, including CRLF behavior in code fixers.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Select job scope] --> B{Pull request on Windows or macOS?}
  B -->|No| C[Build full CI solution and use existing suite selection]
  B -->|Yes| D[Build filtered CI solution]
  D --> E{Operating system}
  E -->|Windows| F[Keep platform-neutral net472 tests]
  E -->|macOS| G[Skip platform-neutral suites]
  F --> H[Run remaining OS-specific suites]
  G --> H
Loading

Reviews (1) · Last reviewed commit: "ci: run only OS-specific work on Windows..." · Reviewed by Greptile

@thomhurst
thomhurst merged commit 38b7f77 into main Nov 4, 2026
27 checks passed
@thomhurst
thomhurst deleted the ci/os-specific-only branch November 4, 2026 11:53

This branch was previously deployed

1 inactive deployment
Pull Requests — 43dac9f1 Deployed Nov 4, 2026 by thomhurst via modularpipeline (windows-latest) #21165
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