-
Notifications
You must be signed in to change notification settings - Fork 391
246 lines (245 loc) · 8.43 KB
/
bff-ci.yml
File metadata and controls
246 lines (245 loc) · 8.43 KB
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
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
# This was generated by tool. Edits will be overwritten.
name: bff/ci
on:
workflow_dispatch:
push:
paths:
- .config/dotnet-tools.json
- .github/workflows/bff-**
- bff/**
- .editorconfig
- Directory.Packages.props
- global.json
- src.props
- test.props
pull_request:
paths:
- .config/dotnet-tools.json
- .github/workflows/bff-**
- bff/**
- .editorconfig
- Directory.Packages.props
- global.json
- src.props
- test.props
env:
DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
jobs:
verify-formatting:
name: Verify formatting
if: (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository) || (github.event_name == 'push') || (github.event_name == 'workflow_dispatch')
runs-on:
group: large
labels: [ubuntu-latest-x64-16core]
permissions:
contents: read
defaults:
run:
shell: bash
working-directory: bff
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: List .net sdks
run: dotnet --list-sdks
- name: Setup Dotnet
uses: actions/setup-dotnet@3e891b0cb619bf60e2c25674b222b8940e2c1c25
with:
dotnet-version: 10.0.100
- name: Restore
run: dotnet restore bff.slnf
- name: Verify Formatting
run: dotnet format bff.slnf --verify-no-changes --no-restore
build:
name: Build and test (unit)
if: (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository) || (github.event_name == 'push') || (github.event_name == 'workflow_dispatch')
runs-on:
group: large
labels: [ubuntu-latest-x64-16core]
permissions:
actions: read
checks: write
contents: read
packages: write
defaults:
run:
shell: bash
working-directory: bff
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: List .net sdks
run: dotnet --list-sdks
- name: Setup Dotnet
uses: actions/setup-dotnet@3e891b0cb619bf60e2c25674b222b8940e2c1c25
with:
dotnet-version: 10.0.100
- name: Restore
run: dotnet restore bff.slnf
- name: Build
run: dotnet build bff.slnf --no-restore -c Release
- name: Dotnet devcerts
run: dotnet dev-certs https --trust
- name: Test - test/Bff.Tests
run: >-
dotnet run --project test/Bff.Tests -c Release --no-build -- \
--report-xunit-trx --report-xunit-trx-filename Bff.Tests.trx \
--coverage --coverage-output-format cobertura \
--coverage-output Bff.Tests.cobertura.xml
- id: test-report-test-Bff-Tests
name: Test report - test/Bff.Tests
if: github.event_name == 'push' && (success() || failure())
uses: dorny/test-reporter@31a54ee7ebcacc03a09ea97a7e5465a47b84aea5
with:
name: Test Report - test/Bff.Tests
path: '**/Bff.Tests.trx'
reporter: dotnet-trx
fail-on-error: true
fail-on-empty: true
- name: Publish test report link
run: echo "[Test Results - test/Bff.Tests](${{ steps.test-report-test-Bff-Tests.outputs.url_html }})" >> $GITHUB_STEP_SUMMARY
playwright:
name: Playwright tests
if: (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository) || (github.event_name == 'push') || (github.event_name == 'workflow_dispatch')
runs-on:
group: large
labels: [ubuntu-latest-x64-16core]
permissions:
actions: read
checks: write
contents: read
defaults:
run:
shell: bash
working-directory: bff
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: List .net sdks
run: dotnet --list-sdks
- name: Setup Dotnet
uses: actions/setup-dotnet@3e891b0cb619bf60e2c25674b222b8940e2c1c25
with:
dotnet-version: 10.0.100
- name: Restore
run: dotnet restore bff.slnf
- name: Build
run: dotnet build bff.slnf --no-restore -c Release
- id: playwright-cache
name: Cache Playwright assets
uses: actions/cache@v4
with:
path: ~/.cache/ms-playwright
key: playwright-${{ runner.os }}-${{ hashFiles('**/Hosts.Tests.csproj') }}
restore-keys: playwright-${{ runner.os }}-
- name: Install Playwright
if: steps.playwright-cache.outputs.cache-hit != 'true'
run: pwsh test/Hosts.Tests/bin/Release/net10.0/playwright.ps1 install --with-deps
- name: Dotnet devcerts
run: dotnet dev-certs https --trust
- name: Test - test/Hosts.Tests
run: >-
dotnet run --project test/Hosts.Tests -c Release --no-build -- \
--report-xunit-trx --report-xunit-trx-filename Hosts.Tests.trx \
--coverage --coverage-output-format cobertura \
--coverage-output Hosts.Tests.cobertura.xml
- id: test-report-test-Hosts-Tests
name: Test report - test/Hosts.Tests
if: github.event_name == 'push' && (success() || failure())
uses: dorny/test-reporter@31a54ee7ebcacc03a09ea97a7e5465a47b84aea5
with:
name: Test Report - test/Hosts.Tests
path: '**/Hosts.Tests.trx'
reporter: dotnet-trx
fail-on-error: true
fail-on-empty: true
- name: Publish test report link
run: echo "[Test Results - test/Hosts.Tests](${{ steps.test-report-test-Hosts-Tests.outputs.url_html }})" >> $GITHUB_STEP_SUMMARY
- name: Upload playwright traces
if: success() || failure()
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882
with:
name: playwright-traces
path: bff/test/**/playwright-traces/*.zip
overwrite: true
retention-days: 15
codeql:
name: CodeQL analyze
if: (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository) || (github.event_name == 'push') || (github.event_name == 'workflow_dispatch')
runs-on:
group: large
labels: [ubuntu-latest-x64-16core]
defaults:
run:
shell: bash
working-directory: bff
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
pack:
name: Pack, sign and push
if: (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository) || (github.event_name == 'push') || (github.event_name == 'workflow_dispatch')
needs:
- verify-formatting
- build
- playwright
- codeql
runs-on:
group: large
labels: [ubuntu-latest-x64-16core]
permissions:
actions: read
contents: read
packages: write
defaults:
run:
shell: bash
working-directory: bff
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: List .net sdks
run: dotnet --list-sdks
- name: Setup Dotnet
uses: actions/setup-dotnet@3e891b0cb619bf60e2c25674b222b8940e2c1c25
with:
dotnet-version: 10.0.100
- name: Tool restore
run: dotnet tool restore
- name: Pack bff.slnf
run: dotnet pack -c Release bff.slnf -o artifacts
- name: Sign packages
if: github.event == 'push'
run: >-
for file in artifacts/*.nupkg; do
dotnet NuGetKeyVaultSignTool sign "$file" --file-digest sha256 --timestamp-rfc3161 http://timestamp.digicert.com --azure-key-vault-url https://duendecodesigninghsm.vault.azure.net/ --azure-key-vault-client-id 18e3de68-2556-4345-8076-a46fad79e474 --azure-key-vault-tenant-id ed3089f0-5401-4758-90eb-066124e2d907 --azure-key-vault-client-secret ${{ secrets.SignClientSecret }} --azure-key-vault-certificate NuGetPackageSigning
done
- name: Push packages to GitHub
if: github.ref == 'refs/heads/main'
run: dotnet nuget push artifacts/*.nupkg --source https://nuget.pkg.github.com/DuendeSoftware/index.json --api-key ${{ secrets.GITHUB_TOKEN }} --skip-duplicate
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload Artifacts
if: github.ref == 'refs/heads/main'
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882
with:
name: artifacts
path: bff/artifacts/*.nupkg
overwrite: true
retention-days: 15