Repository navigation
1208 lines (1063 loc) · 45.7 KB
/
Copy pathci.yml
File metadata and controls
1208 lines (1063 loc) · 45.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
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
permissions:
contents: read
on:
pull_request:
push:
branches:
- main
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
env:
CI_IS_FORK_PULL_REQUEST: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository }}
jobs:
pinned_dependency_policy:
name: Pinned Dependency Policy
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup pnpm
uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413
with:
version: 10.16.0
- name: Setup Node
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 24.22.1
cache: pnpm
- name: Install
run: pnpm install --frozen-lockfile
- name: Require exact direct dependency versions
run: node scripts/check-pinned-dependency-versions.mjs
translation_catalog_policy:
name: Translation Catalog Policy
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- name: Require source-only or translation-only catalog changes
env:
I18N_BASE_REF: origin/${{ github.base_ref }}
I18N_HEAD_BRANCH: ${{ github.head_ref }}
I18N_HEAD_REPOSITORY: ${{ github.event.pull_request.head.repo.full_name }}
I18N_BASE_REPOSITORY: ${{ github.repository }}
run: node .github/scripts/check-catalog-change-policy.mjs
migration_compat_policy:
name: Migration Compatibility Policy
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
# The PR's own tip, not the merge ref: a stack's merge ref also carries main commits the stack lacks.
ref: ${{ github.event.pull_request.head.sha }}
- name: Setup pnpm
uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86
with:
version: 10.16.0
- name: Setup Node
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 24.22.1
cache: pnpm
- name: Install
run: pnpm install --frozen-lockfile
- name: Require rollback-safe migrations
env:
# The parent branch tip: on a stacked PR, github.base_ref is the stack base.
MIGRATION_COMPAT_BASE_REF: ${{ github.event.pull_request.base.sha }}
run: pnpm check:migration-compat
module_boundaries:
name: Module Boundaries
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup pnpm
uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413
with:
version: 10.16.0
- name: Setup Node
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v6
with:
node-version: 24.22.1
- name: Check module boundaries
run: pnpm check:module-boundaries
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- name: Setup pnpm
uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413
with:
version: 10.16.0
- name: Setup Node
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 24.22.1
cache: pnpm
- name: Install
run: pnpm install --frozen-lockfile
- name: Lint
run: |
git diff --name-only --diff-filter=d -z origin/main...HEAD \
| xargs -0 --no-run-if-empty pnpm exec biome check --no-errors-on-unmatched
# Scripts sit outside every TypeScript program, and the diff-scoped lint above never re-reads
# one when the package it imports changes its exports, so these are linted in full every run.
- name: Lint script imports
run: |
git ls-files -z ':(glob)**/*.mjs' ':(glob)**/*.cjs' ':(glob)**/scripts/**' ':(glob).github/scripts/**' ':(exclude,glob)examples/**' \
| xargs -0 pnpm exec biome lint --no-errors-on-unmatched --diagnostic-level=error
# A package.json edit changes what every file in its workspace may import, and the
# diff-scoped lint re-reads only the manifest, so the dependency rule runs over all sources.
- name: Lint declared dependencies
run: pnpm exec biome lint --only=correctness/noUndeclaredDependencies --diagnostic-level=error apps packages
# Biome's noRestrictedImports does not read vi.mock-family strings or typeof import() type
# queries, and its options are replaced per override, so every copy must carry the ../ group.
- name: Check parent-relative imports
run: |
if git grep -nE "(vi\.(mock|doMock|unmock|importActual|importMock)|import)\(['\"]\.\./" -- ':(glob)apps/*/src/**' ':(glob)apps/*/scripts/**' ':(glob)packages/*/src/**' ':(exclude,glob)**/generated/**'; then exit 1; fi
jq -e '[.. | objects | .noRestrictedImports? | objects] | length == 5 and all(.options.patterns | any(.group | index("../**")))' biome.json
- name: Check pinned dependencies
run: pnpm check:pinned-dependencies
translation_agent:
name: Translation Agent
runs-on: ubuntu-latest
defaults:
run:
working-directory: agents/sdp-translation-agent
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup pnpm
uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413
with:
version: 10.16.0
- name: Setup Node
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 24.22.1
cache: pnpm
cache-dependency-path: agents/sdp-translation-agent/pnpm-lock.yaml
- name: Install
run: pnpm install --frozen-lockfile --ignore-workspace
- name: Typecheck and build
run: pnpm typecheck && pnpm build
typecheck:
name: Typecheck
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- name: Setup pnpm
uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413
with:
version: 10.16.0
- name: Setup Node
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 24.22.1
cache: pnpm
- name: Install
run: pnpm install --frozen-lockfile
- name: Detect changed packages
id: changed
run: |
PACKAGES=$(bash scripts/ci/changed-packages.sh)
echo "packages=${PACKAGES}" >> "$GITHUB_OUTPUT"
- name: Typecheck
if: steps.changed.outputs.packages != ''
env:
CHANGED_PACKAGES: ${{ steps.changed.outputs.packages }}
# "...{dir}" selects the changed package and every workspace package that depends on it,
# so a change confined to a shared package (say @sdp/ui) still typechecks its consumers.
run: |
FILTERS=""
for pkg in $CHANGED_PACKAGES; do
FILTERS="$FILTERS --filter ...{./$pkg}"
done
pnpm --if-present $FILTERS typecheck
unit_test_scope:
name: Unit Test Scope
runs-on: ubuntu-latest
outputs:
api: ${{ steps.detect.outputs.api }}
rest: ${{ steps.detect.outputs.rest }}
e2e: ${{ steps.detect.outputs.e2e }}
docker: ${{ steps.detect.outputs.docker }}
embedded_yield_example: ${{ steps.detect.outputs.embedded_yield_example }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- id: detect
env:
BASE_REF: ${{ github.base_ref }}
run: |
set -euo pipefail
if [ "${{ github.event_name }}" != "pull_request" ]; then
for scope in api rest e2e docker embedded_yield_example; do echo "${scope}=true" >> "$GITHUB_OUTPUT"; done
exit 0
fi
changed=$(git diff --name-only "origin/${BASE_REF}...HEAD")
printf '%s\n' "$changed"
detect() {
if printf '%s\n' "$changed" | grep -E "$2" >/dev/null; then
echo "$1=true" >> "$GITHUB_OUTPUT"
else
echo "$1=false" >> "$GITHUB_OUTPUT"
fi
}
detect api '^(apps/sdp-api/|packages/|package\.json|\.npmrc|pnpm-lock\.yaml|pnpm-workspace\.yaml|patches/|turbo\.json|scripts/run-workspace-tests\.mjs|scripts/doppler/|\.github/workflows/ci\.yml)'
detect rest '^(apps/|packages/|package\.json|\.npmrc|pnpm-lock\.yaml|pnpm-workspace\.yaml|patches/|turbo\.json|scripts/|\.github/workflows/ci\.yml)'
detect e2e '^(apps/sdp-api/|apps/sdp-web/|packages/|package\.json|\.npmrc|pnpm-lock\.yaml|pnpm-workspace\.yaml|patches/|turbo\.json|scripts/|\.github/workflows/ci\.yml)'
detect docker '^(apps/|packages/|package\.json|\.npmrc|tsconfig\.json|pnpm-lock\.yaml|pnpm-workspace\.yaml|patches/|scripts/docker/|docker-compose(\.ci)?\.yml|\.dockerignore|\.github/workflows/ci\.yml)'
detect embedded_yield_example '^(examples/embedded-yield-bank/|\.github/workflows/ci\.yml)'
test:
name: Unit Tests (api ${{ matrix.shard }}/8)
needs: unit_test_scope
if: needs.unit_test_scope.outputs.api == 'true'
runs-on: ubuntu-latest
timeout-minutes: 20
permissions:
contents: read
id-token: write
strategy:
fail-fast: false
matrix:
shard: [1, 2, 3, 4, 5, 6, 7, 8]
env:
TURBO_CACHE_DIR: ${{ github.workspace }}/.turbo-ci-cache
CI_HAS_DOPPLER_TOKEN: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }}
TEST_WORKSPACE_SPLIT: api
TEST_CHANGED_SINCE: ${{ github.event_name == 'pull_request' && format('origin/{0}', github.base_ref) || '' }}
TEST_SHARD: ${{ matrix.shard }}/8
DOPPLER_PRESERVE_ENV: TEST_CHANGED_SINCE,TEST_WORKSPACE_SPLIT,TEST_SHARD
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- name: Setup pnpm
uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413
with:
version: 10.16.0
- name: Setup Node
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 24.22.1
cache: pnpm
- name: Restore turbo cache
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: .turbo-ci-cache
key: turbo-${{ github.job }}-shard${{ matrix.shard }}-${{ runner.os }}-${{ github.sha }}
restore-keys: |
turbo-${{ github.job }}-shard${{ matrix.shard }}-${{ runner.os }}-
- name: Install
run: pnpm install --frozen-lockfile
- name: Validate Doppler OIDC configuration
if: env.CI_IS_FORK_PULL_REQUEST != 'true'
run: |
if [ -z "${{ vars.DOPPLER_CI_IDENTITY_ID }}" ]; then
echo "DOPPLER_CI_IDENTITY_ID must be configured as a repository variable for secret-aware CI jobs." >&2
exit 1
fi
- name: Install Doppler CLI
if: env.CI_HAS_DOPPLER_TOKEN == 'true'
uses: dopplerhq/cli-action@4819d808ab99e5cde19a0637a16536a4038fad73 # v4.0.1
- name: Doppler OIDC login
if: env.CI_HAS_DOPPLER_TOKEN == 'true'
run: scripts/doppler/oidc-login.sh "${{ vars.DOPPLER_CI_IDENTITY_ID }}"
- name: Unit tests (Doppler)
if: env.CI_HAS_DOPPLER_TOKEN == 'true'
env:
DOPPLER_CONFIG: dev_ci
run: pnpm test
- name: Save turbo cache
if: github.ref == 'refs/heads/main'
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: .turbo-ci-cache
key: turbo-${{ github.job }}-shard${{ matrix.shard }}-${{ runner.os }}-${{ github.sha }}
- name: Unit tests (fork-safe)
if: env.CI_IS_FORK_PULL_REQUEST == 'true' && env.CI_HAS_DOPPLER_TOKEN != 'true'
run: |
echo "::notice title=Fork-safe unit tests::Doppler OIDC authentication is unavailable to forked pull requests, so unit tests are running with local defaults instead of Doppler dev_ci secrets."
node scripts/run-workspace-tests.mjs unit
- name: Upload vitest shard artifacts
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.0
with:
name: vitest-api-shard-${{ matrix.shard }}
path: apps/sdp-api/.vitest-reports/blob-${{ matrix.shard }}-8.json
# A rerun of failed shards must replace the first attempt's blob, or the
# merge step below keeps re-reporting failures the rerun already fixed.
overwrite: true
include-hidden-files: true
if-no-files-found: error
test_merge:
name: Unit Tests
needs: [unit_test_scope, test]
if: always() && needs.unit_test_scope.outputs.api == 'true'
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Report shard results
env:
SHARD_RESULT: ${{ needs.test.result }}
run: |
if [ "${SHARD_RESULT}" != "success" ]; then
echo "One or more Unit Tests (api) shards finished with ${SHARD_RESULT}." >&2
exit 1
fi
echo "All Unit Tests (api) shards passed."
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup pnpm
uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413
with:
version: 10.16.0
- name: Setup Node
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 24.22.1
cache: pnpm
- name: Install
run: pnpm install --frozen-lockfile
- name: Download shard artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
pattern: vitest-api-shard-*
path: shard-artifacts
- name: Verify and assemble shard blobs
run: |
set -euo pipefail
mkdir -p apps/sdp-api/.vitest-reports
for shard in 1 2 3 4 5 6 7 8; do
blob="shard-artifacts/vitest-api-shard-${shard}/blob-${shard}-8.json"
if [ ! -f "${blob}" ]; then
echo "Missing blob report for shard ${shard} (expected ${blob})." >&2
exit 1
fi
cp "${blob}" apps/sdp-api/.vitest-reports/
done
echo "Assembled $(find apps/sdp-api/.vitest-reports -type f | wc -l | tr -d ' ') blob files."
- name: Merge coverage and enforce thresholds
working-directory: apps/sdp-api
run: pnpm exec vitest run --merge-reports --coverage
test_embedded_yield_example:
name: Unit Tests (embedded-yield-bank)
needs: unit_test_scope
if: needs.unit_test_scope.outputs.embedded_yield_example == 'true'
runs-on: ubuntu-latest
timeout-minutes: 10
defaults:
run:
working-directory: examples/embedded-yield-bank
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup pnpm
uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413
with:
version: 10.16.0
- name: Setup Node
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 24.22.1
cache: pnpm
cache-dependency-path: examples/embedded-yield-bank/pnpm-lock.yaml
- name: Install
run: pnpm install --frozen-lockfile
- name: Test
run: pnpm test
test_packages:
name: Unit Tests (packages)
needs: unit_test_scope
if: needs.unit_test_scope.outputs.rest == 'true'
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: read
id-token: write
env:
TURBO_CACHE_DIR: ${{ github.workspace }}/.turbo-ci-cache
CI_HAS_DOPPLER_TOKEN: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }}
TEST_WORKSPACE_SPLIT: rest
TEST_CHANGED_SINCE: ${{ github.event_name == 'pull_request' && format('origin/{0}', github.base_ref) || '' }}
DOPPLER_PRESERVE_ENV: TEST_CHANGED_SINCE,TEST_WORKSPACE_SPLIT
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- name: Setup pnpm
uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413
with:
version: 10.16.0
- name: Setup Node
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 24.22.1
cache: pnpm
- name: Restore turbo cache
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: .turbo-ci-cache
key: turbo-${{ github.job }}-${{ runner.os }}-${{ github.sha }}
restore-keys: |
turbo-${{ github.job }}-${{ runner.os }}-
- name: Install
id: install
run: pnpm install --frozen-lockfile
- name: Validate Doppler OIDC configuration
if: env.CI_IS_FORK_PULL_REQUEST != 'true'
run: |
if [ -z "${{ vars.DOPPLER_CI_IDENTITY_ID }}" ]; then
echo "DOPPLER_CI_IDENTITY_ID must be configured as a repository variable for secret-aware CI jobs." >&2
exit 1
fi
- name: Install Doppler CLI
if: env.CI_HAS_DOPPLER_TOKEN == 'true'
uses: dopplerhq/cli-action@4819d808ab99e5cde19a0637a16536a4038fad73 # v4.0.1
- name: Doppler OIDC login
if: env.CI_HAS_DOPPLER_TOKEN == 'true'
run: |
doppler logout --scope=. --yes >/dev/null 2>&1 || true
scripts/doppler/oidc-login.sh "${{ vars.DOPPLER_CI_IDENTITY_ID }}"
doppler me >/dev/null
- name: Unit tests (Doppler)
if: env.CI_HAS_DOPPLER_TOKEN == 'true'
env:
DOPPLER_CONFIG: dev_ci
run: pnpm test
- name: Save turbo cache
if: github.ref == 'refs/heads/main'
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: .turbo-ci-cache
key: turbo-${{ github.job }}-${{ runner.os }}-${{ github.sha }}
- name: Unit tests (fork-safe)
if: env.CI_IS_FORK_PULL_REQUEST == 'true' && env.CI_HAS_DOPPLER_TOKEN != 'true'
run: |
echo "::notice title=Fork-safe unit tests::Doppler OIDC authentication is unavailable to forked pull requests, so unit tests are running with local defaults instead of Doppler dev_ci secrets."
node scripts/run-workspace-tests.mjs unit
- name: Scripts tests
run: pnpm test:scripts
# Runs here rather than in the Module Boundaries job because it parses
# TypeScript with the compiler's own parser, and that job installs no
# dependencies.
- name: Check SecretRef serialization
run: pnpm check:secretref-serialization
- name: Check UI flow matrix
run: pnpm check:ui-flow-coverage
# Pins the constructors that turn a stored secret into signing authority
# to the custody signer and sponsorship waists, where money admission is
# enforced (HOO-1955). Needs the TypeScript checker, so it runs where
# dependencies are installed. It runs whenever the install succeeded, so
# it and the unit tests each report whatever the other did.
- name: Check value movement
if: ${{ !cancelled() && steps.install.outcome == 'success' }}
run: pnpm check:value-movement
build_api:
name: Build API
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- name: Setup pnpm
uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413
with:
version: 10.16.0
- name: Setup Node
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 24.22.1
cache: pnpm
- name: Install
run: pnpm install --frozen-lockfile
- name: Build API (Node bundle)
run: pnpm --filter ./apps/sdp-api build
docker_build_api:
name: Docker Build API
needs: unit_test_scope
if: needs.unit_test_scope.outputs.docker == 'true'
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@37fe631027851001ddb9b187196cc803df7f5f0e # v4.3.0
- name: Build sdp-api image (no push)
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0
with:
context: .
file: apps/sdp-api/Dockerfile
push: false
load: false
provenance: false
sbom: false
tags: sdp-api:ci-${{ github.sha }}
build-args: |
GIT_SHA=${{ github.sha }}
cache-from: type=gha,scope=sdp-api
cache-to: type=gha,scope=sdp-api,mode=max
docker_build_docs:
name: Docker Build Docs
needs: unit_test_scope
if: needs.unit_test_scope.outputs.docker == 'true'
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@37fe631027851001ddb9b187196cc803df7f5f0e # v4.3.0
- name: Build sdp-docs image (no push)
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0
with:
context: .
file: apps/sdp-docs/Dockerfile
push: false
load: false
provenance: false
sbom: false
tags: sdp-docs:ci-${{ github.sha }}
build-args: |
GIT_SHA=${{ github.sha }}
cache-from: type=gha,scope=sdp-docs
cache-to: type=gha,scope=sdp-docs,mode=max
docker_build_web:
name: Docker Build Web
needs: unit_test_scope
if: needs.unit_test_scope.outputs.docker == 'true'
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@37fe631027851001ddb9b187196cc803df7f5f0e # v4.3.0
- name: Build sdp-web image (no push)
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0
with:
context: .
file: apps/sdp-web/Dockerfile
push: false
load: false
provenance: false
sbom: false
tags: sdp-web:ci-${{ github.sha }}
build-args: |
GIT_SHA=${{ github.sha }}
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_c21va2UubG9jYWwuY2xlcmsuZGV2JA
NEXT_PUBLIC_SDP_API_BASE_URL=http://localhost:8787
cache-from: type=gha,scope=sdp-web
cache-to: type=gha,scope=sdp-web,mode=max
docker_compose_smoke:
name: Docker Compose Smoke
needs: unit_test_scope
if: needs.unit_test_scope.outputs.docker == 'true'
runs-on: ubuntu-latest
timeout-minutes: 25
env:
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY: pk_test_c21va2UubG9jYWwuY2xlcmsuZGV2JA
CLERK_SECRET_KEY: sk_test_dummy_smoke_for_ci_only
API_KEY_PEPPER: ci-compose-smoke-pepper-not-a-secret
COMPOSE_FILE: docker-compose.yml:docker-compose.ci.yml
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@37fe631027851001ddb9b187196cc803df7f5f0e # v4.3.0
- name: Expose GitHub Actions cache to BuildKit
uses: crazy-max/ghaction-github-runtime@04d248b84655b509d8c44dc1d6f990c879747487 # v4.0.0
- name: Build compose stack
run: docker compose build
- name: Bring up stack and wait for healthy
run: docker compose up -d --wait --wait-timeout 240
- name: Dump compose state
if: always()
run: |
docker compose ps
docker compose logs --no-color --tail=200
- name: Tear down
if: always()
run: docker compose down --volumes --remove-orphans
build_docs:
name: Build Docs
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- name: Setup pnpm
uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413
with:
version: 10.16.0
- name: Setup Node
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 24.22.1
cache: pnpm
- name: Install
run: pnpm install --frozen-lockfile
- name: Env configurator drift check
run: node scripts/check-env-configurator-drift.mjs
- name: Configurator unit tests
run: pnpm --filter @sdp/env-config test
- name: Build docs
run: pnpm --filter sdp-docs build
docs_integrity:
name: Docs Integrity
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- name: Setup pnpm
uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413
with:
version: 10.16.0
- name: Setup Node
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 24.22.1
cache: pnpm
- name: Install
run: pnpm install --frozen-lockfile
- name: Generate public docs artifacts
run: |
pnpm --filter sdp-docs generate:api
pnpm --filter sdp-docs generate:ai
- name: Committed docs artifacts match generated output
run: git diff --exit-code apps/sdp-docs/public apps/sdp-docs/src/generated
- name: Docs release-channel tests
run: pnpm --filter sdp-docs test
- name: Check docs links (experimental)
run: pnpm --filter sdp-docs check:links
# Production runs stable: its pages must never link to a page or API
# reference family the stable build leaves out.
- name: Check docs links (stable)
env:
SDP_RELEASE_CHANNEL: stable
run: |
pnpm --filter sdp-docs generate:api
pnpm --filter sdp-docs check:links
integration_tests_shard:
name: Integration Tests (${{ matrix.name }})
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
include:
- name: Kora / Live Smoke
provider: kora
test_files: src/tests/kora.test.ts src/tests/kora-flow.test.ts src/tests/kora-earn-sponsorship.test.ts src/tests/private-channels.test.ts src/tests/private-channels-deposit.test.ts
rpc_provider: alchemy
custody_provider: privy
- name: Surfpool / Issuance Core
provider: surfpool
test_files: src/tests/issuance-crud.test.ts src/tests/mosaic-custom-mint.test.ts src/tests/dvp-settlement.test.ts
rpc_provider: quicknode
custody_provider: local
- name: Surfpool / Issuance Prepare
provider: surfpool
test_files: src/tests/issuance-prepare.test.ts
rpc_provider: quicknode
custody_provider: local
- name: Surfpool / Issuance Execute
provider: surfpool
test_files: src/tests/issuance-execute.test.ts
rpc_provider: alchemy
custody_provider: local
- name: Surfpool / Mosaic
provider: surfpool
test_files: src/tests/mosaic-token-acl.test.ts src/tests/mosaic-token-acl-constraints.test.ts src/tests/mosaic-abl.test.ts src/tests/mosaic-templates.test.ts
rpc_provider: quicknode
custody_provider: local
- name: Surfpool / Token Flows
provider: surfpool
test_files: src/tests/deploy.test.ts src/tests/mint.test.ts src/tests/burn.test.ts src/tests/freeze.test.ts
rpc_provider: quicknode
custody_provider: local
- name: Surfpool / Access
provider: surfpool
test_files: src/tests/payments-wallet-scope.test.ts src/tests/api-keys-flow.test.ts src/tests/api-keys-rotation.test.ts src/tests/custody-local.test.ts src/tests/kora-surfpool-shim.test.ts
rpc_provider: alchemy
custody_provider: local
- name: Surfpool / Recurring Payments
provider: surfpool
test_files: src/tests/recurring-payments-authority-revocation.test.ts
rpc_provider: alchemy
custody_provider: local
- name: Surfpool / Token and Payment Flows (Kora)
provider: surfpool
kora_mode: docker
test_files: src/tests/deploy.test.ts src/tests/mint.test.ts src/tests/burn.test.ts src/tests/freeze.test.ts src/tests/transfer-batches.test.ts
rpc_provider: alchemy
custody_provider: local
env:
CI_HAS_DOPPLER_TOKEN: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }}
TEST_DATABASE_URL: postgresql://sdp:sdp@127.0.0.1:5432/sdp_test
REDIS_URL: redis://127.0.0.1:6379
DOPPLER_PRESERVE_ENV: TEST_DATABASE_URL,REDIS_URL,SOLANA_NETWORK,KORA_SURFPOOL_MODE
SOLANA_NETWORK: devnet
INTEGRATION_SHARD_NAME: ${{ matrix.name }}
INTEGRATION_TEST_FILES: ${{ matrix.test_files }}
SOLANA_RPC_CI_PREFERRED_PROVIDER: ${{ matrix.rpc_provider }}
SDP_INTEGRATION_CUSTODY_PROVIDER: ${{ matrix.custody_provider }}
KORA_SURFPOOL_MODE: ${{ matrix.kora_mode || 'shim' }}
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_DB: sdp
POSTGRES_USER: sdp
POSTGRES_PASSWORD: sdp
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U sdp -d sdp"
--health-interval 5s
--health-timeout 5s
--health-retries 20
redis:
image: redis:7-alpine
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 5s
--health-timeout 5s
--health-retries 20
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- name: Setup pnpm
uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413
with:
version: 10.16.0
- name: Setup Node
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 24.22.1
cache: pnpm
- name: Install
run: pnpm install --frozen-lockfile
- name: Validate Doppler OIDC configuration
if: matrix.provider == 'kora' && env.CI_IS_FORK_PULL_REQUEST != 'true'
run: |
if [ -z "${{ vars.DOPPLER_CI_IDENTITY_ID }}" ]; then
echo "DOPPLER_CI_IDENTITY_ID must be configured as a repository variable for secret-aware CI jobs." >&2
exit 1
fi
- name: Install Doppler CLI
if: env.CI_HAS_DOPPLER_TOKEN == 'true'
uses: dopplerhq/cli-action@4819d808ab99e5cde19a0637a16536a4038fad73 # v4.0.1
- name: Doppler OIDC login
if: env.CI_HAS_DOPPLER_TOKEN == 'true'
run: |
doppler logout --scope=. --yes >/dev/null 2>&1 || true
scripts/doppler/oidc-login.sh "${{ vars.DOPPLER_CI_IDENTITY_ID }}"
doppler me >/dev/null
- name: Validate integration runtime secrets
if: matrix.provider == 'kora' && env.CI_HAS_DOPPLER_TOKEN == 'true'
run: |
doppler run --config dev_ci -- bash <<'EOF'
set -euo pipefail
if [ -z "${KORA_DEVNET_URL:-}" ]; then
echo "KORA_DEVNET_URL must be set in the dev_ci Doppler config for integration tests." >&2
exit 1
fi
if [ -z "${PRIVY_APP_ID:-}" ] || [ -z "${PRIVY_APP_SECRET:-}" ]; then
echo "PRIVY_APP_ID and PRIVY_APP_SECRET must be set in the dev_ci Doppler config for integration tests." >&2
exit 1
fi
EOF
- name: Surfpool integration tests
if: matrix.provider == 'surfpool'
env:
DOPPLER_CONFIG: dev_ci
DOPPLER_PRESERVE_ENV: TEST_DATABASE_URL,REDIS_URL,SOLANA_NETWORK,KORA_SURFPOOL_MODE
SDP_INTEGRATION_CUSTODY_PROVIDER: ${{ matrix.custody_provider }}
run: |
read -r -a test_files <<< "${INTEGRATION_TEST_FILES}"
if [ "${CI_HAS_DOPPLER_TOKEN}" = "true" ]; then
scripts/doppler/run-with-config.sh pnpm kora:surfpool:integration -- "${test_files[@]}"
elif [ "${CI_IS_FORK_PULL_REQUEST}" = "true" ]; then
echo "::notice title=Fork-safe Surfpool integration skip::Forked pull requests cannot access managed Solana RPC secrets, so this Surfpool shard is skipped."
else
echo "Doppler OIDC authentication is required for Surfpool integration shards." >&2
exit 1
fi
- name: Live Kora integration tests
if: matrix.provider == 'kora' && env.CI_HAS_DOPPLER_TOKEN == 'true'
env:
DOPPLER_CONFIG: dev_ci
run: |
read -r -a test_files <<< "${INTEGRATION_TEST_FILES}"
pnpm test:integration -- "${test_files[@]}"
- name: Skip secret-backed integration tests for fork
if: matrix.provider == 'kora' && env.CI_IS_FORK_PULL_REQUEST == 'true' && env.CI_HAS_DOPPLER_TOKEN != 'true'
run: |
echo "::notice title=Fork-safe integration skip::Forked pull requests cannot authenticate to Doppler via OIDC, so Kora/Privy-backed integration tests are skipped. Run this PR from an upstream branch before merge if secret-backed coverage is required."
integration_tests:
name: Integration Tests (Surfpool/Kora)
runs-on: ubuntu-latest
needs:
- integration_tests_shard
if: always()
timeout-minutes: 5
env:
CI_HAS_DOPPLER_TOKEN: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }}
steps:
- name: Check integration test results
env:
INTEGRATION_SHARD_RESULT: ${{ needs.integration_tests_shard.result }}
run: |
if [ "${CI_IS_FORK_PULL_REQUEST}" = "true" ] && [ "${CI_HAS_DOPPLER_TOKEN}" != "true" ] && [ "${INTEGRATION_SHARD_RESULT}" = "success" ]; then
echo "::notice title=Fork-safe integration skip::Forked pull requests cannot authenticate to Doppler via OIDC, so the secret-backed integration matrix was intentionally skipped."
exit 0
fi
if [ "${CI_HAS_DOPPLER_TOKEN}" != "true" ]; then
echo "Secret-backed integration shards did not run outside a fork pull request." >&2
exit 1
fi
if [ "${INTEGRATION_SHARD_RESULT}" != "success" ]; then
echo "One or more integration shards finished with ${INTEGRATION_SHARD_RESULT}." >&2
exit 1
fi
echo "All integration shards passed."
browser_e2e:
name: ${{ matrix.name }}
needs: unit_test_scope
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
include:
- name: Dashboard E2E (Surfpool Local)