Repository navigation
1900 lines (1669 loc) · 76.3 KB
/
Copy pathci-verify.yml
File metadata and controls
1900 lines (1669 loc) · 76.3 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
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
name: "CI Verify"
run-name: >-
${{
github.event_name == 'pull_request' && format('CI Verify — PR #{0}: {1}', github.event.pull_request.number, github.event.pull_request.title) ||
github.event_name == 'push' && format('CI Verify — {0}', github.event.head_commit.message) ||
github.event_name == 'merge_group' && format('CI Verify — Merge Queue: {0}', github.ref_name) ||
github.event_name == 'workflow_call' && format('CI Verify — workflow_call ({0})', github.sha) ||
format('CI Verify — {0}', github.ref_name)
}}
on:
# Release candidates use this trigger to run the complete matrix against the
# frozen branch before the final NAS acceptance starts.
workflow_dispatch:
push:
# Only `main` — release/** branches reach main via a PR (covered by
# `pull_request` below) and post-merge `push: main` drives release-cut
# polling. Triggering on `push: release/**` produced a duplicate run that
# the concurrency group cancelled, and the cancelled run blocked the PR's
# required-status rollup. See DEPRECATIONS/CI notes.
branches:
- main
pull_request:
# `dev/**` too: v1.6 work landed on dev/v1.6 via PRs that ran no backend or
# frontend CI at all, because this only ever fired for PRs targeting main.
# The integration branch is where features are supposed to land, so it needs
# the same gate main gets — otherwise dev is only as good as whatever the
# author happened to run locally.
branches: [main, 'dev/**']
schedule:
# Both schedules now run the full security sweep: CodeQL, Fuzz, DAST
# (ZAP baseline + Nuclei), plus the lint/test/build chain DAST depends on.
# Twice-weekly cadence catches drift in external CodeQL queries, Nuclei
# templates, and ZAP signatures between merges to main.
- cron: '30 6 * * 1' # Monday 06:30 UTC
- cron: '0 6 * * 0' # Sunday 06:00 UTC
merge_group:
branches: [main]
workflow_call:
secrets:
CODECOV_TOKEN:
required: false
concurrency:
# Key on the source branch name (`head_ref` on PRs, `ref_name` on
# main/release pushes and merge_group) so rapid successive pushes to
# the same branch cancel the in-flight run.
group: ci-verify-${{ github.workflow }}-${{ github.head_ref || github.ref_name }}
cancel-in-progress: true
permissions: {}
env:
# npm's default fetch-timeout is 300000ms, the same as the retry wrapper's
# timeout_minutes, so a stalled registry fetch always burned the whole
# attempt before either side gave up (runner image 20260831 / npm 11.19.0,
# 2026-09-03). Fail the fetch at 60s and let npm retry it itself.
NPM_CONFIG_FETCH_TIMEOUT: "60000"
NPM_CONFIG_FETCH_RETRIES: "5"
# Every host-side npm ci on that image still stalled exactly once per install
# (61s flat with the timeout above) while the Dockerfile's
# `npm ci --no-audit --no-fund` never did. Skip the audit and fund lookups
# here too; they add nothing in CI.
NPM_CONFIG_AUDIT: "false"
NPM_CONFIG_FUND: "false"
jobs:
security-actions:
name: "Security: Actions"
# go-ci.yml's nested codeql job declares security-events: write even
# though run-codeql stays unset here — GitHub validates a called
# workflow's job-level permissions statically, regardless of if:
# gating, so the caller must still grant it.
permissions:
actions: read
contents: read
security-events: write
# The org's .github repo has no tags; pinned to a commit on its main
# branch as of 2026-08-16, verified by
# .github/tests/reusable-ci-config.test.ts. Re-check the org's .github
# commit history periodically and bump this pin if the reusable
# workflow's inputs change.
uses: CodesWhat/.github/.github/workflows/go-ci.yml@47820bd85d49eb6cd0a935c31789c7d7ce037401 # main, 2026-08-16
with:
run-workflow-security: true
workflow-security-egress-policy: block
workflow-security-allowed-endpoints: "ghcr.io:443 github.com:443 pkg-containers.githubusercontent.com:443"
run-test: false
run-lint: false
secrets:
name: "Security: Secrets"
needs: [security-actions]
runs-on: ubuntu-24.04
timeout-minutes: 10
permissions:
contents: read
steps:
- name: Harden Runner
uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1
with:
egress-policy: block
allowed-endpoints: >
github.com:443
objects.githubusercontent.com:443
release-assets.githubusercontent.com:443
*.actions.githubusercontent.com:443
disable-sudo: true
- name: Checkout
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
with:
fetch-depth: 0
persist-credentials: false
- name: Restore scanner policy from a protected ref
# A PR must not be able to alter the gate that scans it: restore the
# scanner script and ignore policy from protected, merged content.
# An exact dev-tree promotion on the same or newer release base can
# use that protected dev commit's policy. Ordinary PRs keep the base
# policy, including older lines or unreviewed changes. Capture the
# selected commit before checkout.
#
# pull_request only. push/schedule/workflow_dispatch/workflow_call all
# run already-trusted content, where head and base are the same trust
# domain. `merge_group` is deliberately NOT covered: no ruleset enables
# a merge queue today, so those events never fire, and `github.base_ref`
# is empty there anyway. If a merge queue is ever turned on, extend this
# to merge_group via `github.event.merge_group.base_ref` — until then a
# queue would evaluate the PR's own unmerged scanner policy.
if: github.event_name == 'pull_request'
env:
BASE_REF: ${{ github.base_ref }}
run: |
set -euo pipefail
git fetch --no-tags origin "refs/heads/${BASE_REF}"
policy_commit="$(git rev-parse FETCH_HEAD)"
policy_ref="${BASE_REF}"
if [ "${BASE_REF}" = "main" ]; then
if version="$(git show HEAD:package.json | jq -er '.version | select(type == "string")')" \
&& [[ "${version}" =~ ^([0-9]+)\.([0-9]+)\.[0-9]+(-[0-9A-Za-z.-]+)?(\+[0-9A-Za-z.-]+)?$ ]]; then
dev_ref="dev/v${BASH_REMATCH[1]}.${BASH_REMATCH[2]}"
if git fetch --no-tags origin "refs/heads/${dev_ref}"; then
dev_commit="$(git rev-parse FETCH_HEAD)"
if [ "$(git rev-parse 'HEAD^{tree}')" = "$(git rev-parse "${dev_commit}^{tree}")" ]; then
if base_version="$(git show "${policy_commit}:package.json" | jq -er '.version | select(type == "string")')" \
&& jq -en --arg candidate "${version}" --arg base "${base_version}" '
# Compare integer components by decimal length and digits.
def parts:
split("-")[0] | split("+")[0] | split(".")
| if length == 3 and all(.[]; test("^[0-9]+$"))
then map(sub("^0+"; "") | [length, .])
else error("Invalid release base version")
end;
($candidate | parts) >= ($base | parts)
' >/dev/null; then
policy_commit="${dev_commit}"
policy_ref="${dev_ref}"
fi
fi
fi
fi
fi
echo "Restoring secret scanner policy from ${policy_ref} (${policy_commit})"
git checkout "${policy_commit}" -- scripts/scan-secrets.sh .gitleaks.toml .gitleaksignore
- name: Install Gitleaks
env:
GITLEAKS_VERSION: '8.30.1'
GITLEAKS_LINUX_X64_SHA256: '551f6fc83ea457d62a0d98237cbad105af8d557003051f41f3e7ca7b3f2470eb'
run: |
set -euo pipefail
archive="${RUNNER_TEMP}/gitleaks.tar.gz"
install_dir="${RUNNER_TEMP}/gitleaks-bin"
mkdir -p "${install_dir}"
curl --proto '=https' --tlsv1.2 --retry 3 --fail --silent --show-error --location \
"https://github.com/gitleaks/gitleaks/releases/download/v${GITLEAKS_VERSION}/gitleaks_${GITLEAKS_VERSION}_linux_x64.tar.gz" \
--output "${archive}"
printf '%s %s\n' "${GITLEAKS_LINUX_X64_SHA256}" "${archive}" | sha256sum --check --strict
tar -xzf "${archive}" -C "${install_dir}" gitleaks
"${install_dir}/gitleaks" version
printf '%s\n' "${install_dir}" >> "${GITHUB_PATH}"
- name: Scan secrets
# On pull_request the git-history scan covers base..HEAD only. The
# checkout above has fetch-depth 0, so with --log-opts=--all every
# branch ever pushed to the repo was scanned under the base branch's
# ignore file: an unannotated fixture on any other branch failed
# Secrets on every open PR, and a branch could never fix its own
# finding. push, schedule, workflow_dispatch and workflow_call keep
# scanning full history; head and base are the same trust domain
# there. Policy files still come from the base ref (step above).
env:
BASE_REF: ${{ github.base_ref }}
SCAN_SECRETS_LOG_OPTS: >-
${{ github.event_name == 'pull_request' && format('origin/{0}..HEAD', github.base_ref) || '--all' }}
run: |
set -euo pipefail
if [ "${GITHUB_EVENT_NAME}" = "pull_request" ]; then
# Make sure origin/<base> resolves with full history even if the
# checkout's remote refs were trimmed.
git fetch --no-tags origin "refs/heads/${BASE_REF}:refs/remotes/origin/${BASE_REF}"
fi
scripts/scan-secrets.sh
changes:
name: "Changes: Path Filter"
runs-on: ubuntu-24.04
timeout-minutes: 5
permissions:
contents: read
pull-requests: read
outputs:
runtime: ${{ steps.filter.outputs.runtime }}
web: ${{ steps.filter.outputs.web }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1
with:
egress-policy: block
allowed-endpoints: >
github.com:443
api.github.com:443
*.actions.githubusercontent.com:443
disable-sudo: true
- name: Checkout
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
with:
persist-credentials: false
fetch-depth: 0
- name: Filter paths
id: filter
uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4.0.3
with:
# On push events, diff against the ref's previous SHA so we get
# per-push changes. dorny/paths-filter's default on non-default
# branches is to diff against the repository's default branch,
# which on a long-lived release branch means every commit sees
# the entire branch diff and runtime is always true. Pull
# request events leave base unset so the action falls back to
# the PR target diff (the correct behavior there).
base: ${{ github.event_name == 'push' && github.event.before || github.event_name == 'workflow_dispatch' && 'main' || '' }}
# runtime=true when the changeset touches anything that can affect
# runtime behavior. Keep this shared with e2e-playwright.yml so both
# heavy E2E gates short-circuit symmetrically on pure docs/changelog
# edits.
filters: .github/filters/runtime.yml
codeql:
name: "SAST: CodeQL"
if: github.event_name == 'workflow_dispatch' || github.event_name == 'pull_request' || github.event_name == 'schedule' || (github.event_name == 'push' && github.ref == 'refs/heads/main')
needs: [security-actions]
runs-on: ubuntu-24.04
timeout-minutes: 60 # CodeQL init/autobuild/analyze can be long on cache misses
permissions:
security-events: write
contents: read
actions: read
strategy:
fail-fast: false
matrix:
language: [javascript-typescript]
steps:
- name: Harden Runner
uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
with:
persist-credentials: false
- name: Initialize CodeQL
uses: github/codeql-action/init@db488ddef3bf6cb639b32c2e9a7c0a7ea8271d28 # v4.37.8
with:
languages: ${{ matrix.language }}
config-file: ./.github/codeql/codeql-config.yml
- name: Autobuild
uses: github/codeql-action/autobuild@db488ddef3bf6cb639b32c2e9a7c0a7ea8271d28 # v4.37.8
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@db488ddef3bf6cb639b32c2e9a7c0a7ea8271d28 # v4.37.8
with:
category: /language:${{ matrix.language }}
fuzz:
name: "Fuzz Testing"
if: github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' || (github.event_name == 'push' && github.ref == 'refs/heads/main')
needs: [security-actions]
runs-on: ubuntu-24.04
timeout-minutes: 25
permissions:
contents: read
issues: write
steps:
- name: Harden Runner
uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1
with:
egress-policy: block
allowed-endpoints: >
github.com:443
registry.npmjs.org:443
nodejs.org:443
api.github.com:443
*.actions.githubusercontent.com:443
disable-sudo: true
- name: Checkout
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
with:
persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6.5.0
with:
node-version: 24
package-manager-cache: true
cache-dependency-path: app/package-lock.json
- name: Install dependencies
run: npm ci
working-directory: app
- name: Run fuzz tests
id: fuzz-run
continue-on-error: true
run: |
set -euo pipefail
mkdir -p ../artifacts/fuzz
npx vitest run --reporter=verbose '.fuzz.test.ts' 2>&1 | tee ../artifacts/fuzz/fuzz-test.log
working-directory: app
- name: Summarize fuzz result
id: fuzz-status
if: always()
env:
FUZZ_OUTCOME: ${{ steps.fuzz-run.outcome }}
run: |
set -euo pipefail
if [ "${FUZZ_OUTCOME}" = "success" ]; then
echo "failed=false" >> "$GITHUB_OUTPUT"
{
echo "### Fuzz Testing"
echo "- Result: PASS"
echo "- Log artifact: \`fuzz-log-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}\`"
} >> "$GITHUB_STEP_SUMMARY"
exit 0
fi
echo "failed=true" >> "$GITHUB_OUTPUT"
{
echo "### Fuzz Testing"
echo "- Result: FAIL"
echo "- AI_ACTION_REQUIRED: inspect fuzz log artifact and failing seed/case before merge."
echo "- Log artifact: \`fuzz-log-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}\`"
} >> "$GITHUB_STEP_SUMMARY"
- name: Upload fuzz log artifact
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: fuzz-log-${{ github.run_id }}-${{ github.run_attempt }}
path: artifacts/fuzz/fuzz-test.log
if-no-files-found: warn
retention-days: 14
- name: Notify via issue on unattended failure
if: steps.fuzz-status.outputs.failed == 'true' && github.event_name == 'schedule'
env:
GH_TOKEN: ${{ github.token }}
ISSUE_TITLE: "CI: Fuzz tests failing on main"
# The title this step used before the emoji rename. This step both
# writes a title and matches on it, so dropping the old value would
# orphan an issue an earlier run filed and start posting duplicates
# beside it. Matching both, and retitling what it finds, closes that
# window instead of relying on none existing at merge time.
LEGACY_ISSUE_TITLE: "🚨 CI: Fuzz tests failing on main"
RUN_URL: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
run: |
set -euo pipefail
api_headers=(
-H "Authorization: Bearer ${GH_TOKEN}"
-H "Accept: application/vnd.github+json"
)
issues_url="${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/issues?state=open&per_page=100"
open_issues="$(curl -fsSL "${api_headers[@]}" "${issues_url}")"
# Two single-purpose lookups rather than one filter held in a shell
# variable: a jq filter in a variable puts `$title` inside single
# quotes, which is SC2016 and makes a reader stop to check whether
# the non-expansion is deliberate.
existing_number="$(echo "${open_issues}" | jq -r --arg title "${ISSUE_TITLE}" '.[] | select(.title == $title and (.pull_request | not)) | .number' | head -n1)"
legacy_number="$(echo "${open_issues}" | jq -r --arg legacy "${LEGACY_ISSUE_TITLE}" '.[] | select(.title == $legacy and (.pull_request | not)) | .number' | head -n1)"
comment_body=$(
cat <<EOF
Fuzz job failed again.
- Workflow run: ${RUN_URL}
- Commit: \`${GITHUB_SHA}\`
- Ref: \`${GITHUB_REF}\`
- Log artifact: \`fuzz-log-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}\`
EOF
)
# Retitle a legacy-named issue in place, so the next run matches on
# the new title and this branch stops firing. Done before the comment
# so a failure here surfaces rather than being masked by a successful
# comment on a still-legacy title. If BOTH titles are somehow open,
# the new-named one is canonical and the legacy one is left alone
# rather than merged, since this step can't know which has the
# history worth keeping.
if [ -z "${existing_number}" ] && [ -n "${legacy_number}" ]; then
issue_url="${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/issues/${legacy_number}"
curl -fsSL -X PATCH "${api_headers[@]}" "${issue_url}" \
-d "$(jq -n --arg title "${ISSUE_TITLE}" '{title: $title}')" >/dev/null
existing_number="${legacy_number}"
fi
if [ -n "${existing_number}" ]; then
comment_url="${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/issues/${existing_number}/comments"
curl -fsSL -X POST "${api_headers[@]}" "${comment_url}" \
-d "$(jq -n --arg body "${comment_body}" '{body: $body}')" >/dev/null
exit 0
fi
issue_body=$(
cat <<EOF
Fuzz tests are failing on unattended runs.
- Latest failing run: ${RUN_URL}
- Commit: \`${GITHUB_SHA}\`
- Ref: \`${GITHUB_REF}\`
- Log artifact: \`fuzz-log-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}\`
Keep this issue open until fuzz is green again.
EOF
)
create_url="${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/issues"
curl -fsSL -X POST "${api_headers[@]}" "${create_url}" \
-d "$(jq -n --arg title "${ISSUE_TITLE}" --arg body "${issue_body}" '{title: $title, body: $body}')" >/dev/null
- name: Fail workflow on fuzz failure
if: steps.fuzz-status.outputs.failed == 'true'
run: exit 1
dependency-review:
name: "Security: Dependency Review"
if: github.event_name == 'pull_request' || (github.event_name == 'push' && github.ref == 'refs/heads/main')
runs-on: ubuntu-24.04
timeout-minutes: 10
permissions:
contents: read
pull-requests: read
steps:
- name: Harden Runner
uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1
with:
egress-policy: block
# api.deps.dev: dependency-review-action fetches changed-package
# metadata there, but only on PRs that actually change dependencies,
# so the gap stays invisible on dependency-neutral PRs.
allowed-endpoints: >
github.com:443
api.github.com:443
api.deps.dev:443
*.actions.githubusercontent.com:443
disable-sudo: true
- name: Checkout
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
with:
persist-credentials: false
- name: Dependency review
uses: actions/dependency-review-action@a1d282b36b6f3519aa1f3fc636f609c47dddb294 # v5.0.0
with:
base-ref: ${{ github.event_name == 'push' && github.event.before || '' }}
head-ref: ${{ github.event_name == 'push' && github.sha || '' }}
lint:
name: "Quality: Lint"
runs-on: ubuntu-24.04
timeout-minutes: 15
permissions:
contents: read
steps:
- name: Harden Runner
uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
with:
persist-credentials: false
- name: Setup Node
uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6.5.0
with:
node-version: 24
package-manager-cache: true
cache-dependency-path: |
package-lock.json
app/package-lock.json
ui/package-lock.json
- name: Install dependencies
run: npm ci
- name: Block new @ts-nocheck usage
run: node scripts/check-ts-nocheck-allowlist.mjs
- name: Biome check
run: npx biome check .
- name: Install app dependencies
uses: nick-fields/retry@ad984534de44a9489a53aefd81eb77f87c70dc60 # v4.0.0
with:
timeout_minutes: 3
max_attempts: 3
retry_wait_seconds: 30
command: cd app && npm ci
- name: Install ui dependencies
uses: nick-fields/retry@ad984534de44a9489a53aefd81eb77f87c70dc60 # v4.0.0
with:
timeout_minutes: 3
max_attempts: 3
retry_wait_seconds: 30
command: cd ui && npm ci
- name: Knip (app)
run: npm run knip
working-directory: app
- name: Knip (ui)
run: npm run knip
working-directory: ui
- name: Setup Qlty
uses: qltysh/qlty-action/install@08a0a862c159eae9b9003081da6663d96efef637 # v2.3.0
- name: Qlty check (all plugins, enforced)
run: ./scripts/qlty-check-gate.sh all
- name: Qlty smells report (advisory)
run: |
mkdir -p artifacts/qlty
node scripts/qlty-smells-gate.mjs \
--scope=all \
--sarif-output=artifacts/qlty/qlty-smells-all.sarif \
--summary-output=artifacts/qlty/qlty-smells-summary.md
- name: Upload Qlty smells report
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: qlty-smells-${{ github.run_id }}-${{ github.run_attempt }}
path: artifacts/qlty
if-no-files-found: warn
retention-days: 14
test:
name: "Quality: Test & Coverage"
runs-on: ubuntu-24.04
# The app and UI coverage shards plus the Codecov upload reached 19 to 20
# minutes on dev/v1.8 and the job was cancelled mid-upload twice (#1324).
timeout-minutes: 30
permissions:
contents: read
steps:
- name: Harden Runner
uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1
with:
egress-policy: block
allowed-endpoints: >
github.com:443
registry.npmjs.org:443
nodejs.org:443
cli.codecov.io:443
api.codecov.io:443
ingest.codecov.io:443
storage.googleapis.com:443
*.actions.githubusercontent.com:443
disable-sudo: true
- name: Checkout
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
with:
fetch-depth: 0
persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6.5.0
with:
node-version: 24
package-manager-cache: true
cache-dependency-path: |
package-lock.json
app/package-lock.json
apps/demo/package-lock.json
ui/package-lock.json
- name: Install repository dependencies
uses: nick-fields/retry@ad984534de44a9489a53aefd81eb77f87c70dc60 # v4.0.0
with:
timeout_minutes: 3
max_attempts: 3
retry_wait_seconds: 30
command: npm ci --ignore-scripts
- name: Run scripts tests
run: node --test scripts/*.test.mjs
- name: Install app dependencies
uses: nick-fields/retry@ad984534de44a9489a53aefd81eb77f87c70dc60 # v4.0.0
with:
timeout_minutes: 3
max_attempts: 3
retry_wait_seconds: 30
command: cd app && npm ci
- name: Run workflow tests
run: npm run test:workflows
- name: Install demo dependencies
uses: nick-fields/retry@ad984534de44a9489a53aefd81eb77f87c70dc60 # v4.0.0
with:
timeout_minutes: 3
max_attempts: 3
retry_wait_seconds: 30
command: cd apps/demo && npm ci --ignore-scripts
- name: Run demo contract and security tests
run: npm test
working-directory: apps/demo
- name: Install ui dependencies
uses: nick-fields/retry@ad984534de44a9489a53aefd81eb77f87c70dc60 # v4.0.0
with:
timeout_minutes: 3
max_attempts: 3
retry_wait_seconds: 30
command: cd ui && npm ci
- name: Run app tests
run: npm test
working-directory: app
- name: Typecheck ui
run: npm run typecheck
working-directory: ui
- name: Run ui tests
# CI-17: three runs on 2026-09-07 (plus #1102) had this step marked
# `cancelled` after 2.5-6 min with no timeout hit and no concurrency
# group -- the 7 GB ubuntu-latest runner most likely ran the vitest
# coverage pass out of memory and the runner service died, which
# GitHub reports as a cancel rather than an OOM. Budget: 1536 MiB
# heap cap * 2 processes (the main vitest process plus the single
# worker fork --maxWorkers=1 allows) = 3 GiB worst case, comfortably
# under the 7 GiB runner with headroom left for non-heap V8
# overhead, npm, and the OS.
env:
NODE_OPTIONS: --max-old-space-size=1536
run: |
# Emit bounded numeric resource evidence before an abrupt runner exit.
# No environment, command arguments or application data is collected.
node ../scripts/ci-resource-sampler.mjs "$$" &
resource_sampler_pid=$!
trap 'kill "$resource_sampler_pid" 2>/dev/null || true; wait "$resource_sampler_pid" 2>/dev/null || true' EXIT
npm run test:unit -- --maxWorkers=1
working-directory: ui
- name: Normalize coverage paths
# Rewrites lcov SF: paths to be repo-root-relative (app/…, ui/…) so
# Codecov resolves them against the checkout.
run: node scripts/prepare-codecov-reports.mjs
- name: Upload app coverage to Codecov
# Coverage upload moved from Qlty Cloud to Codecov (2026-08-16 house
# decision — see codeswhat-ops/standards/quality.md). The Qlty Cloud
# app, dashboard, and maintainability badge stay installed with
# non-gating checks; only the coverage-cloud upload path moves.
# Tokenless for public-repo PRs (including forks, which don't get
# secrets anyway); secrets.CODECOV_TOKEN is optional and covers
# private-context uploads. Advisory (continue-on-error plus
# fail_ci_if_error: false): an upload hiccup never blocks CI — the
# Vitest's configured coverage thresholds enforced in app/ui tests
# above are the real gate.
continue-on-error: true
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v6.0.2
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage/codecov-app.lcov.info
flags: app
fail_ci_if_error: false
- name: Upload ui coverage to Codecov
continue-on-error: true
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v6.0.2
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage/codecov-ui.lcov.info
flags: ui
fail_ci_if_error: false
web:
name: "Web: Site Build & Scripts Tests"
# apps/web ships via Vercel (separate from the Docker image), and Vercel only
# runs `next build` — never the node:test scripts suite. This job is that gate.
# Path-filtered: skips (→ counts as pass) on changesets that don't touch the
# site, so it never blocks backend-only PRs.
needs: [changes]
if: github.event_name == 'workflow_dispatch' || needs.changes.outputs.web == 'true' || (github.event_name == 'push' && github.ref == 'refs/heads/main')
runs-on: ubuntu-24.04
timeout-minutes: 15
permissions:
contents: read
steps:
- name: Harden Runner
uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1
with:
egress-policy: block
# fonts.googleapis.com + fonts.gstatic.com: next/font/google in
# apps/web/src/app/layout.tsx downloads IBM Plex at build time, but
# the web job only runs on web-path changes, so the gap stayed
# invisible on every non-web PR after the block-mode flip.
allowed-endpoints: >
github.com:443
registry.npmjs.org:443
nodejs.org:443
fonts.googleapis.com:443
fonts.gstatic.com:443
*.actions.githubusercontent.com:443
disable-sudo: true
- name: Checkout
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
with:
persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6.5.0
with:
node-version: 24
package-manager-cache: true
cache-dependency-path: apps/web/package-lock.json
- name: Install apps/web dependencies
uses: nick-fields/retry@ad984534de44a9489a53aefd81eb77f87c70dc60 # v4.0.0
with:
timeout_minutes: 3
max_attempts: 3
retry_wait_seconds: 30
command: cd apps/web && npm ci
- name: Run scripts tests
run: npm run test:scripts
working-directory: apps/web
- name: Typecheck
run: npx tsc --noEmit
working-directory: apps/web
- name: Build site (Next.js)
run: npm run build
working-directory: apps/web
build:
name: "Build"
needs: [lint, test]
runs-on: ubuntu-24.04
timeout-minutes: 35 # Includes UI build + single-arch QA image + multi-arch smoke build
permissions:
contents: read
steps:
- name: Harden Runner
uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
with:
persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6.5.0
with:
node-version: 24
package-manager-cache: true
cache-dependency-path: |
ui/package-lock.json
apps/demo/package-lock.json
- name: Install ui dependencies
uses: nick-fields/retry@ad984534de44a9489a53aefd81eb77f87c70dc60 # v4.0.0
with:
timeout_minutes: 3
max_attempts: 3
retry_wait_seconds: 30
command: cd ui && npm ci
- name: Build ui
run: npm run build
working-directory: ui
- name: Install demo dependencies
uses: nick-fields/retry@ad984534de44a9489a53aefd81eb77f87c70dc60 # v4.0.0
with:
timeout_minutes: 3
max_attempts: 3
retry_wait_seconds: 30
command: cd apps/demo && npm ci --ignore-scripts
- name: Build demo
run: npm run build
working-directory: apps/demo
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@37fe631027851001ddb9b187196cc803df7f5f0e # v4.3.0
# The multi-arch smoke build below cannot catch a base image pinned to a
# per-platform manifest digest: buildx resolves a digest identically for
# every --platform, so the arm64 stage builds green on an amd64 rootfs and
# the resulting image is x86-64 under an arm64 label (#1021). Check the
# pins on the PR that changes them.
- name: Verify base image pins are multi-arch indexes
uses: nick-fields/retry@ad984534de44a9489a53aefd81eb77f87c70dc60 # v4.0.0
with:
timeout_minutes: 3
max_attempts: 3
command: scripts/check-dockerfile-base-indexes.sh Dockerfile linux/amd64,linux/arm64
- name: Docker build (QA image + smoke test)
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0
with:
context: .
push: false
load: true
tags: drydock:dev
build-args: DD_VERSION=ci
# load: true uses the docker exporter, which can't accept the OCI
# manifest list produced by provenance attestations. The release-cut
# workflow keeps provenance because it actually pushes to registries.
provenance: false
cache-from: type=gha,scope=drydock
cache-to: type=gha,mode=max,scope=drydock,ignore-error=true
- name: Set up QEMU (multi-arch smoke build)
uses: docker/setup-qemu-action@96fe6ef7f33517b61c61be40b68a1882f3264fb8 # v4.2.0
# moby/buildkit#7089 (open, fix unmerged in #7092): ExecOp mutates its own
# Meta.Args in place to prepend the QEMU emulator path, so when the solver
# cancels an in-flight arm64 op and a later caller re-executes it, the
# emulator path gets prepended twice, QEMU tries to exec itself, and the
# build dies 0.078s in with "Invalid ELF image for this architecture"
# before apk or anything else has produced a line of output.
#
# It is a scheduler-timing race inside buildkit, not something this build
# config controls, and it is frequent rather than rare: three failures in
# six runs measured on 2026-08-29, roughly a coin flip. It is not tied to
# one RUN either. It hit `apk add` in the healthcheck stage once and
# `npm run build && npm prune` in a build stage the next time, which is
# what you would expect from a race on whichever op the solver happens to
# cancel and re-execute.
#
# Retrying the whole build is mechanism-agnostic, because each attempt is
# a fresh Solve() that reparses the LLB graph from the Dockerfile, so a
# mutated Meta.Args from a canceled attempt cannot carry over. Three
# attempts, not two: at an observed ~50% rate, two attempts still fail a
# quarter of the time, which is not a gate. The failure is also cheap to
# absorb, dying 0.083s into the RUN.
#
# The real fix is to stop emulating these stages at all. The build stages
# produce architecture-independent JavaScript, so they could run natively
# with `FROM --platform=$BUILDPLATFORM`, leaving only the healthcheck
# stage (which compiles C) genuinely per-target. That is a Dockerfile
# change with its own release risk and does not belong days before a cut.
# Tracked separately.
#
# Raw CLI rather than docker/build-push-action because nick-fields/retry
# wraps a shell command, not a `uses:` step. Safe here specifically
# because nothing downstream reads this step's outputs. Same idiom this
# job already uses for npm ci and the Playwright pull. Drop it once
# buildkit ships the fix.
- name: Docker build (multi-arch smoke)
uses: nick-fields/retry@ad984534de44a9489a53aefd81eb77f87c70dc60 # v4.0.0
with:
timeout_minutes: 10
max_attempts: 3
retry_wait_seconds: 5
# Smoke build never lands in a registry, so attesting it adds noise
# without value. Real attestations live on release-cut.yml.
command: |
docker buildx build . \
--platform linux/amd64,linux/arm64 \
--build-arg DD_VERSION=ci-multiarch-smoke \
--provenance=false \
--cache-from type=gha,scope=drydock \
--cache-to type=gha,mode=max,scope=drydock,ignore-error=true
- name: Export QA image artifact
run: |
mkdir -p artifacts/qa
docker save drydock:dev | gzip > artifacts/qa/drydock-dev-image.tar.gz
- name: Upload QA image artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: qa-image-${{ github.run_id }}
path: artifacts/qa/drydock-dev-image.tar.gz
if-no-files-found: error
retention-days: 1
grype-image:
name: "Security: Grype Image"
# security-grype.yml's own grype-image job only runs on workflow_dispatch
# and schedule, so the image every PR actually ships is never scanned
# pre-merge. This job closes that gap by scanning the same QA image
# `build` already produced instead of building a second time. Path-
# filtered like e2e/dast so it skips cleanly on docs-only PRs.
if: github.event_name == 'workflow_dispatch' || (github.event_name != 'schedule' && needs.changes.outputs.runtime == 'true')
needs: [build, changes]
runs-on: ubuntu-24.04
timeout-minutes: 15
permissions:
actions: read
contents: read
security-events: write
steps:
- name: Harden Runner
uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1
with:
egress-policy: block
# raw.githubusercontent.com: anchore/scan-action pulls its grype
# installer from there before get.anchore.io is ever consulted —
# blocking it fails the scan step with a bare ECONNREFUSED.
allowed-endpoints: >
github.com:443
api.github.com:443
raw.githubusercontent.com:443
get.anchore.io:443
grype.anchore.io:443
objects.githubusercontent.com:443
release-assets.githubusercontent.com:443
*.actions.githubusercontent.com:443
disable-sudo: true
- name: Checkout
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
with:
persist-credentials: false
- name: Download QA image artifact
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: qa-image-${{ github.run_id }}
path: artifacts/qa
- name: Load QA image
run: docker load < artifacts/qa/drydock-dev-image.tar.gz
- name: Run Grype vulnerability scanner
# Scans the exact image the PR built (drydock:dev, loaded from the
# build job's artifact) — the same severity gate as the periodic
# image scan, applied to what a merge would actually ship.
uses: anchore/scan-action@e1165082ffb1fe366ebaf02d8526e7c4989ea9d2 # v7.4.0
id: grype
env:
# Load the repo-root .grype.yaml explicitly — see security-grype.yml
# for why the bundled cosign/trivy vendored Go-module CVEs are triaged.
GRYPE_CONFIG: ${{ github.workspace }}/.grype.yaml
with:
image: drydock:dev
severity-cutoff: high
fail-build: true