-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (41 loc) · 1.41 KB
/
code-coverage.yml
File metadata and controls
51 lines (41 loc) · 1.41 KB
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
name: code coverage
on:
push:
pull_request:
branches: [ main ]
paths:
- '**.cs'
- '**.csproj'
env:
DOTNET_VERSION: '8.0.405' # The .NET SDK version to use
jobs:
build:
name: build-${{matrix.os}}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v3
- name: Setup .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Install dependencies
run: dotnet restore src/ServicePlace.sln
- name: Build
run: dotnet build src/ServicePlace.sln --configuration Release --no-restore
- name: Install Required Tools
run: |
dotnet new tool-manifest
dotnet tool install dotnet-reportgenerator-globaltool
dotnet tool install dotnet-coverage
- name: Run the unit tests with code coverage & Generate Report
run: |
dotnet coverage collect dotnet test src/ServicePlace.UnitTest --output ${{ github.workspace }}/Tests/Coverage.cobertura.xml --output-format cobertura
dotnet reportgenerator -reports:${{ github.workspace }}/Tests/Coverage.cobertura.xml -targetdir:"${{ github.workspace }}/Tests/coveragereport" -reporttypes:Html
- name: Archive code coverage results
uses: actions/upload-artifact@v4
with:
name: code-coverage-report
path: ${{ github.workspace }}/Tests/