-
Notifications
You must be signed in to change notification settings - Fork 2
54 lines (50 loc) · 1.54 KB
/
dotnet.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
name: .NET Build & Test
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
dotnet: [net7.0, net8.0]
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
7.0.x
8.0.x
- name: Install dependencies
run: cd src && dotnet restore
- name: Build
run: cd src && dotnet build --configuration Release --no-restore
- name: Unit Test With Coverage Report
run: |
cd ./tests/Atrea.PolicyEngine.Tests/
dotnet test --framework=${{ matrix.dotnet }} --no-restore /p:CollectCoverage=true /p:CoverletOutput=TestResults/ /p:CoverletOutputFormat=lcov
- name: Upload Code Coverage Results
uses: actions/upload-artifact@v4
with:
name: code-coverage-report-${{ matrix.dotnet }}
path: ./tests/Atrea.PolicyEngine.Tests/TestResults/coverage.${{ matrix.dotnet }}.info
coverage:
needs: build
runs-on: ubuntu-latest
strategy:
matrix:
dotnet: [net8.0] # only upload one coverage report
steps:
- uses: actions/checkout@v4
- name: Download Code Coverage Results
uses: actions/download-artifact@v4
with:
name: code-coverage-report-${{ matrix.dotnet }}
- name: Publish Coverage Report
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: coverage.${{ matrix.dotnet }}.info