-
Notifications
You must be signed in to change notification settings - Fork 1
1285 lines (1129 loc) · 46.4 KB
/
Copy pathci.yml
File metadata and controls
1285 lines (1129 loc) · 46.4 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
on:
push:
branches: ["main"]
pull_request:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions:
contents: read
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
jobs:
# ── Triage ───────────────────────────────────────────────────────────
# Runs the checked-in classifier (scripts/ci/classify-changes.mjs) to
# determine which jobs should run for this change set. The classifier is
# a pure function over filenames and event type — it is the single source
# of truth for path-based CI gating.
#
# Outputs:
# expected-jobs JSON array of job IDs that must run
# run_<job> "true"/"false" per job ID, consumed by `if:` conditions
# unknown "true" if any file is unmapped
# unknown-files JSON array of unmapped filenames
# categories JSON array of detected categories
#
# PR and main push: path-aware jobs via classify-changes.mjs.
# workflow_dispatch: full CI (manual force). Full multi-platform and
# accessibility matrices run on Nightly; Release owns signed packages and
# Windows #284 core. See docs/CI_LAYERS.md.
triage:
name: Triage
runs-on: ubuntu-24.04
timeout-minutes: 5
permissions:
contents: read
pull-requests: write # labeler needs this to add/remove labels
outputs:
expected-jobs: ${{ steps.classify.outputs.expected-jobs }}
expected-skipped-heavy: ${{ steps.classify.outputs.expected-skipped-heavy }}
unknown: ${{ steps.classify.outputs.unknown }}
unknown-files: ${{ steps.classify.outputs.unknown-files }}
categories: ${{ steps.classify.outputs.categories }}
run_triage: ${{ steps.classify.outputs.run_triage }}
run_conventional-commits: ${{ steps.classify.outputs.run_conventional-commits }}
run_standards-reference: ${{ steps.classify.outputs.run_standards-reference }}
run_ci-gate: ${{ steps.classify.outputs.run_ci-gate }}
run_js-quality: ${{ steps.classify.outputs.run_js-quality }}
run_app-frontend: ${{ steps.classify.outputs.run_app-frontend }}
run_website: ${{ steps.classify.outputs.run_website }}
run_playwright-ui-smoke: ${{ steps.classify.outputs.run_playwright-ui-smoke }}
run_workflow-lint: ${{ steps.classify.outputs.run_workflow-lint }}
run_release-validation: ${{ steps.classify.outputs.run_release-validation }}
run_cargo-deny: ${{ steps.classify.outputs.run_cargo-deny }}
run_dependency-checks: ${{ steps.classify.outputs.run_dependency-checks }}
run_prepare-model: ${{ steps.classify.outputs.run_prepare-model }}
run_rust-test: ${{ steps.classify.outputs.run_rust-test }}
run_rust-test-windows-compile: ${{ steps.classify.outputs.run_rust-test-windows-compile }}
run_tauri-build-smoke: ${{ steps.classify.outputs.run_tauri-build-smoke }}
run_tauri-build: ${{ steps.classify.outputs.run_tauri-build }}
steps:
# paths-filter uses the GitHub API for PR events (no checkout needed);
# for push events it diffs via git, so checkout is required.
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Label PR by changed paths
# Only label same-repo PRs — fork PRs get a read-only GITHUB_TOKEN
# and the labeling API call 403s. Labeling is cosmetic (human
# triage aid); path detection below is what gates jobs.
uses: actions/labeler@bf12e9b00b37c5c0ca2b87b79b2daf7891dbda13 # v7.0.0
if: >
github.event_name == 'pull_request' &&
github.event.pull_request.head.repo.full_name == github.repository
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
sync-labels: true
- name: Collect changed files
id: collect
env:
GH_TOKEN: ${{ github.token }}
EVENT_NAME: ${{ github.event_name }}
PR_NUMBER: ${{ github.event.pull_request.number }}
BEFORE: ${{ github.event.before }}
AFTER: ${{ github.event.after }}
run: |
set -euo pipefail
if [ "$EVENT_NAME" = "pull_request" ]; then
# Use the GitHub API with pagination to get the complete file list.
gh api --paginate --jq '.[].filename' \
"repos/${GITHUB_REPOSITORY}/pulls/${PR_NUMBER}/files" \
> changed-files.txt
elif [ "$EVENT_NAME" = "push" ]; then
# Fetch BEFORE so we can diff locally. The GitHub compare/commit
# APIs cap their `files` arrays at 300 entries, which would
# silently drop changed paths; a local git diff has no such
# limit. The checkout is shallow (fetch-depth: 1) so BEFORE is
# not in local history until we fetch it.
if [ "$BEFORE" = "0000000000000000000000000000000000000000" ]; then
# New branch — deepen by one to get the parent of AFTER.
git fetch --no-tags --deepen=1 origin
if git rev-parse --verify HEAD~1 >/dev/null 2>&1; then
git diff --name-only HEAD~1..HEAD > changed-files.txt
else
# Initial commit (no parent) — list all tracked files.
git ls-tree -r --name-only HEAD > changed-files.txt
fi
else
git fetch --no-tags --depth=1 origin "$BEFORE"
git diff --name-only "$BEFORE".."$AFTER" > changed-files.txt
fi
else
# workflow_dispatch — no changed files; classifier returns full CI.
: > changed-files.txt
fi
echo "count=$(wc -l < changed-files.txt | tr -d ' ')" >> "$GITHUB_OUTPUT"
- name: Classify changes
id: classify
env:
EVENT_NAME: ${{ github.event_name }}
run: |
set -euo pipefail
node scripts/ci/classify-changes.mjs \
--files "$(cat changed-files.txt)" \
--event "$EVENT_NAME" \
> classification.json
# Extract outputs for GITHUB_OUTPUT.
jq -r '
"expected-jobs=\(.expectedJobs | @json)",
"expected-skipped-heavy=\(.expectedSkippedHeavyJobs | @json)",
"unknown=\(if .unknownFiles | length > 0 then "true" else "false" end)",
"unknown-files=\(.unknownFiles | @json)",
"categories=\(.categories | @json)"
' classification.json >> "$GITHUB_OUTPUT"
# Per-job run_ booleans.
jq -r '.run | to_entries[] | "run_\(.key)=\(.value)"' \
classification.json >> "$GITHUB_OUTPUT"
# Print classification to the step summary.
{
echo "## CI Triage"
echo ""
echo "**Event:** \`${EVENT_NAME}\`"
echo ""
echo "### Changed files"
echo ""
if [ -s changed-files.txt ]; then
while IFS= read -r file; do
cats=$(jq -r --arg f "$file" \
'.categoriesByFile[$f] // ["unknown"] | join(", ")' \
classification.json)
echo "- \`${file}\` → ${cats}"
done < changed-files.txt
else
echo "- _(none — full CI by event type)_"
fi
echo ""
echo "### Expected jobs"
echo ""
jq -r '.expectedJobs[] | "- \(.)"' classification.json
echo ""
echo "### Expected skipped heavy jobs"
echo ""
skipped=$(jq -r '.expectedSkippedHeavyJobs | length' classification.json)
if [ "$skipped" -gt 0 ]; then
jq -r '.expectedSkippedHeavyJobs[] | "- \(.)"' classification.json
else
echo "- _(none)_"
fi
if [ "$(jq '.unknownFiles | length' classification.json)" -gt 0 ]; then
echo ""
echo "### ⚠️ Unknown files (full CI safety fallback)"
echo ""
jq -r '.unknownFiles[] | "- `\(.)`"' classification.json
fi
} >> "$GITHUB_STEP_SUMMARY"
prepare-model:
name: Prepare separation model
needs: triage
if: |
!cancelled() &&
needs.triage.outputs.run_prepare-model == 'true'
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 24
package-manager-cache: false
# Model identity comes from the pinned catalog snapshot
# (src-tauri/catalog/release-manifest.json) via the same resolver
# setup.sh uses, so CI, local setup, and the app share one contract.
- name: Resolve separation model from catalog snapshot
id: model
run: |
{
echo "url=$(node scripts/resolve-model.mjs --field url)"
echo "sha256=$(node scripts/resolve-model.mjs --field sha256)"
echo "file=$(node scripts/resolve-model.mjs --field filename)"
echo "file_sha256=$(node scripts/resolve-model.mjs --field file_sha256)"
echo "archived=$(node scripts/resolve-model.mjs --field archived)"
} >> "$GITHUB_OUTPUT"
- name: Restore separation model cache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: src-tauri/models/${{ steps.model.outputs.file }}
key: separation-model-${{ steps.model.outputs.file_sha256 }}
enableCrossOsArchive: true
- name: Download and verify separation model
env:
MODEL_URL: ${{ steps.model.outputs.url }}
DOWNLOAD_SHA256: ${{ steps.model.outputs.sha256 }}
MODEL_FILE: ${{ steps.model.outputs.file }}
MODEL_FILE_SHA256: ${{ steps.model.outputs.file_sha256 }}
MODEL_ARCHIVED: ${{ steps.model.outputs.archived }}
run: |
if echo "$MODEL_FILE_SHA256 src-tauri/models/$MODEL_FILE" | sha256sum -c --status 2>/dev/null; then
echo "Model already present and verified"
exit 0
fi
mkdir -p src-tauri/models
curl -L --fail "$MODEL_URL" -o /tmp/model-download
echo "$DOWNLOAD_SHA256 /tmp/model-download" | sha256sum -c
if [ "$MODEL_ARCHIVED" = "true" ]; then
tar -xzf /tmp/model-download -C src-tauri/models "$MODEL_FILE"
else
mv /tmp/model-download "src-tauri/models/$MODEL_FILE"
fi
echo "$MODEL_FILE_SHA256 src-tauri/models/$MODEL_FILE" | sha256sum -c
- name: Upload separation model
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: separation-model
path: src-tauri/models/${{ steps.model.outputs.file }}
if-no-files-found: error
retention-days: 1
conventional-commits:
name: Conventional commits
if: github.event_name == 'pull_request'
runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- name: Enforce conventional PR title
uses: amannn/action-semantic-pull-request@48f256284bd46cdaab1048c3721360e808335d50 # v6.1.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# ── Standards reference ─────────────────────────────────────────────
# Validates the mandatory AGENTS.md → index → profile route without
# running a full application build for a documentation-only change.
standards-reference:
name: Standards reference
needs: triage
if: |
!cancelled() &&
needs.triage.outputs.run_standards-reference == 'true'
runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 24
- name: Verify standards route
run: node --run check:standards
# ── JS quality ───────────────────────────────────────────────────────
# Format, lint, i18n, knip, schema drift, and dependency audit.
# Runs for any JS-touching category but does not build or run tests.
js-quality:
name: JS quality
needs: triage
if: |
!cancelled() &&
needs.triage.outputs.run_js-quality == 'true'
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Setup pnpm
uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6.0.10
with:
version: 11.20.0
- name: Setup Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 24
cache: pnpm
cache-dependency-path: pnpm-lock.yaml
- name: Install JavaScript dependencies
run: pnpm install --frozen-lockfile
- name: Audit dependencies
run: pnpm audit --audit-level=high
- name: Verify formatting
run: node --run format
- name: Lint frontend
run: node --run lint
- name: Check i18n keys
run: node --run check:i18n
- name: Check db-schema drift
run: |
pnpm generate:db-schema
git diff --exit-code docs/references/generated/db-schema.md
- name: knip (unused exports / dependencies)
run: pnpm knip --no-progress
# ── App frontend ─────────────────────────────────────────────────────
# App typecheck, production build, and unit tests with coverage.
app-frontend:
name: App frontend build / test
needs: triage
if: |
!cancelled() &&
needs.triage.outputs.run_app-frontend == 'true'
runs-on: ubuntu-24.04
timeout-minutes: 15
permissions:
contents: read
pull-requests: write # Needed by vitest-coverage-report-action to comment coverage on PRs.
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Setup pnpm
uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6.0.10
with:
version: 11.20.0
- name: Setup Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 24
cache: pnpm
cache-dependency-path: pnpm-lock.yaml
- name: Install JavaScript dependencies
run: pnpm install --frozen-lockfile
- name: Build frontend
run: node --run build
- name: Typecheck frontend
run: pnpm tsc --noEmit --project tsconfig.json
- name: Run frontend tests with coverage
run: node --run test -- --coverage --reporter=junit --outputFile=test-results.junit.xml
- name: Upload test results to Codecov
if: always()
uses: codecov/test-results-action@0fa95f0e1eeaafde2c782583b36b28ad0d8c77d3 # v1.2.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
- name: Test metrics summary
if: always()
run: |
{
echo "## Frontend Test Metrics"
echo ""
# Parse coverage from json-summary if available
if [ -f coverage/coverage-summary.json ]; then
BRANCHES=$(jq '.total.branches.pct' coverage/coverage-summary.json)
FUNCTIONS=$(jq '.total.functions.pct' coverage/coverage-summary.json)
LINES=$(jq '.total.lines.pct' coverage/coverage-summary.json)
STATEMENTS=$(jq '.total.statements.pct' coverage/coverage-summary.json)
echo "### Coverage"
echo "| Metric | Percentage |"
echo "|--------|------------|"
echo "| Branches | ${BRANCHES}% |"
echo "| Functions | ${FUNCTIONS}% |"
echo "| Lines | ${LINES}% |"
echo "| Statements | ${STATEMENTS}% |"
echo ""
fi
} >> "$GITHUB_STEP_SUMMARY"
- name: Upload coverage reports
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: frontend-coverage
path: coverage/
retention-days: 14
- name: Report coverage on PR
if: always() && github.event_name == 'pull_request'
uses: davelosert/vitest-coverage-report-action@8b157684c6a6b259b97d45e72b44242865c0f6a5 # v2.12.2
with:
json-summary-path: ./coverage/coverage-summary.json
vite-config-path: ./vite.config.ts
- name: Upload coverage to Codecov
if: always()
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: coverage
flags: frontend
fail_ci_if_error: false
# ── Website ──────────────────────────────────────────────────────────
# Website typecheck and docs build only. Does not run the full app
# test suite — website-only changes do not affect app behavior.
website:
name: Website build
needs: triage
if: |
!cancelled() &&
needs.triage.outputs.run_website == 'true'
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Setup pnpm
uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6.0.10
with:
version: 11.20.0
- name: Setup Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 24
cache: pnpm
cache-dependency-path: pnpm-lock.yaml
- name: Install JavaScript dependencies
run: pnpm install --frozen-lockfile
- name: Typecheck landing page
run: pnpm tsc --noEmit --project website/tsconfig.json
- name: Build landing page
run: node --run docs:build
cargo-deny:
name: Cargo deny
needs: triage
if: |
!cancelled() &&
needs.triage.outputs.run_cargo-deny == 'true'
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Check Rust dependencies
uses: EmbarkStudios/cargo-deny-action@3c6349835b2b7b196a839186cb8b78e02f7b5f25 # v2.1.1
with:
manifest-path: src-tauri/Cargo.toml
workflow-lint:
name: Workflow lint
needs: triage
if: |
!cancelled() &&
needs.triage.outputs.run_workflow-lint == 'true'
runs-on: ubuntu-24.04
timeout-minutes: 5
permissions:
contents: read
security-events: write # Needed by zizmor-action to upload SARIF results.
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: actionlint
uses: reviewdog/action-actionlint@dbe5299849118fd6f099ba563d263d770955a64a # v1.73.2
with:
actionlint_flags: ""
- name: zizmor
uses: zizmorcore/zizmor-action@3dc1ecc9bcb9e94e9b2c709687979e1298497054 # v0.6.2
with:
persona: pedantic
min-severity: low
# ── Release validation ───────────────────────────────────────────────
# Focused validation for release-workflow and release-metadata changes.
# Runs the release-workflow and release-metadata contract tests. Does not
# run app/frontend/Rust CI.
release-validation:
name: Release validation
needs: triage
if: |
!cancelled() &&
needs.triage.outputs.run_release-validation == 'true'
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Setup pnpm
uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6.0.10
with:
version: 11.20.0
- name: Setup Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 24
cache: pnpm
cache-dependency-path: pnpm-lock.yaml
- name: Install JavaScript dependencies
run: pnpm install --frozen-lockfile
- name: Run release contract tests
run: |
pnpm vitest run \
tests/release-workflow.test.ts \
tests/release-metadata.test.ts
dependency-checks:
name: Dependency surface checks
needs: triage
if: |
!cancelled() &&
needs.triage.outputs.run_dependency-checks == 'true'
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Setup Rust
uses: dtolnay/rust-toolchain@6c977a6ca4077a0ceb28ffbe03f59d46e9ac8772 # v1
with:
toolchain: stable
- name: Setup Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 24
package-manager-cache: false
- name: ort C API level vs catalog runtimes
run: node scripts/ci/check-ort-api-level.mjs
# Prebuilt binary rather than `cargo install`, which rebuilt cargo-shear
# from source on every run of a job whose actual work takes seconds.
- name: Install cargo-shear
uses: taiki-e/install-action@5b4d68e2e660441203ab128a23676f1e4faf1532 # v2.86.3
with:
tool: cargo-shear@1.12.4
- name: cargo-shear (unused Cargo dependencies)
working-directory: src-tauri
run: cargo shear --deny-warnings --locked
rust-test:
name: Rust tests (${{ matrix.name }})
needs: [triage, prepare-model]
if: |
!cancelled() &&
needs.triage.outputs.run_rust-test == 'true' &&
needs.prepare-model.result == 'success'
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
include:
- name: macOS
os: macos-14
ort_target: aarch64-apple-darwin
- name: Linux
os: ubuntu-22.04
ort_target: x86_64-unknown-linux-gnu
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 24
package-manager-cache: false
- name: Verify Cargo is not broken
if: runner.os == 'macOS'
run: |
if cargo --version 2>&1 | grep -qi "rustup-init"; then
echo "Broken cargo detected, reinstalling toolchain..."
rm -rf "$HOME/.cargo"
fi
- name: Setup Rust
uses: dtolnay/rust-toolchain@6c977a6ca4077a0ceb28ffbe03f59d46e9ac8772 # v1
with:
toolchain: stable
- name: Verify Rust toolchain (macOS)
if: runner.os == 'macOS'
run: |
cargo --version
rustc --version
- name: Restore Rust cache
uses: swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
with:
shared-key: ${{ github.workflow }}-${{ matrix.os }}-debug
workspaces: ./src-tauri -> target
cache-bin: false
key: ${{ matrix.os }}-debug
- name: Install Linux test dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential \
curl \
libasound2-dev \
libayatana-appindicator3-dev \
librsvg2-dev \
libssl-dev \
libwebkit2gtk-4.1-dev \
libxdo-dev
- name: Download separation model
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: separation-model
path: src-tauri/models
- name: Restore ONNX Runtime cache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: src-tauri/generated/onnxruntime
key: onnxruntime-${{ matrix.ort_target }}-${{ hashFiles('scripts/prepare-onnx-runtime.mjs', 'src-tauri/catalog/release-manifest.json') }}
- name: Prepare ONNX Runtime
env:
ORT_TARGET: ${{ matrix.ort_target }}
shell: bash
run: node scripts/prepare-onnx-runtime.mjs --target "${ORT_TARGET}"
- name: Verify Rust formatting
working-directory: src-tauri
run: cargo fmt --check
- name: Clippy
working-directory: src-tauri
run: cargo clippy --all-targets -- -D warnings
- name: Install nextest
uses: taiki-e/install-action@5b4d68e2e660441203ab128a23676f1e4faf1532 # v2.86.3
with:
tool: nextest
- name: Run Rust tests
working-directory: src-tauri
env:
# Parallel rust-lld of many heavy Tauri integration-test binaries has
# hit SIGBUS (Bus error) on GitHub Linux runners. Cap build jobs so
# concurrent linkers do not collide under memory pressure.
CARGO_BUILD_JOBS: "2"
run: |
if [ "$RUNNER_OS" = "Linux" ]; then
cargo nextest run --no-fail-fast
else
# phase5_perf asserts fixed latency thresholds for fixture audio. GitHub's
# macOS runners have noisy cold metadata probes; Linux remains the CI
# baseline, while macOS still runs the functional Rust suite.
# Filter by binary name — test(phase5_perf) does not match the binary
# and still runs backend_performance_report_stays_within_phase5_thresholds.
cargo nextest run --no-fail-fast -E '!binary(phase5_perf)'
fi
shell: bash
rust-test-windows-compile:
name: Rust tests (Windows compile)
needs: triage
if: |
!cancelled() &&
needs.triage.outputs.run_rust-test-windows-compile == 'true'
runs-on: windows-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Setup Rust
uses: dtolnay/rust-toolchain@6c977a6ca4077a0ceb28ffbe03f59d46e9ac8772 # v1
with:
toolchain: stable
- name: Restore Rust cache
uses: swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
with:
shared-key: ${{ github.workflow }}-windows-latest-debug
workspaces: ./src-tauri -> target
cache-bin: false
key: windows-latest-debug
- name: Restore ONNX Runtime cache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: src-tauri/generated/onnxruntime
key: onnxruntime-x86_64-pc-windows-msvc-${{ hashFiles('scripts/prepare-onnx-runtime.mjs', 'src-tauri/catalog/release-manifest.json') }}
- name: Prepare ONNX Runtime
run: node scripts/prepare-onnx-runtime.mjs --target x86_64-pc-windows-msvc
- name: Compile test binaries only
working-directory: src-tauri
run: cargo test -q --no-run
# The installed-app CLI is feature-gated out of normal user builds, so
# compile it explicitly here. This is a cached compile-only check on the
# existing Windows Rust job, rather than a separate slow runner.
- name: Compile installed-app automation smoke entry point
working-directory: src-tauri
run: cargo check -q --features automation-smoke --bin openkara
- name: Verify execution-provider platform contract
working-directory: src-tauri
shell: pwsh
run: |
$env:PATH = "$env:GITHUB_WORKSPACE\src-tauri\generated\onnxruntime;$env:PATH"
cargo test -q --lib execution_provider
# Linux-only Tauri smoke build for frontend-only PRs. Verifies that the
# frontend bundles into Tauri and the build entry point works, without
# paying for the 3-platform matrix. Runs when frontend changed but rust
# did not (pure frontend, deps_js, or frontend_tooling).
tauri-build-smoke:
name: Tauri build (Linux smoke)
needs: [triage, app-frontend]
if: |
!cancelled() &&
needs.triage.outputs.run_tauri-build-smoke == 'true' &&
needs.app-frontend.result != 'failure'
runs-on: ubuntu-22.04
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Setup pnpm
uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6.0.10
with:
version: 11.20.0
- name: Setup Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 24
cache: pnpm
cache-dependency-path: pnpm-lock.yaml
- name: Setup Rust
uses: dtolnay/rust-toolchain@6c977a6ca4077a0ceb28ffbe03f59d46e9ac8772 # v1
with:
toolchain: stable
- name: Restore Rust cache
uses: swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
with:
shared-key: ${{ github.workflow }}-ubuntu-22.04-release
workspaces: ./src-tauri -> target
cache-bin: false
key: ubuntu-22.04-release
- name: Install Linux build dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential \
binutils \
curl \
file \
patchelf \
libasound2-dev \
libayatana-appindicator3-dev \
librsvg2-dev \
libssl-dev \
libwebkit2gtk-4.1-dev \
libxdo-dev \
wget
- name: Install JavaScript dependencies
run: pnpm install --frozen-lockfile
- name: Restore ONNX Runtime cache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: src-tauri/generated/onnxruntime
key: onnxruntime-x86_64-unknown-linux-gnu-${{ hashFiles('scripts/prepare-onnx-runtime.mjs', 'src-tauri/catalog/release-manifest.json') }}
- name: Prepare ONNX Runtime
env:
ORT_TARGET: x86_64-unknown-linux-gnu
shell: bash
run: node scripts/prepare-onnx-runtime.mjs --target "${ORT_TARGET}"
- name: Validate Tauri build
env:
OPENKARA_GOOGLE_DRIVE_OAUTH_CLIENT_JSON: ${{ secrets.OPENKARA_GOOGLE_DRIVE_OAUTH_CLIENT_JSON }}
OPENKARA_DROPBOX_APP_KEY: ${{ secrets.OPENKARA_DROPBOX_APP_KEY }}
OPENKARA_DROPBOX_APP_SECRET: ${{ secrets.OPENKARA_DROPBOX_APP_SECRET }}
run: pnpm tauri build --ci --bundles deb
shell: bash
# Full 3-platform Tauri build for Rust/deps/workflows/unknown changes.
# Waits for cheap checks (dependency-checks, windows-compile) before
# starting the expensive matrix so failures surface faster.
tauri-build:
name: Tauri build (${{ matrix.name }})
needs:
[
triage,
app-frontend,
rust-test,
cargo-deny,
dependency-checks,
rust-test-windows-compile,
]
# Use !cancelled() so the job can run even when some upstream jobs were
# skipped (e.g. a rust-only PR skips app-frontend, but tauri-build still
# needs to verify the Rust side compiles into a Tauri bundle).
# The result != 'failure' guards ensure we don't build on top of a
# failed dependency. Only runs for rust/deps/unknown —
# frontend-only PRs use tauri-build-smoke (Linux) instead.
if: |
!cancelled() &&
needs.triage.outputs.run_tauri-build == 'true' &&
needs.app-frontend.result != 'failure' &&
needs.rust-test.result != 'failure' &&
needs.cargo-deny.result != 'failure' &&
needs.dependency-checks.result != 'failure' &&
needs.rust-test-windows-compile.result != 'failure'
runs-on: ${{ matrix.os }}
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
include:
- name: macOS
os: macos-14
ort_target: aarch64-apple-darwin
- name: Windows
os: windows-latest
ort_target: x86_64-pc-windows-msvc
- name: Linux
os: ubuntu-22.04
ort_target: x86_64-unknown-linux-gnu
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Setup pnpm
uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6.0.10
with:
version: 11.20.0
- name: Setup Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 24
cache: pnpm
cache-dependency-path: pnpm-lock.yaml
- name: Verify Cargo is not broken
if: runner.os == 'macOS'
run: |
# Some macOS runner images ship with a broken toolchain where
# $HOME/.cargo/bin/cargo dispatches to rustup-init. Detect and
# repair without a full reinstall every time.
if cargo --version 2>&1 | grep -qi "rustup-init"; then
echo "Broken cargo detected, reinstalling toolchain..."
rm -rf "$HOME/.cargo"
fi
- name: Setup Rust
uses: dtolnay/rust-toolchain@6c977a6ca4077a0ceb28ffbe03f59d46e9ac8772 # v1
with:
toolchain: stable
- name: Repair toolchain if still broken
if: runner.os == 'macOS'
run: |
# rustup can leave cargo pointing to rustup-init if the
# proxy links got clobbered. Re-run the toolchain installer
# so it repairs the bin symlinks.
if cargo --version 2>&1 | grep -qi "rustup-init"; then
rustup update stable --force
fi
- name: Restore Rust cache
uses: swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
with:
shared-key: ${{ github.workflow }}-${{ matrix.os }}-release
workspaces: ./src-tauri -> target
cache-bin: false
key: ${{ matrix.os }}-release
- name: Install Linux build dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential \
binutils \
curl \
file \
patchelf \
libasound2-dev \
libayatana-appindicator3-dev \
librsvg2-dev \
libssl-dev \
libwebkit2gtk-4.1-dev \
libxdo-dev \
wget
- name: Install JavaScript dependencies