Skip to content

Bump microsoft/setup-msbuild from 2.0.0 to 3.0.0 #564

Bump microsoft/setup-msbuild from 2.0.0 to 3.0.0

Bump microsoft/setup-msbuild from 2.0.0 to 3.0.0 #564

Workflow file for this run

name: Continuous Integration
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
# ----------------------------------------------------------------------
# Job 1: Standard x64 Linux and Windows Tests
# These are your primary tests and are expected to pass for a successful build.
# ----------------------------------------------------------------------
test-x64-windows:
name: Test ${{ matrix.os }} - ${{ matrix.dotnet-tfm }}
strategy:
fail-fast: false # Ensures all matrix combinations run even if one fails
matrix:
include:
# --- Windows Tests ---
# On Windows, we can test all target frameworks, including net48
# NOTE: Using SDK 10.0.x for all Windows tests because projects target net10.0
# and older SDKs cannot build projects with net10.0 in TargetFrameworks
- os: windows-latest
dotnet-tfm: net48
dotnet-sdk: 10.0.x
- os: windows-latest
dotnet-tfm: net6.0
dotnet-sdk: 10.0.x
- os: windows-latest
dotnet-tfm: net7.0
dotnet-sdk: 10.0.x
- os: windows-latest
dotnet-tfm: net8.0
dotnet-sdk: 10.0.x
- os: windows-latest
dotnet-tfm: net9.0
dotnet-sdk: 10.0.x
- os: windows-latest
dotnet-tfm: net10.0
dotnet-sdk: 10.0.x
# --- Linux (x64) Tests ---
# On Linux, we only test cross-platform .NET versions
# NOTE: Using SDK 10.0.x for all Linux tests for consistency
- os: ubuntu-latest
dotnet-tfm: net6.0
dotnet-sdk: 10.0.x
- os: ubuntu-latest
dotnet-tfm: net7.0
dotnet-sdk: 10.0.x
- os: ubuntu-latest
dotnet-tfm: net8.0
dotnet-sdk: 10.0.x
- os: ubuntu-latest
dotnet-tfm: net9.0
dotnet-sdk: 10.0.x
- os: ubuntu-latest
dotnet-tfm: net10.0
dotnet-sdk: 10.0.x
runs-on: ${{ matrix.os }}
steps:
- name: Checkout sources
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup .NET SDK ${{ matrix.dotnet-sdk }}
uses: actions/setup-dotnet@v5
with:
dotnet-version: |
6.0.x
7.0.x
8.0.x
9.0.x
10.0.x
- name: Run tests for ${{ matrix.dotnet-tfm }}
run: dotnet test --framework ${{ matrix.dotnet-tfm }} --collect:"XPlat Code Coverage"
- name: Upload coverage for ${{ matrix.os }} (${{ matrix.dotnet-tfm }})
uses: actions/upload-artifact@v7
with:
name: Code coverage ${{ matrix.os }}-${{ matrix.dotnet-tfm }}
path: "**/coverage.cobertura.xml"
# ----------------------------------------------------------------------
# Job 2: ARM64 Linux Tests
# This job will run on ARM64 if a runner is available within the timeout.
# It will not fail the entire workflow if it fails or times out.
# ----------------------------------------------------------------------
test-arm64:
name: Test ARM64 - ${{ matrix.dotnet-tfm }}
runs-on: ubuntu-24.04-arm
strategy:
fail-fast: false # Ensures all TFM combinations for ARM64 are attempted
matrix:
include:
# --- Linux (ARM64) Tests ---
# On ARM64, we only test cross-platform .NET versions -> starting with net8.0
#- dotnet-tfm: net6.0
# dotnet-sdk: 10.0.x
#- dotnet-tfm: net7.0
# dotnet-sdk: 10.0.x
- dotnet-tfm: net8.0
dotnet-sdk: 10.0.x
- dotnet-tfm: net9.0
dotnet-sdk: 10.0.x
- dotnet-tfm: net10.0
dotnet-sdk: 10.0.x
steps:
- name: Checkout sources
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup .NET SDK ${{ matrix.dotnet-sdk }}
uses: actions/setup-dotnet@v5
with:
dotnet-version: ${{ matrix.dotnet-sdk }}
- name: Run tests for ${{ matrix.dotnet-tfm }}
run: dotnet test --framework ${{ matrix.dotnet-tfm }} --collect:"XPlat Code Coverage" --runtime linux-arm64 /p:PlatformTarget=arm64
- name: Upload coverage for ARM64 (${{ matrix.dotnet-tfm }})
uses: actions/upload-artifact@v7
with:
name: Code coverage ubuntu-latest-arm64-${{ matrix.dotnet-tfm }}
path: "**/coverage.cobertura.xml"
# ----------------------------------------------------------------------
# Coverage Job (collects from both test jobs)
# ----------------------------------------------------------------------
coverage:
name: Coverage
needs: [test-x64-windows]
runs-on: windows-latest
steps:
- name: Checkout sources
uses: actions/checkout@v6
- name: Setup .NET
uses: actions/setup-dotnet@v5
- name: Download all coverage artifacts
uses: actions/download-artifact@v8
with:
# This downloads all artifacts named 'Code coverage *' into subdirectories
path: coverage-artifacts
- name: Generate coverage report (HTML + Cobertura)
uses: danielpalme/ReportGenerator-GitHub-Action@5.5.4
with:
# Adjust the reports path to include all downloaded files
reports: "coverage-artifacts/**/coverage.cobertura.xml"
targetdir: "coverage-report"
# *** IMPORTANT CHANGE HERE ***
# Add 'Html' to the reporttypes to generate an HTML report.
# You can also use 'Html_Light', 'Html_Dark', etc., for specific themes.
reporttypes: "Html;Cobertura"
- name: Upload HTML coverage report
uses: actions/upload-artifact@v7
with:
name: HTML Coverage Report
# Upload the entire directory where ReportGenerator placed the HTML files
path: coverage-report/
# Optional: Set a retention period for the artifact (e.g., 5 days)
# retention-days: 5
# ... (rest of your coverage job, e.g., publishing to Codacy) ...
# ----------------------------------------------------------------------
# Pack Job (depends only on primary tests)
# ----------------------------------------------------------------------
pack:
name: Pack
needs: [test-x64-windows] # Pack should only need successful core tests
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: 10.0.x
- name: Create packages
run: dotnet pack --configuration Release --output ./packages
- name: Upload a Build Artifact
uses: actions/upload-artifact@v7
with:
name: NuGet packages
path: packages/*.*
# ----------------------------------------------------------------------
# Deploy Job (depends on pack)
# ----------------------------------------------------------------------
deploy:
name: Deploy
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
needs: [pack]
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: 10.0.x
- uses: actions/download-artifact@v8
with:
name: NuGet packages
path: packages
- name: Print Files in packages folder
run: dir packages
- name: Push packages
run: dotnet nuget push "packages/*.nupkg" --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json
- uses: dotnet/nbgv@v0.5.1
id: nbgv
- name: Create GitHub release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.nbgv.outputs.SemVer2 }}
release_name: v${{ steps.nbgv.outputs.SemVer2 }}
- name: Comment relevant issues and merge requests
uses: apexskier/github-release-commenter@v1.4.1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
comment-template: |
This is addressed in release {release_link}.
label-template: |
state: released