Skip to content

Update dependency nunit to 3.14.0 #63

Update dependency nunit to 3.14.0

Update dependency nunit to 3.14.0 #63

Workflow file for this run

name: Build
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
permissions:
contents: read
jobs:
modern:
# .NET 8+/10+ workloads: Text.Json and Aot run anywhere; the native Aot publish
# is done on Linux (linux-x64) as the representative AOT platform.
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: |
8.0.x
10.0.x
- name: Build Text.Json
run: dotnet build JsonSubTypes.Text.Json/JsonSubTypes.Text.Json.csproj -c Release
- name: Test Text.Json (net8 + net10)
run: dotnet test JsonSubTypes.Text.Json.Tests/JsonSubTypes.Text.Json.Tests.csproj -c Release
- name: Test Aot (net8 + net10)
run: dotnet test JsonSubTypes.Text.Json.Aot.Tests/JsonSubTypes.Text.Json.Aot.Tests.csproj -c Release
# The Newtonsoft tests run on net10 too (the library targets netstandard1.3/2.0),
# which lets coverlet measure the JsonSubTypes package on Linux.
- name: Test Newtonsoft on net10 (coverage)
run: dotnet test JsonSubTypes.Tests/JsonSubTypes.Tests.csproj -c Release -f net10.0 --collect:"XPlat Code Coverage" --results-directory TestResults/newtonsoft
- name: Test Text.Json with coverage (net10)
run: dotnet test JsonSubTypes.Text.Json.Tests/JsonSubTypes.Text.Json.Tests.csproj -c Release -f net10.0 --collect:"XPlat Code Coverage" --results-directory TestResults/textjson
- name: Test Aot with coverage (net10)
run: dotnet test JsonSubTypes.Text.Json.Aot.Tests/JsonSubTypes.Text.Json.Aot.Tests.csproj -c Release -f net10.0 --collect:"XPlat Code Coverage" --results-directory TestResults/aot
- name: Test Aot generator with coverage (net10)
run: dotnet test JsonSubTypes.Text.Json.Aot.Generator.Tests/JsonSubTypes.Text.Json.Aot.Generator.Tests.csproj -c Release -f net10.0 --collect:"XPlat Code Coverage" --results-directory TestResults/generator
- name: Install gpg (required by codecov-action v5)
run: sudo apt-get install -y gpg
# codecov-action v5 verifies the Codecov binary signature and requires
# gpg, which is not installed on the default ubuntu-latest image.
- name: Upload coverage to Codecov
uses: codecov/codecov-action@0fb7174895f61a3b6b78fc075e0cd60383518dac
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: |
TestResults/newtonsoft/**/coverage.cobertura.xml
TestResults/textjson/**/coverage.cobertura.xml
TestResults/aot/**/coverage.cobertura.xml
TestResults/generator/**/coverage.cobertura.xml
fail_ci_if_error: true
# The Aot sample is the only top-level-statements consumer of the generator:
# building it catches generated-code conflicts that unit tests cannot (e.g. a
# top-level `_` variable colliding with `out _` emitted by the generator).
- name: Build Aot sample (top-level statements consumer)
run: dotnet build JsonSubTypes.Text.Json.Aot.Sample/JsonSubTypes.Text.Json.Aot.Sample.csproj -c Release -f net8.0
# Native AOT end-to-end check: publish the sample as a native binary and run
# it. This is the only check that proves the generated converters work in a
# trimmed/AOT binary, not just under the JIT.
- name: Publish Aot sample as native binary
run: dotnet publish JsonSubTypes.Text.Json.Aot.Sample/JsonSubTypes.Text.Json.Aot.Sample.csproj -c Release -f net8.0 -r linux-x64 -p:StripSymbols=true
- name: Run the native Aot sample
run: ./JsonSubTypes.Text.Json.Aot.Sample/bin/Release/net8.0/linux-x64/publish/JsonSubTypes.Text.Json.Aot.Sample
framework:
# The Newtonsoft library targets net35/40/45/46/47 (.NET Framework), which runs
# only on Windows, so its test suite stays on a Windows agent.
runs-on: windows-latest
steps:
- uses: actions/checkout@v5
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: |
8.0.x
10.0.x
- name: Build JsonSubTypes (Newtonsoft)
run: dotnet build JsonSubTypes/JsonSubTypes.csproj -c Release
- name: Test Newtonsoft (net46)
run: dotnet test JsonSubTypes.Tests/JsonSubTypes.Tests.csproj -c Release -f net46
analysis:
# SonarCloud analyzes both master pushes and pull requests. For PRs the scanner
# needs the pull-request parameters plus GITHUB_TOKEN (used to decorate the PR
# with the quality gate). The job-level `if` avoids referencing the secret in a
# step-level `if`, which broke workflow startup before (secrets are not allowed
# in `if:` conditions).
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: |
8.0.x
10.0.x
- name: Install SonarScanner for .NET
run: dotnet tool install --global dotnet-sonarscanner --version 11.2.1
# The generic sonarcloud-github-action cannot analyze C#; only the
# SonarScanner for .NET can (the "Your project contains C# files which
# cannot be analyzed" warning). Per Sonar's docs, the coverage report must
# be produced in the same job as the scan (between begin and end), so this
# job builds and tests the solution itself rather than reusing modern's
# reports (whose relative file paths would not resolve here).
- name: Begin SonarCloud analysis
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
PR_KEY: ${{ github.event.pull_request.number }}
PR_BRANCH: ${{ github.head_ref }}
PR_BASE: ${{ github.base_ref }}
run: |
pr_args=""
if [ "${{ github.event_name }}" = "pull_request" ]; then
pr_args="/d:sonar.pullrequest.key=$PR_KEY /d:sonar.pullrequest.branch=$PR_BRANCH /d:sonar.pullrequest.base=$PR_BASE"
fi
dotnet-sonarscanner begin /k:manuc66_JsonSubTypes /o:manuc66-github /d:sonar.token="$SONAR_TOKEN" /d:sonar.host.url=https://sonarcloud.io /d:sonar.cs.cobertura.reportsPaths=TestResults/**/coverage.cobertura.xml /d:sonar.exclusions=**/*Tests*/**/*,**/JsonSubTypes.Benchmarks/**/*,**/JsonSubTypes.Text.Json.Aot.Sample/**/*,**/JsonSubTypes.Text.Json.Aot.Generated/TestDomain.cs /d:sonar.cpd.exclusions=**/*.g.cs $pr_args
- name: Build for SonarCloud analysis
run: dotnet build JsonSubTypes.sln -c Release
- name: Test with coverage (net10)
run: |
dotnet test JsonSubTypes.Tests/JsonSubTypes.Tests.csproj -c Release -f net10.0 --collect:"XPlat Code Coverage" --results-directory TestResults/newtonsoft
dotnet test JsonSubTypes.Text.Json.Tests/JsonSubTypes.Text.Json.Tests.csproj -c Release -f net10.0 --collect:"XPlat Code Coverage" --results-directory TestResults/textjson
dotnet test JsonSubTypes.Text.Json.Aot.Tests/JsonSubTypes.Text.Json.Aot.Tests.csproj -c Release -f net10.0 --collect:"XPlat Code Coverage" --results-directory TestResults/aot
dotnet test JsonSubTypes.Text.Json.Aot.Generator.Tests/JsonSubTypes.Text.Json.Aot.Generator.Tests.csproj -c Release -f net10.0 --collect:"XPlat Code Coverage" --results-directory TestResults/generator
- name: End SonarCloud analysis
run: dotnet-sonarscanner end /d:sonar.token="$SONAR_TOKEN"
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}