-
Notifications
You must be signed in to change notification settings - Fork 5
231 lines (221 loc) · 7.72 KB
/
build.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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
name: Build
on:
push:
branches: [ main ]
tags: [ 'v[0-9]+.[0-9]+.[0-9]+' ]
jobs:
unit-tests:
name: "Unit tests"
strategy:
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET SDKs
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
7.0.x
8.0.x
- name: Run unit tests (windows)
if: matrix.os == 'windows-latest'
run: ./build.ps1 CodeCoverage
- name: Run unit tests (ubuntu|macos)
if: matrix.os != 'windows-latest'
run: ./build.sh CodeCoverage
- name: Upload artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: ${{ runner.os }}-artifacts
path: |
./Artifacts/*
./TestResults/*.trx
api-tests:
name: "API tests"
runs-on: ubuntu-latest
env:
DOTNET_NOLOGO: true
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET SDKs
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
7.0.x
8.0.x
- name: API checks
run: ./build.sh ApiChecks
- name: Upload artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: API-tests
path: |
./Artifacts/*
./TestResults/*.trx
mutation-tests-linux:
name: "Mutation tests (Linux)"
if: ${{ github.actor != 'dependabot[bot]' }}
runs-on: ubuntu-latest
env:
STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }}
DOTNET_NOLOGO: true
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET SDKs
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
7.0.x
8.0.x
- name: Run mutation tests
run: ./build.sh MutationTestsLinux
mutation-tests-windows:
name: "Mutation tests (Windows)"
if: ${{ github.actor != 'dependabot[bot]' }}
runs-on: windows-latest
env:
STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }}
DOTNET_NOLOGO: true
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET SDKs
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
7.0.x
8.0.x
- name: Run mutation tests
run: ./build.ps1 MutationTestsWindows
static-code-analysis:
name: "Static code analysis"
runs-on: ubuntu-latest
env:
REPORTGENERATOR_LICENSE: ${{ secrets.REPORTGENERATOR_LICENSE }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
DOTNET_NOLOGO: true
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET SDKs
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
7.0.x
8.0.x
- name: Run sonarcloud analysis
run: ./build.sh CodeAnalysis
publish-test-results:
name: "Publish Tests Results"
needs: [ api-tests, unit-tests ]
runs-on: ubuntu-latest
permissions:
checks: write
pull-requests: write
if: always()
steps:
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
with:
comment_mode: always
files: "artifacts/**/**/*.trx"
pack:
name: "Pack"
runs-on: ubuntu-latest
needs: [ publish-test-results, mutation-tests-linux, mutation-tests-windows, static-code-analysis ]
env:
DOTNET_NOLOGO: true
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET SDKs
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
7.0.x
8.0.x
- name: Pack nuget packages
run: ./build.sh Pack
- name: Upload packages
if: always()
uses: actions/upload-artifact@v4
with:
path: Artifacts/Packages
name: Packages
push:
name: "Push"
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
runs-on: ubuntu-latest
environment: production
needs: [ pack ]
permissions:
contents: write
steps:
- name: Download packages
uses: actions/download-artifact@v4
with:
name: Packages
path: Artifacts/Packages
- name: Publish
run: |
echo "Found the following packages to push:"
search_dir=Artifacts/Packages
for entry in Artifacts/Packages/*.nupkg
do
echo "- $entry"
done
for entry in Artifacts/Packages/*.nupkg
do
nuget push $entry -Source 'https://api.nuget.org/v3/index.json' -ApiKey ${{secrets.NUGET_API_KEY}} -SkipDuplicate
done
- name: Create GitHub release
continue-on-error: true
uses: softprops/action-gh-release@v2
with:
name: ${{ steps.tag.outputs.release_version }}
tag_name: ${{ steps.tag.outputs.release_version }}
token: ${{ secrets.GITHUB_TOKEN }}
generate_release_notes: true
finalize-release:
name: "Finalize release"
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
needs: [ push ]
permissions:
contents: read
issues: write
pull-requests: write
steps:
- name: Comment relevant issues and pull requests
continue-on-error: true
uses: apexskier/[email protected]
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
comment-template: |
This is addressed in release {release_link}.
label-template: |
state: released
skip-label: |
state: released