-
Notifications
You must be signed in to change notification settings - Fork 0
354 lines (336 loc) · 13.7 KB
/
Copy pathbuild-baseline.yml
File metadata and controls
354 lines (336 loc) · 13.7 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
name: build-baseline
on:
pull_request:
branches:
- develop
- main
push:
branches:
- develop
- main
tags:
- "v*"
permissions:
contents: read
env:
GIT_CONFIG_COUNT: "1"
GIT_CONFIG_KEY_0: init.defaultBranch
GIT_CONFIG_VALUE_0: develop
jobs:
build-windows-native:
name: build / windows / amd64
runs-on: windows-2025
strategy:
fail-fast: false
permissions:
contents: read
env:
BANDSCOPE_ARTIFACT_OS: windows
BANDSCOPE_ARTIFACT_ARCH: amd64
BANDSCOPE_TARGET_TRIPLE: x86_64-pc-windows-msvc
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 22.22.3
cache: npm
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: "3.12"
- uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
with:
version: "0.8.6"
enable-cache: false
- name: Install Rust stable
run: rustup toolchain install stable --profile minimal
- name: Add Windows target
run: rustup target add $env:BANDSCOPE_TARGET_TRIPLE --toolchain stable
- name: Verify Windows antivirus baseline
shell: pwsh
run: |
function Write-AntivirusEvidence($message) {
Write-Host $message
if ($env:GITHUB_STEP_SUMMARY) {
Add-Content -Path $env:GITHUB_STEP_SUMMARY -Value $message
}
}
if (Get-Command Get-MpComputerStatus -ErrorAction SilentlyContinue) {
$status = Get-MpComputerStatus
Write-AntivirusEvidence "Antivirus check: Defender status AntivirusEnabled=$($status.AntivirusEnabled) RealTimeProtectionEnabled=$($status.RealTimeProtectionEnabled)."
if ($status.AntivirusEnabled) {
return
}
Write-AntivirusEvidence "Antivirus check: Defender telemetry is present but antivirus is not reported as enabled on this hosted runner."
}
$products = Get-CimInstance -Namespace root/SecurityCenter2 -ClassName AntiVirusProduct -ErrorAction SilentlyContinue
if ($products) {
Write-AntivirusEvidence "Antivirus check: SecurityCenter2 reported at least one antivirus product."
return
}
$defenderService = Get-Service -Name WinDefend -ErrorAction SilentlyContinue
if ($defenderService -and $defenderService.Status -in @('Running', 'StartPending')) {
Write-AntivirusEvidence "Antivirus check: WinDefend service is present and active."
return
}
Write-AntivirusEvidence "Antivirus check: no explicit antivirus telemetry was available on this hosted runner."
- name: Install node dependencies
run: npm ci
- name: Sync Python dependencies
run: uv sync --project services/analysis-engine --group dev --frozen
- name: Build frontend
run: npm run build --workspace @bandscope/desktop
- name: Build native shell
run: npm exec --workspace @bandscope/desktop -- tauri build --target $env:BANDSCOPE_TARGET_TRIPLE --bundles nsis
- name: Package Windows amd64 artifact
run: python scripts/release/package_desktop_artifact.py
- name: Upload Windows amd64 artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: bandscope-windows-amd64-${{ github.sha }}
path: artifacts/*
build-windows-arm64:
name: build / windows / arm64
runs-on: windows-11-arm
strategy:
fail-fast: false
permissions:
contents: read
env:
BANDSCOPE_ARTIFACT_OS: windows
BANDSCOPE_ARTIFACT_ARCH: arm64
BANDSCOPE_TARGET_TRIPLE: aarch64-pc-windows-msvc
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 22.22.3
cache: npm
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: "3.12"
- uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
with:
version: "0.8.6"
enable-cache: false
- name: Install Rust stable
run: rustup toolchain install stable --profile minimal
- name: Add Windows arm target
run: rustup target add $env:BANDSCOPE_TARGET_TRIPLE --toolchain stable
- name: Verify Windows antivirus baseline
shell: pwsh
run: |
function Write-AntivirusEvidence($message) {
Write-Host $message
if ($env:GITHUB_STEP_SUMMARY) {
Add-Content -Path $env:GITHUB_STEP_SUMMARY -Value $message
}
}
if (Get-Command Get-MpComputerStatus -ErrorAction SilentlyContinue) {
$status = Get-MpComputerStatus
Write-AntivirusEvidence "Antivirus check: Defender status AntivirusEnabled=$($status.AntivirusEnabled) RealTimeProtectionEnabled=$($status.RealTimeProtectionEnabled)."
if ($status.AntivirusEnabled) {
return
}
Write-AntivirusEvidence "Antivirus check: Defender telemetry is present but antivirus is not reported as enabled on this hosted runner."
}
$products = Get-CimInstance -Namespace root/SecurityCenter2 -ClassName AntiVirusProduct -ErrorAction SilentlyContinue
if ($products) {
Write-AntivirusEvidence "Antivirus check: SecurityCenter2 reported at least one antivirus product."
return
}
$defenderService = Get-Service -Name WinDefend -ErrorAction SilentlyContinue
if ($defenderService -and $defenderService.Status -in @('Running', 'StartPending')) {
Write-AntivirusEvidence "Antivirus check: WinDefend service is present and active."
return
}
Write-AntivirusEvidence "Antivirus check: no explicit antivirus telemetry was available on this hosted runner."
- name: Install node dependencies
run: npm ci
- name: Sync Python dependencies
if: runner.os != 'Windows' || runner.arch != 'ARM64' # llvmlite lacks wheel for Windows ARM64
run: uv sync --project services/analysis-engine --group dev --frozen
- name: Build frontend
run: npm run build --workspace @bandscope/desktop
- name: Build native shell
run: npm exec --workspace @bandscope/desktop -- tauri build --target $env:BANDSCOPE_TARGET_TRIPLE --bundles nsis
- name: Package Windows arm64 artifact
run: python scripts/release/package_desktop_artifact.py
- name: Upload Windows arm64 artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: bandscope-windows-arm64-${{ github.sha }}
path: artifacts/*
gate-windows:
name: gate / build / windows
runs-on: ubuntu-latest
needs:
- build-windows-native
- build-windows-arm64
steps:
- name: Confirm both Windows architectures built
run: true
build-macos-native:
name: build / macos / amd64
runs-on: macos-15-intel
strategy:
fail-fast: false
permissions:
contents: read
env:
BANDSCOPE_ARTIFACT_OS: macos
BANDSCOPE_ARTIFACT_ARCH: amd64
BANDSCOPE_TARGET_TRIPLE: x86_64-apple-darwin
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 22.22.3
cache: npm
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: "3.12"
- uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
with:
version: "0.8.6"
enable-cache: false
- name: Install Rust stable
run: rustup toolchain install stable --profile minimal
- name: Add macOS Intel target
run: rustup target add "$BANDSCOPE_TARGET_TRIPLE" --toolchain stable
- name: Install node dependencies
run: npm ci
- name: Sync Python dependencies
run: uv sync --project services/analysis-engine --group dev --frozen
- name: Build frontend
run: npm run build --workspace @bandscope/desktop
- name: Build native shell
run: npm exec --workspace @bandscope/desktop -- tauri build --target "$BANDSCOPE_TARGET_TRIPLE" --bundles dmg
- name: Package macOS amd64 artifact
run: python3 scripts/release/package_desktop_artifact.py
- name: Upload macOS amd64 artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: bandscope-macos-amd64-${{ github.sha }}
path: artifacts/*
build-macos-arm64:
name: build / macos / arm64
runs-on: macos-15
strategy:
fail-fast: false
permissions:
contents: read
env:
BANDSCOPE_ARTIFACT_OS: macos
BANDSCOPE_ARTIFACT_ARCH: arm64
BANDSCOPE_TARGET_TRIPLE: aarch64-apple-darwin
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 22.22.3
cache: npm
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: "3.12"
- uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
with:
version: "0.8.6"
enable-cache: false
- name: Install Rust stable
run: rustup toolchain install stable --profile minimal
- name: Add macOS arm target
run: rustup target add "$BANDSCOPE_TARGET_TRIPLE" --toolchain stable
- name: Install node dependencies
run: npm ci
- name: Sync Python dependencies
run: uv sync --project services/analysis-engine --group dev --frozen
- name: Build frontend
run: npm run build --workspace @bandscope/desktop
- name: Build native shell
run: npm exec --workspace @bandscope/desktop -- tauri build --target "$BANDSCOPE_TARGET_TRIPLE" --bundles dmg
- name: Package macOS arm64 artifact
run: python3 scripts/release/package_desktop_artifact.py
- name: Upload macOS arm64 artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: bandscope-macos-arm64-${{ github.sha }}
path: artifacts/*
gate-macos:
name: gate / build / macos
runs-on: ubuntu-latest
needs:
- build-macos-native
- build-macos-arm64
steps:
- name: Confirm both macOS architectures built
run: true
publish-immutable-release:
name: release-artifact / publish
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
needs:
- gate-windows
- gate-macos
permissions:
contents: read
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
pattern: bandscope-*-${{ github.sha }}
path: downloaded-artifacts
skip-decompress: true
- name: Extract release artifacts with repo-owned validation
run: python3 scripts/release/extract_release_artifacts.py downloaded-artifacts artifacts
- name: Generate release CycloneDX SBOM
uses: anchore/sbom-action@e22c389904149dbc22b58101806040fa8d37a610 # v0.24.0
with:
path: .
format: cyclonedx-json
output-file: bandscope-sbom.cdx.json
upload-artifact: false
upload-release-assets: false
- name: Upload release SBOM artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: bandscope-release-sbom-${{ github.sha }}
path: |
bandscope-sbom.cdx.json
supply-chain/supplemental-component-inventory.json
- name: Validate release asset set
run: python3 scripts/release/select_release_assets.py --output release-assets.txt
- name: Create draft release with complete assets, then publish
env:
GH_TOKEN: ${{ secrets.BANDSCOPE_RELEASE_TOKEN }}
RELEASE_TAG: ${{ github.ref_name }}
run: |
set -euo pipefail
if [ -z "${GH_TOKEN:-}" ]; then
echo "BANDSCOPE_RELEASE_TOKEN is required to publish immutable release assets."
exit 1
fi
if gh release view "$RELEASE_TAG" --repo "${{ github.repository }}" >/dev/null 2>&1; then
echo "Release $RELEASE_TAG already exists; immutable release assets must be attached before publication."
exit 1
fi
python3 scripts/release/select_release_assets.py --input release-assets.txt
mapfile -t release_assets < release-assets.txt
(( ${#release_assets[@]} > 0 ))
gh release create "$RELEASE_TAG" \
"${release_assets[@]}" \
--draft \
--generate-notes \
--title "BandScope ${RELEASE_TAG#v}" \
--verify-tag \
--repo "${{ github.repository }}"
gh release edit "$RELEASE_TAG" --draft=false --repo "${{ github.repository }}"