Migrate to .NET9 #154
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Run unit tests | |
on: | |
pull_request: | |
branches: | |
- master | |
- dev | |
paths: | |
- src/** | |
- .github/workflows/** | |
# Upload code coverage results when PRs are merged | |
push: | |
branches: | |
- master | |
- dev | |
paths: | |
- src/** | |
- .github/workflows/** | |
env: | |
DOTNET_NOLOGO: true | |
DOTNET_CLI_TELEMETRY_OPTOUT: true | |
jobs: | |
test: | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest] | |
name: ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup .NET SDKs | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 9.0.x | |
source-url: https://nuget.pkg.github.com/destructurama/index.json | |
env: | |
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
- name: Install dependencies | |
working-directory: src | |
run: dotnet restore | |
- name: Check formatting | |
if: ${{ startsWith(matrix.os, 'ubuntu') }} | |
working-directory: src | |
run: | | |
dotnet format --no-restore --verify-no-changes --severity warn || (echo "Run 'dotnet format' to fix issues" && exit 1) | |
- name: Build solution [Release] | |
working-directory: src | |
run: dotnet build --no-restore -c Release | |
- name: Build solution [Debug] | |
working-directory: src | |
run: dotnet build --no-restore -c Debug | |
- name: Test solution [Debug] | |
working-directory: src | |
run: dotnet test --no-build -p:CollectCoverage=true -p:CoverletOutputFormat=opencover -p:CoverletOutput=../.coverage/ | |
- name: Upload coverage to codecov | |
if: ${{ startsWith(matrix.os, 'ubuntu') }} | |
uses: codecov/codecov-action@v5 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: src/.coverage/*.opencover.xml | |
buildcheck: | |
needs: | |
- test | |
runs-on: ubuntu-latest | |
if: always() | |
steps: | |
- name: Pass build check | |
if: ${{ needs.test.result == 'success' }} | |
run: exit 0 | |
- name: Fail build check | |
if: ${{ needs.test.result != 'success' }} | |
run: exit 1 |