Repository navigation
910 lines (803 loc) · 33.2 KB
/
Copy pathci.yml
File metadata and controls
910 lines (803 loc) · 33.2 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
name: CI
on:
push:
branches: [main]
paths:
- "apps/**"
- "packages/**"
- "config/**"
- "scripts/**"
- "package.json"
- "pnpm-lock.yaml"
- "pnpm-workspace.yaml"
- "tsconfig.base.json"
- "vitest.config.ts"
- "vitest.integration.config.ts"
- ".github/workflows/ci.yml"
- ".github/workflows/publish-cli.yml"
- ".dockerignore"
- "install-cli.sh"
- "website/install-cli.sh"
pull_request:
branches: [main]
paths:
- "apps/**"
- "packages/**"
- "config/**"
- "scripts/**"
- "package.json"
- "pnpm-lock.yaml"
- "pnpm-workspace.yaml"
- "tsconfig.base.json"
- "vitest.config.ts"
- "vitest.integration.config.ts"
- ".github/workflows/ci.yml"
- ".github/workflows/publish-cli.yml"
- ".dockerignore"
- "install-cli.sh"
- "website/install-cli.sh"
workflow_dispatch:
permissions:
contents: read
pull-requests: write
issues: write
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
# ---------------------------------------------------------------------------
# CI Jobs — test, lint, build (run in parallel)
# ---------------------------------------------------------------------------
test:
name: Unit Tests (${{ matrix.node-version }})
needs: [detect-changes]
if: >
github.event_name == 'workflow_dispatch' ||
needs.detect-changes.outputs.typescript == 'true'
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [22]
steps:
- name: Checkout repository
uses: actions/checkout@v4
# pnpm/action-setup@v4 is not allowed on EMU
- name: Install pnpm
run: |
corepack enable
corepack prepare pnpm@10.29.1 --activate
pnpm --version
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
registry-url: "https://registry.npmjs.org"
cache: "pnpm"
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build shared packages
run: pnpm --filter shared --filter github-auth build
- name: Run tests with coverage
run: pnpm test:coverage
- name: Generate GitHub test summary from CTRF
if: always()
run: |
pnpm exec github-actions-ctrf "ctrf/*-ctrf-report.json" --title "Test Results (Node.js ${{ matrix.node-version }})"
- name: Upload coverage reports
uses: actions/upload-artifact@v4
if: always()
with:
name: coverage-reports-node-${{ matrix.node-version }}
path: coverage/
- name: Post coverage summary to Pull Request
if: always() && github.event_name == 'pull_request'
run: |
node -e "
const fs = require('fs');
const summary = JSON.parse(fs.readFileSync('coverage/coverage-summary.json', 'utf8'));
const t = summary.total;
const pct = (v) => v.pct !== undefined && v.pct !== null ? v.pct + '%' : 'N/A';
const lines = [
'## 📊 Coverage Summary',
'',
'| Category | Coverage | Covered | Total |',
'|----------|----------|---------|-------|',
'| **Statements** | ' + pct(t.statements) + ' | ' + t.statements.covered + ' | ' + t.statements.total + ' |',
'| **Branches** | ' + pct(t.branches) + ' | ' + t.branches.covered + ' | ' + t.branches.total + ' |',
'| **Functions** | ' + pct(t.functions) + ' | ' + t.functions.covered + ' | ' + t.functions.total + ' |',
'| **Lines** | ' + pct(t.lines) + ' | ' + t.lines.covered + ' | ' + t.lines.total + ' |',
];
fs.appendFileSync(process.env.GITHUB_STEP_SUMMARY, lines.join('\n') + '\n');
"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Post test results to Pull Request
if: always() && github.event_name == 'pull_request'
run: |
pnpm exec github-actions-ctrf pull-request "ctrf/*-ctrf-report.json" --title "Test Results (Node.js ${{ matrix.node-version }})" || {
echo "⚠️ Failed to post PR comment (may be due to permissions)"
echo "✅ Test results are still available in the Actions summary above"
exit 0
}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload CTRF test results
uses: actions/upload-artifact@v4
if: always()
with:
name: ctrf-test-results-node-${{ matrix.node-version }}
path: ctrf/
# ---------------------------------------------------------------------------
# LLM evals. Runs every *.eval.test.ts against a real LLM; each eval asserts on
# a majority of N samples (non-deterministic, quota-costing). The criteria-prompt
# orientation eval (origin: #1225) lives here today; adding more *.eval.test.ts
# files makes them run in this same job. Path-filtered to eval files + prompt-gen
# source and required via CI Summary (success-or-skipped). Self-skips when no LLM
# token is present.
# ---------------------------------------------------------------------------
llm-evals:
name: LLM Evals
needs: [detect-changes]
if: >
(github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) &&
(github.event_name == 'workflow_dispatch' || needs.detect-changes.outputs.evals == 'true')
runs-on: ubuntu-latest
permissions:
contents: read
models: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
# pnpm/action-setup@v4 is not allowed on EMU
- name: Install pnpm
run: |
corepack enable
corepack prepare pnpm@10.29.1 --activate
pnpm --version
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
registry-url: "https://registry.npmjs.org"
cache: "pnpm"
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build shared packages
run: pnpm --filter shared build
- name: Run LLM evals
run: npx vitest run --config vitest.eval.config.ts --silent=false
env:
# A real GitHub PAT is required here: the generator calls the legacy
# GitHub Models endpoint (models.inference.ai.azure.com), which the
# ephemeral Actions GITHUB_TOKEN is NOT valid against (that only works
# with the newer models.github.ai/inference endpoint). COPILOT_GITHUB_TOKEN
# is an existing PAT secret. If it lacks model access, add a dedicated
# GITHUB_MODELS_API_KEY secret (a PAT with models scope) and read it here.
GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }}
CRITERIA_EVAL_SAMPLES: "3"
- name: Generate GitHub test summary from CTRF
if: always()
run: |
pnpm exec github-actions-ctrf "ctrf/*-eval-ctrf-report.json" --title "LLM Eval Results" || true
- name: Upload CTRF eval results
uses: actions/upload-artifact@v4
if: always()
with:
name: ctrf-eval-results
path: ctrf/
if-no-files-found: ignore
integration-test:
name: Integration Tests (${{ matrix.worker.name }})
needs: [detect-changes]
if: >-
github.repository == 'microsoft/scope' &&
(
github.event_name == 'workflow_dispatch' ||
needs.detect-changes.outputs.ci == 'true' ||
needs.detect-changes.outputs.coder-acp-copilot == 'true' ||
needs.detect-changes.outputs.coder-acp-claude-code == 'true' ||
needs.detect-changes.outputs.shared == 'true'
)
runs-on: ubuntu-latest
permissions:
contents: read
env:
TRUSTED_CODE: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }}
DOCKERHUB_LOGIN_ENABLED: ${{ secrets.DOCKERHUB_USERNAME != '' && secrets.DOCKERHUB_TOKEN != '' }}
strategy:
fail-fast: false
matrix:
worker:
- name: copilot-acp
dockerfile: apps/workers/coder-acp-copilot/Dockerfile
versions_env: apps/workers/coder-acp-copilot/versions.env
test_pattern: apps/workers/coder-acp-copilot
images: |
source apps/workers/coder-acp-copilot/versions.env
docker buildx build \
-t coder-acp-copilot-integration-test \
-f apps/workers/coder-acp-copilot/Dockerfile \
--target dev \
--build-arg COPILOT_CLI_VERSION=$COPILOT_CLI_VERSION \
--cache-from type=local,src=/tmp/.buildx-cache \
--cache-to type=local,dest=/tmp/.buildx-cache-new,mode=min \
--load \
.
- name: claude-code-acp
dockerfile: apps/workers/coder-acp-claude-code/Dockerfile
versions_env: apps/workers/coder-acp-claude-code/versions.env
test_pattern: apps/workers/coder-acp-claude-code
images: |
source apps/workers/coder-acp-claude-code/versions.env
docker buildx build \
-t coder-acp-claude-code-integration-test \
-f apps/workers/coder-acp-claude-code/Dockerfile \
--target dev \
--build-arg CLAUDE_CODE_ACP_VERSION=$CLAUDE_CODE_ACP_VERSION \
--build-arg CLAUDE_AGENT_SDK_VERSION=$CLAUDE_AGENT_SDK_VERSION \
--cache-from type=local,src=/tmp/.buildx-cache \
--cache-to type=local,dest=/tmp/.buildx-cache-new,mode=min \
--load \
.
steps:
- name: Free disk space
run: |
sudo rm -rf /usr/local/lib/android /usr/share/dotnet /opt/ghc \
/usr/local/share/boost /usr/local/graalvm /usr/local/share/chromium \
/usr/local/.ghcup /opt/hostedtoolcache/CodeQL
sudo docker image prune --all --force
df -h /
- name: Checkout repository
uses: actions/checkout@v4
# pnpm/action-setup@v4 is not allowed on EMU
- name: Install pnpm
run: |
corepack enable
corepack prepare pnpm@10.29.1 --activate
pnpm --version
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
registry-url: "https://registry.npmjs.org"
cache: "pnpm"
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build shared packages
run: pnpm --filter shared --filter github-auth build
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4.0.0
with:
driver: docker-container
- name: Cache Docker layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: docker-${{ matrix.worker.name }}-${{ hashFiles(matrix.worker.dockerfile, matrix.worker.versions_env) }}
restore-keys: docker-${{ matrix.worker.name }}-
- name: Log in to Docker Hub
if: env.TRUSTED_CODE == 'true' && env.DOCKERHUB_LOGIN_ENABLED == 'true'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Pre-build Docker test images
run: |
${{ matrix.worker.images }}
# Rotate cache to avoid unbounded growth
if [ -d /tmp/.buildx-cache-new ]; then
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
fi
- name: Run integration tests
run: npx vitest run --config vitest.integration.config.ts --silent=false ${{ matrix.worker.test_pattern }}
env:
GH_AUTH_USERNAME: ${{ env.TRUSTED_CODE == 'true' && secrets.GH_AUTH_USERNAME || '' }}
GH_AUTH_PASSWORD: ${{ env.TRUSTED_CODE == 'true' && secrets.GH_AUTH_PASSWORD || '' }}
GH_AUTH_TOTP_SECRET: ${{ env.TRUSTED_CODE == 'true' && secrets.GH_AUTH_TOTP_SECRET || '' }}
GITHUB_TOKEN: ${{ env.TRUSTED_CODE == 'true' && secrets.COPILOT_GITHUB_TOKEN || '' }}
# NOTE: Claude Code credentials disabled — out of budget.
# The expensive "completes coding prompts" test auto-skips when
# these are absent; tool-check tests still run.
# ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
# CLAUDE_CODE_OAUTH_TOKEN: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
- name: Generate GitHub test summary from CTRF
if: always()
run: |
pnpm exec github-actions-ctrf "ctrf/*-integration-ctrf-report.json" --title "Integration Test Results (${{ matrix.worker.name }})" || true
- name: Upload CTRF integration test results
uses: actions/upload-artifact@v4
if: always()
with:
name: ctrf-integration-test-results-${{ matrix.worker.name }}
path: ctrf/
if-no-files-found: ignore
- name: Upload test snapshots
uses: actions/upload-artifact@v4
if: always()
with:
name: test-snapshots-${{ matrix.worker.name }}
path: test-snapshots/
if-no-files-found: ignore
- name: Collect test videos
if: always()
run: |
mkdir -p test-videos
i=0; find apps/workers -type f -path "*/test-output/*" -name "*.webm" | sort | while IFS= read -r f; do
cp "$f" "test-videos/recording-$i.webm"
i=$((i+1))
done
- name: Upload test videos
uses: actions/upload-artifact@v4
if: always()
with:
name: test-videos-${{ matrix.worker.name }}
path: test-videos/
if-no-files-found: ignore
# ---------------------------------------------------------------------------
# Queue recovery integration tests (stuck-run fix). Self-provision their own
# MongoDB/Redis/Azurite via testcontainers — no docker-compose infra needed.
# ---------------------------------------------------------------------------
integration-test-queue:
name: Integration Tests (queue recovery)
needs: [detect-changes]
if: >-
github.repository == 'microsoft/scope' &&
(
github.event_name == 'workflow_dispatch' ||
needs.detect-changes.outputs.ci == 'true' ||
needs.detect-changes.outputs.shared == 'true' ||
needs.detect-changes.outputs.scheduler == 'true'
)
runs-on: ubuntu-latest
permissions:
contents: read
env:
DOCKERHUB_LOGIN_ENABLED: ${{ secrets.DOCKERHUB_USERNAME != '' && secrets.DOCKERHUB_TOKEN != '' }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
# pnpm/action-setup@v4 is not allowed on EMU
- name: Install pnpm
run: |
corepack enable
corepack prepare pnpm@10.29.1 --activate
pnpm --version
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
registry-url: "https://registry.npmjs.org"
cache: "pnpm"
- name: Install dependencies
run: pnpm install --frozen-lockfile
# The scheduler reaper test imports CodingAgentQueueProcessor from the
# built `shared` dist (the integration config resolves bare imports to
# dist, not source), so shared must be built first.
- name: Build shared packages
run: pnpm --filter shared build
# Authenticate when available on trusted code; fork PRs use public images
# anonymously so missing secrets do not prevent these local-service tests.
- name: Log in to Docker Hub
if: >-
env.DOCKERHUB_LOGIN_ENABLED == 'true' &&
(github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository)
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Run queue recovery integration tests
run: pnpm vitest run --config vitest.integration.config.ts --silent=false packages/shared/src/queue/redelivery.integration.test.ts apps/scheduler/src/stuck-run-reaper.integration.test.ts
- name: Generate GitHub test summary from CTRF
if: always()
run: |
pnpm exec github-actions-ctrf "ctrf/*-integration-ctrf-report.json" --title "Integration Test Results (queue recovery)" || true
- name: Upload CTRF integration test results
uses: actions/upload-artifact@v4
if: always()
with:
name: ctrf-integration-test-results-queue-recovery
path: ctrf/
if-no-files-found: ignore
lint:
name: Lint Code
needs: [detect-changes]
if: >
github.event_name == 'workflow_dispatch' ||
needs.detect-changes.outputs.typescript == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
# pnpm/action-setup@v4 is not allowed on EMU
- name: Install pnpm
run: |
corepack enable
corepack prepare pnpm@10.29.1 --activate
pnpm --version
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
registry-url: "https://registry.npmjs.org"
cache: "pnpm"
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Lint
# TODO: remove continue-on-error once ESLint is added as a dependency
continue-on-error: true
run: pnpm lint
build:
name: Build Applications
needs: [detect-changes]
if: >
github.event_name == 'workflow_dispatch' ||
needs.detect-changes.outputs.typescript == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
# pnpm/action-setup@v4 is not allowed on EMU
- name: Install pnpm
run: |
corepack enable
corepack prepare pnpm@10.29.1 --activate
pnpm --version
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
registry-url: "https://registry.npmjs.org"
cache: "pnpm"
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build
run: pnpm build
cli-bundle-test:
name: CLI Bundle Integration Tests
needs: [detect-changes]
if: >
github.event_name == 'workflow_dispatch' ||
needs.detect-changes.outputs.typescript == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install pnpm
run: |
corepack enable
corepack prepare pnpm@10.29.1 --activate
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
cache: "pnpm"
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build CLI bundle
run: pnpm build:cli
- name: Run integration tests
run: pnpm vitest run --config vitest.integration.config.ts apps/cli/src/bundle.integration.test.ts apps/cli/src/utils/update-check.integration.test.ts
- name: Upload CLI bundle
uses: actions/upload-artifact@v4
with:
name: scope-cli-bundle
path: apps/cli/dist/scope.mjs
retention-days: 7
# ---------------------------------------------------------------------------
# License headers — verify every first-party source file carries the
# Microsoft MIT header. Not gated on detect-changes: it always runs so the
# check is enforced on every PR. Run `pnpm headers` locally to add any that
# are missing (same include/exclude set as the check).
# ---------------------------------------------------------------------------
license-headers:
name: License Headers
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
# pnpm/action-setup@v4 is not allowed on EMU
- name: Install pnpm
run: |
corepack enable
corepack prepare pnpm@10.29.1 --activate
pnpm --version
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
registry-url: "https://registry.npmjs.org"
cache: "pnpm"
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Verify license headers
run: pnpm headers:check
gateway:
name: "Gateway: lint, test & build"
needs: [detect-changes]
if: >
github.event_name == 'workflow_dispatch' ||
needs.detect-changes.outputs.gateway == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@1.94.1
with:
toolchain: 1.94.1
components: rustfmt, clippy
- name: Cache Cargo registry + build
uses: Swatinem/rust-cache@v2.9.1
with:
workspaces: apps/gateway
# Fall back to the most recent partial cache when Cargo.lock changes,
# rather than starting cold. The exact-match key still takes priority.
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Install cargo-nextest
run: |
curl -LsSf https://get.nexte.st/latest/linux | tar zxf - -C ${CARGO_HOME:-~/.cargo}/bin
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
- name: Check formatting
working-directory: apps/gateway
run: cargo fmt --check
- name: Clippy
working-directory: apps/gateway
run: cargo clippy --all-targets -- -D warnings
- name: Run tests (nextest + JUnit XML)
working-directory: apps/gateway
run: cargo nextest run --profile ci
- name: Convert JUnit XML to CTRF
if: always()
run: |
npx junit-to-ctrf apps/gateway/target/nextest/ci/junit.xml \
-o ctrf/gateway-ctrf-report.json \
-t gateway
- name: Generate GitHub test summary from CTRF
if: always()
run: |
npx github-actions-ctrf "ctrf/gateway-ctrf-report.json" --title "Gateway: lint, test & build"
- name: Post test results to Pull Request
if: always() && github.event_name == 'pull_request'
run: |
npx github-actions-ctrf pull-request "ctrf/gateway-ctrf-report.json" --title "Gateway: lint, test & build" || {
echo "⚠️ Failed to post PR comment (may be due to permissions)"
exit 0
}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload CTRF test results
uses: actions/upload-artifact@v4
if: always()
with:
name: ctrf-test-results-gateway
path: ctrf/
notice-check:
name: Third-party NOTICE
# Runs on every PR with no detect-changes gate: the NOTICE / NOTICE-REVIEW
# attributions must always match the installed production dependencies.
# Dependency, script and config edits are the only changes that can stale it
# and they all fall under this workflow's paths filter, so a drifted NOTICE
# can never slip through unnoticed.
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
# pnpm/action-setup@v4 is not allowed on EMU
- name: Install pnpm
run: |
corepack enable
corepack prepare pnpm@10.29.1 --activate
pnpm --version
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
registry-url: "https://registry.npmjs.org"
cache: "pnpm"
# --ignore-scripts skips postinstall native downloads (Playwright browsers,
# etc.): the NOTICE only depends on which packages and LICENSE files are
# present, which the lockfile fully determines, so this stays exact while
# being faster.
- name: Install dependencies
run: pnpm install --frozen-lockfile --ignore-scripts
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@1.94.1
with:
toolchain: 1.94.1
# cargo-about only reads `cargo metadata` + each crate's LICENSE file, so
# this caches the crates.io index and downloaded sources — no target build.
- name: Cache Cargo registry
uses: Swatinem/rust-cache@v2.9.1
with:
workspaces: apps/gateway
save-if: ${{ github.ref == 'refs/heads/main' }}
# Cache the prebuilt cargo-about binary so warm runs skip the download.
- name: Cache cargo-about
id: cache-cargo-about
uses: actions/cache@v4
with:
path: ~/.cargo/bin/cargo-about
key: cargo-about-0.9.1-${{ runner.os }}-x86_64
- name: Install cargo-about
if: steps.cache-cargo-about.outputs.cache-hit != 'true'
run: |
mkdir -p "${CARGO_HOME:-$HOME/.cargo}/bin"
curl -LsSf "https://github.com/EmbarkStudios/cargo-about/releases/download/0.9.1/cargo-about-0.9.1-x86_64-unknown-linux-musl.tar.gz" \
| tar zxf - --strip-components=1 -C "${CARGO_HOME:-$HOME/.cargo}/bin" \
"cargo-about-0.9.1-x86_64-unknown-linux-musl/cargo-about"
- name: Show cargo-about version
run: cargo-about --version
# Regenerates NOTICE + NOTICE-REVIEW.txt from the installed dependencies and
# fails if they differ from the committed files (verbatim, tool-extracted).
- name: Verify NOTICE is up to date
run: pnpm notice:check
windows-build:
name: Windows Worker Build
needs: [detect-changes]
if: >
github.repository == 'microsoft/scope' &&
(github.event_name == 'workflow_dispatch' ||
needs.detect-changes.outputs.ci == 'true' ||
needs.detect-changes.outputs.coder-acp-copilot-windows == 'true' ||
needs.detect-changes.outputs.coder-acp-copilot == 'true' ||
needs.detect-changes.outputs.shared == 'true')
runs-on: windows-2022
timeout-minutes: 60
permissions:
contents: read
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Build and smoke-test local Windows images
shell: pwsh
run: ./scripts/build-windows-worker.ps1
# ---------------------------------------------------------------------------
# Detect changed components (runs in parallel with CI jobs)
# ---------------------------------------------------------------------------
detect-changes:
runs-on: ubuntu-latest
outputs:
ci: ${{ steps.changes.outputs.ci }}
api: ${{ steps.changes.outputs.api }}
judge: ${{ steps.changes.outputs.judge }}
portal: ${{ steps.changes.outputs.portal }}
coder-acp-copilot: ${{ steps.changes.outputs.coder-acp-copilot }}
coder-acp-claude-code: ${{ steps.changes.outputs.coder-acp-claude-code }}
token-manager: ${{ steps.changes.outputs.token-manager }}
model-scanner-copilot: ${{ steps.changes.outputs.model-scanner-copilot }}
model-scanner-anthropic: ${{ steps.changes.outputs.model-scanner-anthropic }}
report-generator: ${{ steps.changes.outputs.report-generator }}
post-processor: ${{ steps.changes.outputs.post-processor }}
scheduler: ${{ steps.changes.outputs.scheduler }}
db-migrations: ${{ steps.changes.outputs.db-migrations }}
shared: ${{ steps.changes.outputs.shared }}
gateway: ${{ steps.changes.outputs.gateway }}
coder-acp-copilot-windows: ${{ steps.changes.outputs.coder-acp-copilot-windows }}
model-scanning: ${{ steps.changes.outputs.model-scanning }}
typescript: ${{ steps.changes.outputs.typescript }}
evals: ${{ steps.changes.outputs.evals }}
steps:
- uses: actions/checkout@v4
if: github.event_name == 'push' || github.event_name == 'pull_request'
- uses: dorny/paths-filter@v3.0.2
if: github.event_name == 'push' || github.event_name == 'pull_request'
id: changes
with:
base: ${{ github.event.before }}
filters: |
ci:
- '.github/workflows/ci.yml'
- 'scripts/ci-workflow.test.ts'
shared:
- 'packages/shared/**'
- 'package.json'
- 'pnpm-lock.yaml'
- 'tsconfig.base.json'
model-scanning:
- 'packages/model-scanning/**'
api:
- 'apps/api/**'
judge:
- 'apps/judge/**'
portal:
- 'apps/portal/**'
coder-acp-copilot:
- 'apps/workers/coder-acp-copilot/**'
- 'packages/test-utils/**'
coder-acp-claude-code:
- 'apps/workers/coder-acp-claude-code/**'
- 'packages/copilot-driver-ext/**'
- 'packages/test-utils/**'
token-manager:
- 'apps/token-manager/**'
model-scanner-copilot:
- 'apps/model-scanners/copilot/**'
model-scanner-anthropic:
- 'apps/model-scanners/anthropic/**'
report-generator:
- 'apps/workers/report-generator/**'
post-processor:
- 'apps/workers/post-processor/**'
scheduler:
- 'apps/scheduler/**'
db-migrations:
- 'packages/db-migrations/**'
gateway:
- 'apps/gateway/**'
coder-acp-copilot-windows:
- 'apps/workers/coder-acp-copilot-windows/**'
- 'apps/workers/coder-acp-copilot/versions.env'
- 'packages/telemetry/**'
- 'scripts/build-windows-worker.ps1'
- 'pnpm-workspace.yaml'
- '.dockerignore'
- 'packages/test-utils/**'
typescript:
- '.github/workflows/ci.yml'
- '.github/workflows/publish-cli.yml'
- 'scripts/ci-workflow.test.ts'
- 'scripts/install-cli.test.ts'
- 'scripts/build-windows-worker.test.ts'
- 'scripts/build-windows-worker.ps1'
- 'install-cli.sh'
- 'website/install-cli.sh'
- '.dockerignore'
- 'pnpm-workspace.yaml'
- 'apps/**'
- '!apps/gateway/**'
- 'packages/**'
- 'package.json'
- 'pnpm-lock.yaml'
- 'tsconfig.base.json'
- 'vitest.config.ts'
- 'vitest.integration.config.ts'
evals:
- '**/*.eval.test.ts'
- 'apps/api/src/llm.ts'
- 'apps/api/src/llm-token.ts'
- 'vitest.eval.config.ts'
- 'packages/llm-eval/**'
# ---------------------------------------------------------------------------
# Summary
# ---------------------------------------------------------------------------
ci-summary:
name: CI Summary
runs-on: ubuntu-latest
needs: [test, integration-test, integration-test-queue, windows-build, lint, build, cli-bundle-test, gateway, llm-evals, notice-check, license-headers]
if: always()
steps:
- name: Check overall status
run: |
if [ "${{ needs.test.result }}" = "success" ] && \
[ "${{ needs.integration-test.result }}" = "success" -o "${{ needs.integration-test.result }}" = "skipped" ] && \
[ "${{ needs.integration-test-queue.result }}" = "success" -o "${{ needs.integration-test-queue.result }}" = "skipped" ] && \
[ "${{ needs.windows-build.result }}" = "success" -o "${{ needs.windows-build.result }}" = "skipped" ] && \
[ "${{ needs.lint.result }}" = "success" ] && \
[ "${{ needs.build.result }}" = "success" ] && \
[ "${{ needs.cli-bundle-test.result }}" = "success" -o "${{ needs.cli-bundle-test.result }}" = "skipped" ] && \
[ "${{ needs.llm-evals.result }}" = "success" -o "${{ needs.llm-evals.result }}" = "skipped" ] && \
[ "${{ needs.notice-check.result }}" = "success" -o "${{ needs.notice-check.result }}" = "skipped" ] && \
[ "${{ needs.license-headers.result }}" = "success" ] && \
[ "${{ needs.gateway.result }}" = "success" -o "${{ needs.gateway.result }}" = "skipped" ]; then
echo "✅ All checks passed!"
exit 0
else
echo "❌ Some checks failed:"
echo " Unit Tests: ${{ needs.test.result }}"
echo " Integration Tests: ${{ needs.integration-test.result }}"
echo " Integration Tests (queue recovery): ${{ needs.integration-test-queue.result }}"
echo " Windows Worker Build: ${{ needs.windows-build.result }}"
echo " Lint: ${{ needs.lint.result }}"
echo " Build: ${{ needs.build.result }}"
echo " CLI Bundle Tests: ${{ needs.cli-bundle-test.result }}"
echo " LLM Evals: ${{ needs.llm-evals.result }}"
echo " Third-party NOTICE: ${{ needs.notice-check.result }}"
echo " License Headers: ${{ needs.license-headers.result }}"
echo " Gateway: ${{ needs.gateway.result }}"
exit 1
fi