-
-
Notifications
You must be signed in to change notification settings - Fork 96
59 lines (46 loc) · 1.63 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
---
name: Build, Test, Code coverage
on:
push:
paths-ignore:
- '**.md'
workflow_dispatch:
env:
# Disable .NET Core welcome
DOTNET_NOLOGO: true
# Disable .NET Core SDK telemetry
DOTNET_CLI_TELEMETRY_OPTOUT: true
jobs:
build-and-test:
name: Build and Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Print info
run: |
echo User $GITHUB_ACTOR triggered build on $GITHUB_REF by $GITHUB_SHA commit.
- name: Setup .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.x
- name: Build sln
run: dotnet build -c Release --no-cache /clp:NoSummary ./HappyCode.NetCoreBoilerplate.sln
- name: Test sln
run: dotnet test -c Release --no-build /maxcpucount:1 /p:WarningLevel=0 ./HappyCode.NetCoreBoilerplate.sln
collect-code-coverage:
name: Code coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.x
- name: Collect code coverage
run: dotnet test --filter "FullyQualifiedName~UnitTests" "/p:ExcludeByFile=\"**/Program.cs,**/Startup.cs,**/SerilogConfigurator.cs,**/Registrations/*.cs,**/*Context.cs\"" /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@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./test/coverage.opencover.xml
flags: unittests