This repository has been archived by the owner on Nov 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
104 lines (88 loc) · 2.83 KB
/
unit-tests.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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
name: unit-tests
on:
# Allow manual build
workflow_dispatch:
# Build on push to main
push:
branches:
- main
paths:
- '**/**'
- '!docs/**'
- '!build/**'
- '!azure-pipelines*'
- '!**/*.md'
- '!**/*.txt'
- '!**/ci.yml'
- '!**/codeql.yml'
# Build every 6 months if not built already
schedule:
- cron: '0 1 1 */6 *'
jobs:
test-project:
name: Run Unit Tests
runs-on: windows-latest
steps:
- name: Checkout repository
id: checkout
uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.x
8.x
- uses: nuget/setup-nuget@v2
with:
nuget-version: 'latest'
nuget-api-key: ${{ secrets.AZDO_NUGET_REPO }}
- uses: wcenterprises/digital-is-build-actions/[email protected]
with:
package-name: 'Jh.Sample'
azdo-token: '${{ secrets.AZDO_NUGET_REPO }}'
- name: restore
run: |
dotnet restore 'Jh.Sample.sln'
shell: pwsh
working-directory: '${{ github.workspace }}/source'
- name: build
run: |
Write-Output "building..."
write-output "##[group]build: Jh.Sample.sln"
dotnet build 'Jh.Sample.sln' `
--no-restore `
--configuration release `
-p:Copyright="${env:BA_PACKAGE_COPYRIGHT}" `
-p:Authors="${env:BA_PACKAGE_AUTHORS}" `
-p:Company="${env:BA_PACKAGE_COMPANY}" `
-p:AssemblyVersion="${evn:BA_VERSION_PREFIX}" `
-p:FileVersion="${env:BA_VERSION}" `
-p:InformationalVersion="${env:BA_INFORMATIONALVERSION}+${{ github.sha }}" `
-p:TrimUnusedDependencies=true `
-p:IsOnBuildAgent=true `
-p:CodeAnalysisTreatWarningsAsErrors=true `
-warnaserror `
-p:_SkipUpgradeNetAnalyzersNuGetWarning=true
write-output "##[endgroup]"
shell: pwsh
working-directory: '${{ github.workspace }}/source'
- name: test
run: |
write-output "##[group]test: Jh.Sample.sln"
dotnet test Jh.Sample.sln `
--blame `
--no-build `
--no-restore `
--configuration release `
--filter TestCategory=UnitTest `
--collect "Code Coverage" `
--logger trx `
--results-directory '${{ github.workspace }}/TestResults'
write-output "##[endgroup]"
shell: pwsh
working-directory: '${{ github.workspace }}/source'
- uses: actions/upload-artifact@v3
if: always()
with:
name: 'TestResults'
path: '${{ github.workspace }}/TestResults'
if-no-files-found: error