-
-
Notifications
You must be signed in to change notification settings - Fork 323
89 lines (72 loc) · 3.01 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
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
88
89
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
name: Build and Run Tests
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
env:
AUDIT_NET_AZUREDOCDBAUTHKEY: ${{ secrets.AUDIT_NET_AZUREDOCDBAUTHKEY }}
AUDIT_NET_AZUREDOCDBURL: ${{ secrets.AUDIT_NET_AZUREDOCDBURL }}
AUDIT_NET_AZURETABLECNNSTRING: ${{ secrets.AUDIT_NET_AZURETABLECNNSTRING }}
AUDIT_NET_AZUREBLOBSERVICEURL: ${{ secrets.AUDIT_NET_AZUREBLOBSERVICEURL }}
AUDIT_NET_AZUREBLOBACCOUNTNAME: ${{ secrets.AUDIT_NET_AZUREBLOBACCOUNTNAME }}
AUDIT_NET_AZUREBLOBACCOUNTKEY: ${{ secrets.AUDIT_NET_AZUREBLOBACCOUNTKEY }}
jobs:
build_and_test:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
2.1.x
3.1.x
6.0.x
7.0.x
8.0.x
- name: Setup NuGet
uses: NuGet/[email protected]
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
with:
nuget-version: '6.x'
- name: Install SQL Server
uses: Particular/[email protected]
with:
connection-string-env-var: SQL_SERVER_CONNECTION_STRING
catalog: Audit
extra-params: "Encrypt=False;"
- name: Extra SQL
shell: pwsh
run: |
echo "Execute SqlScript.sql"
sqlcmd -i ".\src\Audit.NET.SqlServer\SqlScript.sql" -d "master" -I
echo "Execute Demo.sql"
sqlcmd -i ".\test\Audit.EntityFramework.Core.UnitTest\Demo.sql" -d "master" -I
- name: Dotnet Restore
run: dotnet restore
- name: Dotnet Build Audit.NET.sln
run: dotnet build .\Audit.NET.sln --no-restore --configuration release
- name: Install Required Tools
run: |
dotnet new tool-manifest
dotnet tool install dotnet-reportgenerator-globaltool
dotnet tool install dotnet-coverage
- name: Run unit tests (no integration)
run: |
dotnet coverage collect dotnet test -m:1 --filter=TestCategory!~Integration --output ${{ github.workspace }}/Tests/Coverage.UnitTest.cobertura.xml --output-format cobertura
- name: Run integration tests (SqlServer)
run: |
dotnet coverage collect dotnet test -m:1 --filter=TestCategory=Integration-SqlServer --output ${{ github.workspace }}/Tests/Coverage.SqlServer.cobertura.xml --output-format cobertura
- name: Generate Code Coverage Report
run: |
dotnet reportgenerator -reports:${{ github.workspace }}/Tests/Coverage.*.cobertura.xml -targetdir:"${{ github.workspace }}/Tests/coveragereport" -reporttypes:"MarkdownSummary;Html" "-assemblyfilters:-*UnitTest;-*Integration;+Audit.*"
- name: Upload Code Coverage Report
uses: actions/upload-artifact@v2
with:
name: coveragereport
path: ${{ github.workspace }}/Tests/coveragereport