-
-
Notifications
You must be signed in to change notification settings - Fork 99
87 lines (67 loc) · 2.42 KB
/
dotnetcore.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
81
82
83
84
85
86
87
---
name: Build, Test, Code coverage
on:
push:
branches: [master]
paths-ignore:
- '**.md'
pull_request:
branches: [master]
paths-ignore:
- '**.md'
workflow_dispatch:
env:
DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
EXCLUDE_PATHS: '\"**/Program.cs,**/Startup.cs,**/*Context.cs\"'
jobs:
build-and-test:
name: dotnet Build and Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Print info
run: |
echo User $GITHUB_ACTOR triggered build on $GITHUB_REF by $GITHUB_SHA commit.
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.x
- name: Build sln
run: dotnet build -c Release ./HappyCode.NetCoreBoilerplate.sln
- name: Test sln
run: dotnet test -c Release --no-build ./HappyCode.NetCoreBoilerplate.sln
collect-unit-test-coverage:
name: Unit test code coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.x
- name: Collect code coverage
run: dotnet test --filter UnitTests "/p:ExcludeByFile=${{ env.EXCLUDE_PATHS }}" /maxcpucount:1 /p:WarningLevel=0 /p:CollectCoverage=true /p:CoverletOutput="../" /p:MergeWith="../coverage.json" /p:CoverletOutputFormat=\"json,opencover\" ./HappyCode.NetCoreBoilerplate.sln
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./test/coverage.opencover.xml
flags: unit
collect-integration-test-coverage:
name: Integration test code coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.x
- name: Collect code coverage
run: dotnet test --filter IntegrationTests "/p:ExcludeByFile=${{ env.EXCLUDE_PATHS }}" /maxcpucount:1 /p:WarningLevel=0 /p:CollectCoverage=true /p:CoverletOutput="../" /p:MergeWith="../coverage.json" /p:CoverletOutputFormat=\"json,opencover\" ./HappyCode.NetCoreBoilerplate.sln
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./test/coverage.opencover.xml
flags: integration