Publish Windows installers on nightly builds. (#18603)
Also do some general cleanup of the build workflow, including a bit of reorganization.
Austin S. Hemmelgarn committed
Sep 23, 2024 at 14:04 UTC
27fcf0af5704aa396d7dda6d6c19cd82a295763c
1 file changed
+122
-166
.github/workflows/build.yml
+122
-166
@@ -275,12 +275,118 @@ jobs:
275
&& needs.file-check.outputs.run == 'true'
276
}}
277
278
+ windows-build: # Test building on Windows
279
+ name: Test building on Windows
280
+ runs-on: windows-latest
281
+ needs:
282
+ - file-check
283
+ steps:
284
+ - name: Skip Check
285
+ id: skip
286
+ if: needs.file-check.outputs.run != 'true'
287
+ run: Write-Output "SKIPPED"
288
+ - name: Checkout
289
+ uses: actions/checkout@v4
290
+ id: checkout
291
+ if: needs.file-check.outputs.run == 'true'
292
+ with:
293
+ submodules: recursive
294
+ lfs: true
295
+ - name: Set Up Go
296
+ id: golang
297
+ if: needs.file-check.outputs.run == 'true'
298
+ uses: actions/setup-go@v5
299
+ with:
300
+ go-version: "^1.22"
301
+ - name: Set Up Dependencies
302
+ id: deps
303
+ if: needs.file-check.outputs.run == 'true'
304
+ run: ./packaging/windows/install-dependencies.ps1
305
+ - name: Build Netdata
306
+ id: build
307
+ if: needs.file-check.outputs.run == 'true'
308
+ env:
309
+ BUILD_DIR: ${{ github.workspace }}\build
310
+ run: ./packaging/windows/build.ps1
311
+ - name: Sign Agent Code
312
+ id: sign-agent
313
+ if: needs.file-check.outputs.run == 'true' && github.event_name != 'pull_request'
314
+ uses: azure/trusted-signing-action@v0.4.0
315
+ with:
316
+ azure-tenant-id: ${{ secrets.CODE_SIGNING_TENNANT_ID }}
317
+ azure-client-id: ${{ secrets.CODE_SIGNING_CLIENT_ID }}
318
+ azure-client-secret: ${{ secrets.CODE_SIGNING_CLIENT_SECRET }}
319
+ endpoint: "https://eus.codesigning.azure.net/"
320
+ trusted-signing-account-name: Netdata
321
+ certificate-profile-name: Netdata
322
+ files-folder: ${{ github.workspace }}\build
323
+ files-folder-filter: exe,dll
324
+ files-folder-recurse: true
325
+ file-digest: SHA256
326
+ timestamp-rfc3161: "http://timestamp.acs.microsoft.com"
327
+ timestamp-digest: SHA256
328
+ - name: Package Netdata
329
+ id: package
330
+ if: needs.file-check.outputs.run == 'true'
331
+ env:
332
+ BUILD_DIR: ${{ github.workspace }}\build
333
+ run: ./packaging/windows/package.ps1
334
+ - name: Sign Installer
335
+ id: sign-installer
336
+ if: needs.file-check.outputs.run == 'true' && github.event_name != 'pull_request'
337
+ uses: azure/trusted-signing-action@v0.4.0
338
+ with:
339
+ azure-tenant-id: ${{ secrets.CODE_SIGNING_TENNANT_ID }}
340
+ azure-client-id: ${{ secrets.CODE_SIGNING_CLIENT_ID }}
341
+ azure-client-secret: ${{ secrets.CODE_SIGNING_CLIENT_SECRET }}
342
+ endpoint: "https://eus.codesigning.azure.net/"
343
+ trusted-signing-account-name: Netdata
344
+ certificate-profile-name: Netdata
345
+ files: ${{ github.workspace }}\packaging\windows\netdata-installer.exe
346
+ file-digest: SHA256
347
+ timestamp-rfc3161: "http://timestamp.acs.microsoft.com"
348
+ timestamp-digest: SHA256
349
+ - name: Upload Installer
350
+ id: upload
351
+ uses: actions/upload-artifact@v4
352
+ with:
353
+ name: windows-x86_64-installer
354
+ path: packaging\windows\netdata-installer.exe
355
+ retention-days: 30
356
+ - name: Failure Notification
357
+ uses: rtCamp/action-slack-notify@v2
358
+ env:
359
+ SLACK_COLOR: 'danger'
360
+ SLACK_FOOTER: ''
361
+ SLACK_ICON_EMOJI: ':github-actions:'
362
+ SLACK_TITLE: 'Windows build failed:'
363
+ SLACK_USERNAME: 'GitHub Actions'
364
+ SLACK_MESSAGE: |-
365
+ ${{ github.repository }}: Updater checks for ${{ matrix.distro }} failed.
366
+ Checkout: ${{ steps.checkout.outcome }}
367
+ Set Up Dependencies: ${{ steps.deps.outcome }}
368
+ Build Netdata: ${{ steps.build.outcome }}
369
+ Sign Agent Code: ${{ steps.sign-agent.outcome }}
370
+ Package Netdata: ${{ steps.package.outcome }}
371
+ Sign Installer: ${{ steps.sign-installer.outcome }}
372
+ Upload Installer: ${{ steps.upload.outcome }}
373
+ SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
374
+ if: >-
375
+ ${{
376
+ failure()
377
+ && startsWith(github.ref, 'refs/heads/master')
378
+ && github.event_name != 'pull_request'
379
+ && github.repository == 'netdata/netdata'
380
+ && needs.file-check.outputs.run == 'true'
381
+ }}
382
+
383
prepare-upload: # Consolidate the artifacts for uploading or releasing.
384
name: Prepare Artifacts
385
runs-on: ubuntu-latest
386
needs:
387
- build-dist
388
- build-static
389
+ - windows-build
390
- file-check
391
steps:
392
- name: Skip Check
@@ -307,6 +413,18 @@ jobs:
413
merge-multiple: true
414
attempt_limit: 3
415
attempt_delay: 2000
416
+ - name: Retrieve Windows Artifacts
417
+ id: fetch-windows
418
+ if: needs.file-check.outputs.run == 'true' && github.event_name == 'workflow_dispatch' && github.event.inputs.type == 'nightly'
419
+ uses: Wandalen/wretry.action@v3
420
+ with:
421
+ action: actions/download-artifact@v4
422
+ with: |
423
+ pattern: windows-*-installer
424
+ path: dist-artifacts
425
+ merge-multiple: true
426
+ attempt_limit: 3
427
+ attempt_delay: 2000
428
- name: Prepare Artifacts
429
id: consolidate
430
if: needs.file-check.outputs.run == 'true'
@@ -338,7 +456,8 @@ jobs:
456
${{ github.repository }}: Failed to prepare release artifacts for upload.
457
Checkout: ${{ steps.checkout.outcome }}
458
Prepare environment: ${{ steps.prepare.outcome }}
341
- Fetch dist tarball: ${{ steps.fetch-dist.outcome }}
459
+ Fetch dist artifacts: ${{ steps.fetch-dist.outcome }}
460
+ Fetch Windows installers: ${{ steps.fetch-windows.outcome }}
461
Consolidate artifacts: ${{ steps.consolidate.outcome }}
462
Store: ${{ steps.store.outcome }}
463
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
@@ -489,68 +608,12 @@ jobs:
608
&& needs.file-check.outputs.run == 'true'
609
}}
610
492
- upload-nightly: # Upload the nightly build artifacts to GCS.
493
- name: Upload Nightly Artifacts
494
- runs-on: ubuntu-latest
495
- if: github.event_name == 'workflow_dispatch' && github.event.inputs.type == 'nightly' && github.repository == 'netdata/netdata'
496
- needs:
497
- - artifact-verification-dist
498
- - artifact-verification-static
499
- steps:
500
- - name: Retrieve Artifacts
501
- id: fetch
502
- uses: Wandalen/wretry.action@v3
503
- with:
504
- action: actions/download-artifact@v4
505
- with: |
506
- name: final-artifacts
507
- path: final-artifacts
508
- attempt_limit: 3
509
- attempt_delay: 2000
510
- - name: Authenticate to GCS
511
- id: gcs-auth
512
- uses: google-github-actions/auth@v2
513
- with:
514
- project_id: ${{ secrets.GCP_NIGHTLY_STORAGE_PROJECT }}
515
- credentials_json: ${{ secrets.GCS_STORAGE_SERVICE_KEY_JSON }}
516
- - name: Setup GCS
517
- id: gcs-setup
518
- uses: google-github-actions/setup-gcloud@v2.1.1
519
- - name: Upload Artifacts
520
- id: upload
521
- uses: google-github-actions/upload-cloud-storage@v2.2.0
522
- with:
523
- destination: ${{ secrets.GCP_NIGHTLY_STORAGE_BUCKET }}
524
- gzip: false
525
- path: ./final-artifacts/latest-version.txt
526
- parent: false
527
- - name: Failure Notification
528
- uses: rtCamp/action-slack-notify@v2
529
- env:
530
- SLACK_COLOR: 'danger'
531
- SLACK_FOOTER: ''
532
- SLACK_ICON_EMOJI: ':github-actions:'
533
- SLACK_TITLE: 'Failed to upload nightly release artifacts:'
534
- SLACK_USERNAME: 'GitHub Actions'
535
- SLACK_MESSAGE: |-
536
- ${{ github.repository }}: Failed to upload nightly release artifacts.
537
- Fetch artifacts: ${{ steps.fetch.outcome }}
538
- Authenticatie GCS: ${{ steps.gcs-auth.outcome }}
539
- Setup GCS: ${{ steps.gcs-setup.outcome }}
540
- Upload artifacts: ${{ steps.upload.outcome }}
541
- SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
542
- if: >-
543
- ${{
544
- failure()
545
- && startsWith(github.ref, 'refs/heads/master')
546
- && github.event_name != 'pull_request'
547
- }}
548
-
611
create-nightly: # Create a nightly build release in netdata/netdata-nightlies
612
name: Create Nightly Release
613
runs-on: ubuntu-latest
614
if: github.event_name == 'workflow_dispatch' && github.event.inputs.type == 'nightly' && github.repository == 'netdata/netdata'
615
needs:
616
+ - prepare-upload
617
- artifact-verification-dist
618
- artifact-verification-static
619
steps:
@@ -955,8 +1018,7 @@ jobs:
1018
Checkout: ${{ steps.checkout.outcome }}
1019
Fetch test environment: ${{ steps.fetch.outcome }}
1020
Load test environment: ${{ steps.load.outcome }}
958
- netdata-installer, disable cloud: ${{ steps.build-no-cloud.outcome }}
959
- netdata-installer, require cloud: ${{ steps.build-cloud.outcome }}
1021
+ netdata-installer: ${{ steps.build-cloud.outcome }}
1022
netdata-installer, no JSON-C: ${{ steps.build-no-jsonc.outcome }}
1023
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
1024
if: >-
@@ -1040,112 +1102,6 @@ jobs:
1102
&& github.repository == 'netdata/netdata'
1103
}}
1104
1043
- windows-build: # Test building on Windows
1044
- name: Test building on Windows
1045
- runs-on: windows-latest
1046
- if: github.event_name != 'workflow_dispatch'
1047
- needs:
1048
- - file-check
1049
- steps:
1050
- - name: Skip Check
1051
- id: skip
1052
- if: needs.file-check.outputs.run != 'true'
1053
- run: Write-Output "SKIPPED"
1054
- - name: Checkout
1055
- uses: actions/checkout@v4
1056
- id: checkout
1057
- if: needs.file-check.outputs.run == 'true'
1058
- with:
1059
- submodules: recursive
1060
- lfs: true
1061
- - name: Set Up Go
1062
- id: golang
1063
- if: needs.file-check.outputs.run == 'true'
1064
- uses: actions/setup-go@v5
1065
- with:
1066
- go-version: "^1.22"
1067
- - name: Set Up Dependencies
1068
- id: deps
1069
- if: needs.file-check.outputs.run == 'true'
1070
- run: ./packaging/windows/install-dependencies.ps1
1071
- - name: Build Netdata
1072
- id: build
1073
- if: needs.file-check.outputs.run == 'true'
1074
- env:
1075
- BUILD_DIR: ${{ github.workspace }}\build
1076
- run: ./packaging/windows/build.ps1
1077
- - name: Sign Agent Code
1078
- id: sign-agent
1079
- if: needs.file-check.outputs.run == 'true' && github.event_name != 'pull_request'
1080
- uses: azure/trusted-signing-action@v0.4.0
1081
- with:
1082
- azure-tenant-id: ${{ secrets.CODE_SIGNING_TENNANT_ID }}
1083
- azure-client-id: ${{ secrets.CODE_SIGNING_CLIENT_ID }}
1084
- azure-client-secret: ${{ secrets.CODE_SIGNING_CLIENT_SECRET }}
1085
- endpoint: "https://eus.codesigning.azure.net/"
1086
- trusted-signing-account-name: Netdata
1087
- certificate-profile-name: Netdata
1088
- files-folder: ${{ github.workspace }}\build
1089
- files-folder-filter: exe,dll
1090
- files-folder-recurse: true
1091
- file-digest: SHA256
1092
- timestamp-rfc3161: "http://timestamp.acs.microsoft.com"
1093
- timestamp-digest: SHA256
1094
- - name: Package Netdata
1095
- id: package
1096
- if: needs.file-check.outputs.run == 'true'
1097
- env:
1098
- BUILD_DIR: ${{ github.workspace }}\build
1099
- run: ./packaging/windows/package.ps1
1100
- - name: Sign Installer
1101
- id: sign-installer
1102
- if: needs.file-check.outputs.run == 'true' && github.event_name != 'pull_request'
1103
- uses: azure/trusted-signing-action@v0.4.0
1104
- with:
1105
- azure-tenant-id: ${{ secrets.CODE_SIGNING_TENNANT_ID }}
1106
- azure-client-id: ${{ secrets.CODE_SIGNING_CLIENT_ID }}
1107
- azure-client-secret: ${{ secrets.CODE_SIGNING_CLIENT_SECRET }}
1108
- endpoint: "https://eus.codesigning.azure.net/"
1109
- trusted-signing-account-name: Netdata
1110
- certificate-profile-name: Netdata
1111
- files: ${{ github.workspace }}\packaging\windows\netdata-installer.exe
1112
- file-digest: SHA256
1113
- timestamp-rfc3161: "http://timestamp.acs.microsoft.com"
1114
- timestamp-digest: SHA256
1115
- - name: Upload Installer
1116
- id: upload
1117
- uses: actions/upload-artifact@v4
1118
- with:
1119
- name: windows-x86_64-installer
1120
- path: packaging\windows\netdata-installer.exe
1121
- retention-days: 30
1122
- - name: Failure Notification
1123
- uses: rtCamp/action-slack-notify@v2
1124
- env:
1125
- SLACK_COLOR: 'danger'
1126
- SLACK_FOOTER: ''
1127
- SLACK_ICON_EMOJI: ':github-actions:'
1128
- SLACK_TITLE: 'Windows build failed:'
1129
- SLACK_USERNAME: 'GitHub Actions'
1130
- SLACK_MESSAGE: |-
1131
- ${{ github.repository }}: Updater checks for ${{ matrix.distro }} failed.
1132
- Checkout: ${{ steps.checkout.outcome }}
1133
- Set Up Dependencies: ${{ steps.deps.outcome }}
1134
- Build Netdata: ${{ steps.build.outcome }}
1135
- Sign Agent Code: ${{ steps.sign-agent.outcome }}
1136
- Package Netdata: ${{ steps.package.outcome }}
1137
- Sign Installer: ${{ steps.sign-installer.outcome }}
1138
- Upload Installer: ${{ steps.upload.outcome }}
1139
- SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
1140
- if: >-
1141
- ${{
1142
- failure()
1143
- && startsWith(github.ref, 'refs/heads/master')
1144
- && github.event_name != 'pull_request'
1145
- && github.repository == 'netdata/netdata'
1146
- && needs.file-check.outputs.run == 'true'
1147
- }}
1148
-
1105
updater-check: # Test the generated dist archive using the updater code.
1106
name: Test Generated Distfile and Updater Code
1107
runs-on: ubuntu-latest