Skip to content

Switch to C# language version 14 #255

Switch to C# language version 14

Switch to C# language version 14 #255

Workflow file for this run

name: Build
on: [ push, pull_request ]
jobs:
build-and-test:
name: Build and test
strategy:
matrix:
os: [ ubuntu-latest, windows-latest, macos-13 ]
# NOTE: If we wanted to use `macos-latest` we would have to move the .NET Core 2.1 and 3.1 builds and test runs
# to a separate job. This is because `macos-14` and newer are ARM-only and those target frameworks don't support
# that architecture, causing `dotnet` to want to fall back to X64. However, once we install .NET 6 or newer,
# we get a toolchain that only has ARM support and no X64 support, so that fallback will no longer work.
# Using `macos-13` is (for the time being, while still available) the simpler solution as it is not ARM-based yet,
# so there won't be any architecture mismatch in the first place.
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
# -----
# Setup .NET sdk
# -----
- name: Install .NET SDKs
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
8.0.x
9.0.x
# -----
# Build
# -----
- name: Restore NuGet packages
run: dotnet restore
- name: Build all targets
run: dotnet build -c Release --no-restore
# ----
# Test
# ----
- name: Test on .NET 8.0
run: dotnet test -c Release -f net8.0 --no-build --no-restore -l "console;verbosity=detailed"
- name: Test on .NET 9.0
run: dotnet test -c Release -f net9.0 --no-build --no-restore -l "console;verbosity=detailed"
- name: Test on .NET Framework 4.6.2 (Windows only)
if: matrix.os == 'windows-latest'
run: dotnet test -c Release -f net462 --no-build --no-restore -l "console;verbosity=detailed"