-
Notifications
You must be signed in to change notification settings - Fork 33
80 lines (76 loc) · 2.16 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
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: |
6.0.x
7.0.x
8.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-restore -p:CollectCoverage=true -p:CoverletOutputFormat=opencover -p:CoverletOutput=../.coverage/
- name: Upload coverage to codecov
if: ${{ startsWith(matrix.os, 'ubuntu') }}
uses: codecov/codecov-action@v4
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