Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<TargetFramework>net11.0</TargetFramework>
<OutputType>Exe</OutputType>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
Expand Down
20 changes: 10 additions & 10 deletions .github/tests/test-dotnet-native-fixtures.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ check_sdks() {
($probe|length)==1 and ($probe[0]|mandatory) and $probe[0].shell=="bash" and
($probe[0].env.SDK_VERSIONS|tostring|split("\n")|map(select(length>0)))==$versions and ($mapping[0]|mandatory) and ($blocks[0]|mandatory) and
($versions|length)==2 and
($versions[0]|test("^9[.]0[.][0-9]+$")) and
($versions[1]|test("^10[.]0[.][0-9]+$")) and
($mapping[0]|versions)==[$versions[1]] and
($versions[0]|test("^10[.]0[.][0-9]+$")) and
($versions[1]|test("^11[.]0[.][0-9]+$")) and
($mapping[0]|versions)==[$versions[0]] and
($blocks[0]|versions)==$versions
' "$1" >/dev/null
}
Expand All @@ -84,12 +84,12 @@ check_sdks "$work/ci.json" "$work/sdk.json" || {
}
sdk_controls=0
for mutation in \
'.runs.steps[1].with["dotnet-version"]="9\n10"' \
'.runs.steps[1].with["dotnet-version"]="9.0.x\n10.0.x"' \
'.runs.steps[1].with["dotnet-version"]="9.0.319"' \
'.runs.steps[1].with["dotnet-version"]="10\n11"' \
'.runs.steps[1].with["dotnet-version"]="10.0.x\n11.0.x"' \
'.runs.steps[1].with["dotnet-version"]="11.0.100"' \
'.runs.steps[1].with["dotnet-version"]="10.0.402"' \
'.runs.steps[1].with["dotnet-version"]="9.0.319\n10.0.402-preview.1"' \
'.runs.steps[0].env.SDK_VERSIONS="9.0.319"' \
'.runs.steps[1].with["dotnet-version"]="10.0.402\n11.0.100-preview.1"' \
'.runs.steps[0].env.SDK_VERSIONS="10.0.402"' \
'.runs.steps[0].if="false"' \
'del(.runs.steps[0])' \
'.runs.steps[1].if="false"' \
Expand All @@ -107,9 +107,9 @@ done
for mutation in \
'.jobs["test-run-dotnet-tests-preserves-source-mapping"].steps |= map(if (.uses // "" | startswith("actions/setup-dotnet@")) then .with["dotnet-version"]="10" else . end)' \
'.jobs["test-run-dotnet-tests-blocks"].steps |= map(select((.uses // "" | startswith("actions/setup-dotnet@")) | not))' \
'.jobs["test-run-dotnet-tests-blocks"].steps |= map(if (.uses // "" | startswith("actions/setup-dotnet@")) then .with["dotnet-version"]="9.0.318\n10.0.402" else . end)' \
'.jobs["test-run-dotnet-tests-blocks"].steps |= map(if (.uses // "" | startswith("actions/setup-dotnet@")) then .with["dotnet-version"]="10.0.401\n11.0.100" else . end)' \
'.jobs["test-run-dotnet-tests-preserves-source-mapping"].steps += [{uses:"actions/setup-dotnet@v4",with:{"dotnet-version":"10.0.402"}}]' \
'.jobs["test-run-dotnet-tests-blocks"].steps += [{uses:"actions/setup-dotnet@v4",with:{"dotnet-version":"9.0.319\n10.0.402"}}]'; do
'.jobs["test-run-dotnet-tests-blocks"].steps += [{uses:"actions/setup-dotnet@v4",with:{"dotnet-version":"10.0.402\n11.0.100"}}]'; do
jq "$mutation" "$work/ci.json" >"$work/broken-sdk-ci.json"
if check_sdks "$work/broken-sdk-ci.json" "$work/sdk.json"; then
echo 'FAIL: accepted missing, floating or mismatched fixture SDKs' >&2
Expand Down
12 changes: 6 additions & 6 deletions .github/version-pins.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,15 @@
"files": [
"actions/run-dotnet-tests/action.yaml"
],
"refresh": "The .NET SDKs: previous STS and current LTS, exact published versions. Move actions/run-dotnet-tests and the native fixture steps in ci.yaml together."
"refresh": "The .NET SDKs: current LTS and current STS, exact published versions. Move actions/run-dotnet-tests and the native fixture steps in ci.yaml together."
},
{
"kind": "tool",
"pin": "SDK_VERSIONS: 9.0.319",
"pin": "SDK_VERSIONS: 11.0.100",
"files": [
"actions/run-dotnet-tests/action.yaml"
],
"refresh": "The .NET SDKs: previous STS and current LTS, exact published versions. Move actions/run-dotnet-tests and the native fixture steps in ci.yaml together."
"refresh": "The .NET SDKs: current LTS and current STS, exact published versions. Move actions/run-dotnet-tests and the native fixture steps in ci.yaml together."
},
{
"kind": "tool",
Expand All @@ -82,16 +82,16 @@
".github/workflows/ci.yaml",
"actions/run-dotnet-tests/action.yaml"
],
"refresh": "The .NET SDKs: previous STS and current LTS, exact published versions. Move actions/run-dotnet-tests and the native fixture steps in ci.yaml together."
"refresh": "The .NET SDKs: current LTS and current STS, exact published versions. Move actions/run-dotnet-tests and the native fixture steps in ci.yaml together."
},
{
"kind": "tool",
"pin": "dotnet-version: 9.0.319",
"pin": "dotnet-version: 11.0.100",
"files": [
".github/workflows/ci.yaml",
"actions/run-dotnet-tests/action.yaml"
],
"refresh": "The .NET SDKs: previous STS and current LTS, exact published versions. Move actions/run-dotnet-tests and the native fixture steps in ci.yaml together."
"refresh": "The .NET SDKs: current LTS and current STS, exact published versions. Move actions/run-dotnet-tests and the native fixture steps in ci.yaml together."
},
{
"kind": "tool",
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1943,10 +1943,10 @@ jobs:
- name: ⚙️ Setup .NET
uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
with:
# Match actions/run-dotnet-tests/action.yaml's SDK provisioning (previous STS + current LTS).
# Match actions/run-dotnet-tests/action.yaml's SDK provisioning (current LTS + current STS).
dotnet-version: |
9.0.319
10.0.402
11.0.100

# Mirror actions/run-dotnet-tests/action.yaml's test step (`dotnet test …`) against a fixture
# whose only test fails on purpose, so the run exits non-zero — exactly the gate's
Expand Down
4 changes: 2 additions & 2 deletions actions/run-dotnet-tests/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Run Dotnet Tests

Test .NET solutions or projects across multiple platforms with code coverage reporting. Sets up the .NET 9 (STS) and .NET 10 (LTS) SDKs side-by-side, optionally restores private packages from GitHub Packages without persisting credentials, runs tests with coverage collection, and uploads the report to **GitHub Code Quality** (native PR coverage) on authenticated runs.
Test .NET solutions or projects across multiple platforms with code coverage reporting. Sets up the .NET 10 (LTS) and .NET 11 (STS) SDKs side-by-side, optionally restores private packages from GitHub Packages without persisting credentials, runs tests with coverage collection, and uploads the report to **GitHub Code Quality** (native PR coverage) on authenticated runs.

> **Permissions:** the calling job must grant `code-quality: write` for the GitHub Code Quality upload. The coverage is merged into a single Cobertura report (via ReportGenerator) and uploaded once, from the Linux matrix leg only. The upload is best-effort (it never fails the build), requires the repo's **Code Quality** to be enabled (_Settings → Code quality_), and is skipped when `github-token` is empty.

Expand Down Expand Up @@ -36,7 +36,7 @@ steps:
The action picks the test command from the runner your project uses:

- **VSTest (the default):** runs `dotnet test` with the Coverlet collector (`--collect:"XPlat Code Coverage"`).
- **Microsoft.Testing.Platform:** used when the nearest `global.json` sets `"test": { "runner": "Microsoft.Testing.Platform" }`. This is the runner xUnit v3 4.x needs on the .NET 10 SDK.
- **Microsoft.Testing.Platform:** used when the nearest `global.json` sets `"test": { "runner": "Microsoft.Testing.Platform" }`. This is the runner xUnit v3 4.x needs on the .NET 10 SDK and later.
- If a project references `Microsoft.Testing.Extensions.CodeCoverage`, coverage is collected in Cobertura format with `--coverage`.
- Otherwise tests still run, and a notice explains that coverage was skipped.

Expand Down
6 changes: 3 additions & 3 deletions actions/run-dotnet-tests/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ runs:
env:
# Keep this list aligned with Setup .NET and the native fixture callsites.
SDK_VERSIONS: |
9.0.319
10.0.402
11.0.100
run: |
set -euo pipefail
count=0
Expand All @@ -45,12 +45,12 @@ runs:
if: steps.sdk-check.outputs.install-needed != 'false'
uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
with:
# Provision both the previous STS (9) and the current LTS (10) so callers can
# Provision both the current LTS (10) and the current STS (11) so callers can
# target either TFM. Exact published SDKs avoid premature channel redirects.
# Refresh these pins together with the two native fixture setup steps.
dotnet-version: |
9.0.319
10.0.402
11.0.100
- name: 🚚 Restore packages with GitHub Packages
if: inputs.github-token != ''
run: |
Expand Down
Loading