-
Notifications
You must be signed in to change notification settings - Fork 0
469 lines (400 loc) · 13.1 KB
/
build.yaml
File metadata and controls
469 lines (400 loc) · 13.1 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
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
---
on:
workflow_call:
inputs:
version:
required: true
type: string
secrets:
SONAR_TOKEN:
required: true
jobs:
quality-checks:
name: Quality Checks
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Run markdown linter
uses: DavidAnson/markdownlint-cli2-action@v22
with:
globs: '**/*.md'
- name: Run spell checker
uses: streetsidesoftware/cspell-action@v8
with:
files: '**/*.{md,cs}'
- name: Run YAML linter
uses: ibiqlik/action-yamllint@v3
with:
config_file: .yamllint.yaml
build:
name: Build ${{ matrix.os }}
needs: quality-checks
permissions:
contents: read
pull-requests: write
strategy:
matrix:
os: [windows-latest, ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup dotnet
uses: actions/setup-dotnet@v5
with:
dotnet-version: |
8.x
9.x
10.x
- name: Restore Tools
run: >
dotnet tool restore
- name: Restore Dependencies
run: >
dotnet restore
- name: Start Sonar Scanner
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: >
dotnet dotnet-sonarscanner
begin
/k:"demaconsulting_BuildMark"
/o:"demaconsulting"
/d:sonar.token="${{ secrets.SONAR_TOKEN }}"
/d:sonar.host.url="https://sonarcloud.io"
/d:sonar.cs.opencover.reportsPaths=**/*.opencover.xml
/d:sonar.scanner.scanAll=false
- name: Build
run: >
dotnet build
--no-restore
--configuration Release
--property:Version=${{ inputs.version }}
- name: Test
run: >
dotnet test
--no-build
--configuration Release
--property:Version=${{ inputs.version }}
--collect "XPlat Code Coverage;Format=opencover"
--logger "trx;LogFilePrefix=${{ matrix.os }}"
--results-directory test-results
- name: End Sonar Scanner
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: >
dotnet dotnet-sonarscanner
end
/d:sonar.token="${{ secrets.SONAR_TOKEN }}"
- name: Create Dotnet Tool
run: >
dotnet pack
--no-build
--no-restore
--property:PackageVersion=${{ inputs.version }}
- name: Upload Test Results
uses: actions/upload-artifact@v6
with:
name: test-results-${{ matrix.os }}
path: test-results/*.trx
- name: Upload Artifacts
uses: actions/upload-artifact@v6
with:
name: artifacts-${{ matrix.os }}
path: |
src/DemaConsulting.BuildMark/bin/Release/*.nupkg
src/DemaConsulting.BuildMark/bin/Release/*.snupkg
codeql:
name: CodeQL Analysis
runs-on: ubuntu-latest
needs: quality-checks
permissions:
actions: read
contents: read
security-events: write
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Initialize CodeQL
uses: github/codeql-action/init@v4
with:
languages: csharp
queries: security-and-quality
config-file: ./.github/codeql-config.yml
- name: Setup dotnet
uses: actions/setup-dotnet@v5
with:
dotnet-version: |
8.x
9.x
10.x
- name: Restore Tools
run: >
dotnet tool restore
- name: Restore Dependencies
run: >
dotnet restore
- name: Build
run: >
dotnet build
--no-restore
--configuration Release
--property:Version=${{ inputs.version }}
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v4
with:
category: "/language:csharp"
output: sarif-results
upload: false
- name: Upload CodeQL SARIF
uses: actions/upload-artifact@v6
with:
name: codeql-sarif
path: sarif-results/csharp.sarif
integration-test:
name: Integration Test ${{ matrix.os }} .NET ${{ matrix.dotnet-version }}
runs-on: ${{ matrix.os }}
needs: build
permissions:
contents: read
strategy:
matrix:
os: [windows-latest, ubuntu-latest]
dotnet-version: ['8.x', '9.x', '10.x']
steps:
- name: Download package
uses: actions/download-artifact@v7
with:
name: artifacts-${{ matrix.os }}
path: packages
- name: Setup dotnet
uses: actions/setup-dotnet@v5
with:
dotnet-version: ${{ matrix.dotnet-version }}
- name: Install tool from package
shell: bash
run: |
echo "Installing package version ${{ inputs.version }} from: packages/"
dotnet tool install --global \
--add-source packages \
--version ${{ inputs.version }} \
DemaConsulting.BuildMark
- name: Test version display
shell: bash
run: |
echo "Testing buildmark --version..."
buildmark --version || { echo "✗ Version command failed"; exit 1; }
echo "✓ Version command succeeded"
- name: Test help display
shell: bash
run: |
echo "Testing buildmark --help..."
buildmark --help || { echo "✗ Help command failed"; exit 1; }
echo "✓ Help command succeeded"
- name: Run BuildMark self-validation
shell: bash
run: |
echo "Running BuildMark self-validation..."
buildmark --validate --results validation-${{ matrix.os }}-dotnet${{ matrix.dotnet-version }}.trx \
|| { echo "✗ Self-validation failed"; exit 1; }
echo "✓ Self-validation succeeded"
- name: Upload validation test results
if: always()
uses: actions/upload-artifact@v6
with:
name: validation-test-results-${{ matrix.os }}-dotnet${{ matrix.dotnet-version }}
path: validation-${{ matrix.os }}-dotnet${{ matrix.dotnet-version }}.trx
build-docs:
name: Build Documents
runs-on: windows-latest
needs: [build, integration-test, codeql]
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup dotnet
uses: actions/setup-dotnet@v5
with:
dotnet-version: '10.x'
- name: Restore Tools
run: dotnet tool restore
- name: Download BuildMark Package
uses: actions/download-artifact@v7
with:
name: artifacts-windows-latest
path: packages
- name: Install BuildMark Tool
shell: bash
run: |
echo "Installing BuildMark version ${{ inputs.version }}"
dotnet tool install --global \
--add-source packages \
--version ${{ inputs.version }} \
DemaConsulting.BuildMark
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 'lts/*'
- name: Install npm dependencies
run: npm install
- name: Download all test results
uses: actions/download-artifact@v7
with:
path: test-results
pattern: '*test-results*'
continue-on-error: true
- name: Download CodeQL SARIF
uses: actions/download-artifact@v7
with:
name: codeql-sarif
path: codeql-results
- name: Generate Requirements Report and Trace Matrix
run: >
dotnet reqstream
--requirements requirements.yaml
--tests "test-results/**/*.trx"
--report docs/requirements/requirements.md
--matrix docs/tracematrix/tracematrix.md
--justifications docs/justifications/justifications.md
--enforce
- name: Generate CodeQL Quality Report with SarifMark
run: >
dotnet sarifmark
--sarif codeql-results/csharp.sarif
--report docs/quality/codeql-quality.md
--heading "BuildMark CodeQL Analysis"
--report-depth 1
- name: Display CodeQL Quality Report
shell: bash
run: |
echo "=== CodeQL Quality Report ==="
cat docs/quality/codeql-quality.md
- name: Generate Code Quality Report with SonarMark
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: >
dotnet sonarmark
--server https://sonarcloud.io
--project-key demaconsulting_BuildMark
--branch ${{ github.head_ref || github.ref_name }}
--token "$env:SONAR_TOKEN"
--report docs/quality/sonar-quality.md
--report-depth 1
- name: Display SonarCloud Quality Report
shell: bash
run: |
echo "=== SonarCloud Quality Report ==="
cat docs/quality/sonar-quality.md
- name: Generate Build Notes with BuildMark
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: >
buildmark
--build-version ${{ inputs.version }}
--report docs/buildnotes.md
--report-depth 1
- name: Display Build Notes Report
shell: bash
run: |
echo "=== Build Notes Report ==="
cat docs/buildnotes.md
- name: Generate Build Notes HTML with Pandoc
shell: bash
run: >
dotnet pandoc
--defaults docs/buildnotes/definition.yaml
--metadata version="${{ inputs.version }}"
--metadata date="$(date +'%Y-%m-%d')"
--filter node_modules/.bin/mermaid-filter.cmd
--output docs/buildnotes/buildnotes.html
- name: Convert Build Notes HTML to PDF with Weasyprint
run: >
dotnet weasyprint
docs/buildnotes/buildnotes.html
"docs/BuildMark Build Notes.pdf"
- name: Generate User Guide HTML with Pandoc
shell: bash
run: >
dotnet pandoc
--defaults docs/guide/definition.yaml
--metadata version="${{ inputs.version }}"
--metadata date="$(date +'%Y-%m-%d')"
--filter node_modules/.bin/mermaid-filter.cmd
--output docs/guide/guide.html
- name: Convert User Guide HTML to PDF with Weasyprint
run: >
dotnet weasyprint
docs/guide/guide.html
"docs/BuildMark User Guide.pdf"
- name: Generate Requirements HTML with Pandoc
shell: bash
run: >
dotnet pandoc
--defaults docs/requirements/definition.yaml
--metadata version="${{ inputs.version }}"
--metadata date="$(date +'%Y-%m-%d')"
--filter node_modules/.bin/mermaid-filter.cmd
--output docs/requirements/requirements.html
- name: Generate Requirements PDF with Weasyprint
run: >
dotnet weasyprint
docs/requirements/requirements.html
"docs/BuildMark Requirements.pdf"
- name: Generate Trace Matrix HTML with Pandoc
shell: bash
run: >
dotnet pandoc
--defaults docs/tracematrix/definition.yaml
--metadata version="${{ inputs.version }}"
--metadata date="$(date +'%Y-%m-%d')"
--filter node_modules/.bin/mermaid-filter.cmd
--output docs/tracematrix/tracematrix.html
- name: Generate Trace Matrix PDF with Weasyprint
run: >
dotnet weasyprint
docs/tracematrix/tracematrix.html
"docs/BuildMark Trace Matrix.pdf"
- name: Generate Requirements Justifications HTML with Pandoc
shell: bash
run: >
dotnet pandoc
--defaults docs/justifications/definition.yaml
--metadata version="${{ inputs.version }}"
--metadata date="$(date +'%Y-%m-%d')"
--filter node_modules/.bin/mermaid-filter.cmd
--output docs/justifications/justifications.html
- name: Convert Requirements Justifications HTML to PDF with Weasyprint
run: >
dotnet weasyprint
docs/justifications/justifications.html
"docs/BuildMark Requirements Justifications.pdf"
- name: Generate Code Quality HTML with Pandoc
shell: bash
run: >
dotnet pandoc
--defaults docs/quality/definition.yaml
--metadata version="${{ inputs.version }}"
--metadata date="$(date +'%Y-%m-%d')"
--filter node_modules/.bin/mermaid-filter.cmd
--output docs/quality/quality.html
- name: Convert Code Quality HTML to PDF with Weasyprint
run: >
dotnet weasyprint
docs/quality/quality.html
"docs/BuildMark Code Quality.pdf"
- name: Upload Document Artifacts
uses: actions/upload-artifact@v6
with:
name: documents
path: |
docs/*.pdf
docs/buildnotes.md