The best way to control Claude Code, Codex and more from any computer or phone

main
yml 698 lines 29.5 KB
Raw
1 name: CI
2
3 on:
4 pull_request:
5 push:
6 branches:
7 - main
8
9 permissions:
10 contents: read
11
12 concurrency:
13 group: ci-${{ github.event.pull_request.number || github.sha }}
14 cancel-in-progress: ${{ github.event_name == 'pull_request' }}
15
16 jobs:
17 # Skips jobs a pull request cannot affect: a web change does not run the
18 # server shards, a server change does not run the mobile tests, and the macOS
19 # lint (~6.7x a Linux minute) runs only for native mobile sources.
20 # .github/scripts/ci-changes.cjs maps changed files to workspace packages and
21 # their dependents. Pushes to main still run every Linux job. Detection fails
22 # open: if the diff cannot be resolved, everything runs.
23 changes:
24 name: Changes
25 runs-on: blacksmith-2vcpu-ubuntu-2404
26 timeout-minutes: 5
27 outputs:
28 typecheck: ${{ steps.detect.outputs.typecheck }}
29 build: ${{ steps.detect.outputs.build }}
30 desktop_launch: ${{ steps.detect.outputs.desktop_launch }}
31 test: ${{ steps.detect.outputs.test }}
32 test_packages: ${{ steps.detect.outputs.test_packages }}
33 test_web: ${{ steps.detect.outputs.test_web }}
34 test_server: ${{ steps.detect.outputs.test_server }}
35 rust: ${{ steps.detect.outputs.rust }}
36 release_smoke: ${{ steps.detect.outputs.release_smoke }}
37 mobile_native: ${{ steps.detect.outputs.mobile_native }}
38 steps:
39 # Only the package manifests the script reads to build the dependency graph.
40 # Depth 2 brings the base commit the change is diffed against.
41 - name: Checkout
42 uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
43 with:
44 fetch-depth: 2
45 sparse-checkout: |
46 /pnpm-workspace.yaml
47 /.github/scripts/ci-changes.cjs
48 /.github/actions/ci-changes/
49 /*/package.json
50 /*/*/package.json
51 !/.repos/
52 sparse-checkout-cone-mode: false
53
54 - name: Detect affected jobs
55 id: detect
56 uses: ./.github/actions/ci-changes
57
58 # Lint and the desktop build each get a runner so they run side by side.
59 # Typecheck shares the build's install. Lint always runs: it formats every
60 # file, docs included. The `Check` job at the end of this file passes only
61 # when every other job passes or was skipped by `changes`.
62 lint:
63 permissions:
64 contents: read
65 id-token: write
66 name: Lint
67 runs-on: blacksmith-8vcpu-ubuntu-2404
68 timeout-minutes: 10
69 steps:
70 - name: Checkout
71 uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
72 with:
73 sparse-checkout: |
74 /*
75 !/.repos/
76 !/apps/mobile/modules/t3-terminal/Vendor/**/*.a
77 sparse-checkout-cone-mode: false
78
79 - name: Reject repository-owned PR assets
80 run: |
81 files="$(git ls-files .github/pr-assets)"
82 if test -n "$files"; then
83 printf 'PR evidence must be uploaded to GitHub, not committed:\n%s\n' "$files" >&2
84 exit 1
85 fi
86
87 - name: Setup Vite+
88 uses: ./.github/actions/setup-ci-deps
89 with:
90 task-cache-read-token: ${{ secrets.T3_TASK_CACHE_READ_TOKEN }}
91
92 # electron's install.js (run by ensure:electron) reads this cache before it
93 # downloads from GitHub. The key changes only with the Electron version.
94 - name: Cache Electron download
95 uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
96 with:
97 path: ~/.cache/electron
98 key: electron-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('node_modules/.pnpm/electron@*/node_modules/electron/package.json') }}
99
100 - name: Ensure Electron runtime is installed
101 run: vp run --filter @t3tools/desktop ensure:electron
102
103 # Files/dependencies are repo-wide; export checks cover clean workspaces only.
104 - name: Check unused code
105 run: vp run knip:check
106
107 - name: Check generated GitHub GraphQL operations
108 run: vp run --filter @t3tools/source-control-github generate --check
109
110 - name: Check generated Expo GraphQL operations
111 run: vp run --filter t3 generate --check
112
113 - name: Check generated Linear GraphQL operations
114 run: vp run --filter @t3tools/issue-tracker-linear generate --check
115
116 - name: Check i18n catalogs
117 run: vp run i18n:check
118
119 - name: Check
120 run: vp check
121
122 build:
123 permissions:
124 contents: read
125 id-token: write
126 name: Build and Typecheck
127 needs: changes
128 if: ${{ !cancelled() && (needs.changes.outputs.build != 'false' || needs.changes.outputs.typecheck != 'false') }}
129 runs-on: blacksmith-8vcpu-ubuntu-2404
130 timeout-minutes: 10
131 steps:
132 - name: Checkout
133 uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
134 with:
135 sparse-checkout: |
136 /*
137 !/.repos/
138 !/apps/mobile/modules/t3-terminal/Vendor/**/*.a
139 sparse-checkout-cone-mode: false
140
141 - uses: ./.github/actions/setup-apt-mirrors
142 if: needs.changes.outputs.build != 'false'
143
144 # Runs in the background while Vite+ installs; the step before the build waits for it.
145 # Xvfb is for the desktop launch check below.
146 - name: Start installing browser secret helper build libraries
147 if: needs.changes.outputs.build != 'false'
148 run: |
149 # Fetch only the indexes these main and universe packages need. The full set is ~42 MB,
150 # which a slow mirror can stretch past the wait below.
151 sudo sed -i -e 's|http://|https://|g' -e 's/^Components: .*/Components: main universe/' \
152 /etc/apt/blacksmith-ubuntu-mirrors.txt /etc/apt/sources.list.d/ubuntu.sources
153 (
154 set +e
155 sudo apt-get update -o Acquire::Languages=none \
156 -o Acquire::IndexTargets::deb::DEP-11::DefaultEnabled=false \
157 -o Acquire::IndexTargets::deb::CNF::DefaultEnabled=false &&
158 sudo apt-get install -y libsecret-1-dev pkg-config xvfb
159 echo "$?" > "$RUNNER_TEMP/apt-status"
160 ) > "$RUNNER_TEMP/apt.log" 2>&1 < /dev/null &
161
162 - name: Setup Vite+
163 uses: ./.github/actions/setup-ci-deps
164 with:
165 task-cache-read-token: ${{ secrets.T3_TASK_CACHE_READ_TOKEN }}
166
167 # electron's install.js (run by ensure:electron) reads this cache before it
168 # downloads from GitHub. The key changes only with the Electron version.
169 - name: Cache Electron download
170 uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
171 with:
172 path: ~/.cache/electron
173 key: electron-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('node_modules/.pnpm/electron@*/node_modules/electron/package.json') }}
174
175 - name: Ensure Electron runtime is installed
176 id: electron
177 run: vp run --filter @t3tools/desktop ensure:electron
178
179 # Runs in the background while the build runs, and reports in the last
180 # step: neither result hides the other.
181 - name: Start typecheck
182 id: typecheck
183 if: ${{ !cancelled() && steps.electron.outcome == 'success' && needs.changes.outputs.typecheck != 'false' }}
184 run: |
185 (
186 set +e
187 vpr typecheck
188 echo "$?" > "$RUNNER_TEMP/typecheck-status"
189 ) > "$RUNNER_TEMP/typecheck.log" 2>&1 < /dev/null &
190
191 - name: Finish installing browser secret helper build libraries
192 id: apt
193 if: ${{ !cancelled() && needs.changes.outputs.build != 'false' }}
194 timeout-minutes: 5
195 run: |
196 until test -s "$RUNNER_TEMP/apt-status"; do sleep 1; done
197 cat "$RUNNER_TEMP/apt.log"
198 exit "$(cat "$RUNNER_TEMP/apt-status")"
199
200 - name: Build desktop pipeline
201 id: build
202 if: ${{ !cancelled() && steps.electron.outcome == 'success' && steps.apt.outcome == 'success' && needs.changes.outputs.build != 'false' }}
203 run: vp run build:desktop
204
205 - name: Verify preload bundle output
206 if: ${{ !cancelled() && steps.build.outcome == 'success' }}
207 run: node apps/desktop/scripts/verify-preload-bundle.mjs
208
209 # The release launch check, run unpackaged against the same old-state fixture, for
210 # startup and sidebar changes. Packaging and signing stay release-only.
211 - name: Open the seeded thread in the built desktop app
212 id: desktop_launch
213 if: ${{ !cancelled() && steps.build.outcome == 'success' && needs.changes.outputs.desktop_launch != 'false' }}
214 timeout-minutes: 4
215 run: |
216 electron=$(node -p "require('./apps/desktop/node_modules/electron')")
217 xvfb-run -a node scripts/smoke-desktop-app.ts --executable "$electron" --app apps/desktop \
218 --artifacts-dir "$RUNNER_TEMP/desktop-launch-check"
219
220 - name: Upload desktop launch check
221 if: ${{ failure() && steps.desktop_launch.outcome == 'failure' }}
222 uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
223 with:
224 name: desktop-launch-check
225 path: ${{ runner.temp }}/desktop-launch-check
226 if-no-files-found: ignore
227
228 # Browser tests run source modules; this boots the production chunk graph. The
229 # desktop build above already produced apps/web/dist, and the client waits about
230 # 15s for a session that never comes, so this runs here instead of in Test Web,
231 # which gates the whole run. Chromium comes from the cache Test Web shares.
232 - name: Resolve Playwright version
233 id: playwright_version
234 if: ${{ !cancelled() && steps.build.outcome == 'success' && needs.changes.outputs.test_web != 'false' }}
235 run: echo "version=$(node -p "require('./apps/web/node_modules/playwright/package.json').version")" >> "$GITHUB_OUTPUT"
236
237 - name: Cache Chromium
238 id: chromium_cache
239 if: ${{ !cancelled() && steps.build.outcome == 'success' && needs.changes.outputs.test_web != 'false' }}
240 uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
241 with:
242 path: ~/.cache/ms-playwright
243 key: playwright-chromium-shell-${{ runner.os }}-${{ runner.arch }}-${{ steps.playwright_version.outputs.version }}
244
245 - name: Install Chromium for the built web client boot check
246 if: ${{ !cancelled() && steps.build.outcome == 'success' && needs.changes.outputs.test_web != 'false' && steps.chromium_cache.outputs.cache-hit != 'true' }}
247 run: node apps/web/node_modules/playwright/cli.js install --only-shell chromium
248
249 - name: Install missing Chromium system dependencies
250 if: ${{ !cancelled() && steps.build.outcome == 'success' && needs.changes.outputs.test_web != 'false' }}
251 run: |
252 browser=$(find "$HOME/.cache/ms-playwright" -name chrome-headless-shell -type f -print -quit)
253 test -n "$browser"
254 if ldd "$browser" | grep '=> not found'; then
255 node apps/web/node_modules/playwright/cli.js install-deps chromium
256 fi
257
258 - name: Boot the built web client
259 if: ${{ !cancelled() && steps.build.outcome == 'success' && needs.changes.outputs.test_web != 'false' }}
260 timeout-minutes: 3
261 run: node apps/web/scripts/verify-built-boot.ts
262
263 - name: Typecheck
264 if: ${{ !cancelled() && steps.typecheck.outcome == 'success' }}
265 timeout-minutes: 5
266 run: |
267 until test -s "$RUNNER_TEMP/typecheck-status"; do sleep 1; done
268 cat "$RUNNER_TEMP/typecheck.log"
269 exit "$(cat "$RUNNER_TEMP/typecheck-status")"
270
271 # Everything except `t3` (apps/server) and the web app, which has its own job
272 # below. `--parallel` drops the package dependency ordering that `vp run`
273 # applies by default: these `test` tasks declare no `dependsOn` and resolve
274 # workspace deps from source, so ordering only bought us idle runners between
275 # dependency layers. The concurrency limit stays at the default 4 so peak load
276 # per runner is unchanged.
277 test:
278 permissions:
279 contents: read
280 id-token: write
281 name: Test
282 needs: changes
283 if: ${{ !cancelled() && needs.changes.outputs.test != 'false' }}
284 runs-on: blacksmith-8vcpu-ubuntu-2404
285 timeout-minutes: 10
286 steps:
287 - name: Checkout
288 uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
289 with:
290 sparse-checkout: |
291 /*
292 !/.repos/
293 !/apps/mobile/modules/t3-terminal/Vendor/**/*.a
294 sparse-checkout-cone-mode: false
295
296 - uses: ./.github/actions/setup-apt-mirrors
297
298 # The desktop tests compile the browser secret helper. The install runs in
299 # the background while Vite+ installs; the step before the tests waits for it.
300 - name: Start installing browser secret helper build libraries
301 run: |
302 # Fetch only the indexes these main and universe packages need. The full set is ~42 MB,
303 # which a slow mirror can stretch past the wait below.
304 sudo sed -i -e 's|http://|https://|g' -e 's/^Components: .*/Components: main universe/' \
305 /etc/apt/blacksmith-ubuntu-mirrors.txt /etc/apt/sources.list.d/ubuntu.sources
306 (
307 set +e
308 sudo apt-get update -o Acquire::Languages=none \
309 -o Acquire::IndexTargets::deb::DEP-11::DefaultEnabled=false \
310 -o Acquire::IndexTargets::deb::CNF::DefaultEnabled=false &&
311 sudo apt-get install -y libsecret-1-dev pkg-config
312 echo "$?" > "$RUNNER_TEMP/apt-status"
313 ) > "$RUNNER_TEMP/apt.log" 2>&1 < /dev/null &
314
315 - name: Setup Vite+
316 uses: ./.github/actions/setup-ci-deps
317 with:
318 task-cache-read-token: ${{ secrets.T3_TASK_CACHE_READ_TOKEN }}
319
320 # electron's install.js (run by ensure:electron) reads this cache before it
321 # downloads from GitHub. The key changes only with the Electron version.
322 - name: Cache Electron download
323 uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
324 with:
325 path: ~/.cache/electron
326 key: electron-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('node_modules/.pnpm/electron@*/node_modules/electron/package.json') }}
327
328 - name: Ensure Electron runtime is installed
329 run: vp run --filter @t3tools/desktop ensure:electron
330
331 - name: Test preview artifact validation
332 run: python3 -B .github/scripts/stage-preview-bundle.test.py
333
334 - name: Test release checks
335 run: node --test .github/scripts/check-nightly-release.test.cjs .github/scripts/vercel-deployment-output.test.cjs .github/scripts/mobile-preview-comment.test.cjs .github/scripts/mobile-ios-preview-record.test.cjs .github/scripts/test-delta.test.cjs
336
337 - name: Finish installing browser secret helper build libraries
338 timeout-minutes: 5
339 run: |
340 until test -s "$RUNNER_TEMP/apt-status"; do sleep 1; done
341 cat "$RUNNER_TEMP/apt.log"
342 exit "$(cat "$RUNNER_TEMP/apt-status")"
343
344 # `changes` lists the affected packages, or nothing when all of them are.
345 - name: Test
346 env:
347 TEST_PACKAGES: ${{ needs.changes.outputs.test_packages }}
348 run: |
349 set -o pipefail
350 filters=(--filter '!t3' --filter '!@t3tools/monorepo' --filter '!@t3tools/web')
351 if [[ -n "$TEST_PACKAGES" ]]; then
352 filters=()
353 for package in $TEST_PACKAGES; do filters+=(--filter "$package"); done
354 fi
355 # The runner's trace writer can crash on surrogate pairs in test output.
356 vp run --parallel --concurrency-limit 4 "${filters[@]}" test 2>&1 | python3 -u -c '
357 import sys
358 for line in sys.stdin:
359 sys.stdout.write(line.encode("ascii", "backslashreplace").decode("ascii"))
360 '
361
362 # The web suite is the largest outside the server. In the shared Test job it
363 # started last and ran alone for about 40s after everything else finished.
364 # Browser tests are bound by the Vite server transforming modules for each
365 # file, not by Chromium, so a second runner (and Vite server) halves the job
366 # that gated every run. release.yml mirrors this test, test_web, and test_server split.
367 test_web:
368 permissions:
369 contents: read
370 id-token: write
371 name: Test Web ${{ matrix.shard }}
372 needs: changes
373 if: ${{ !cancelled() && needs.changes.outputs.test_web != 'false' }}
374 runs-on: blacksmith-8vcpu-ubuntu-2404
375 timeout-minutes: 10
376 strategy:
377 fail-fast: false
378 matrix:
379 shard: [1, 2]
380 steps:
381 - name: Checkout
382 uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
383 with:
384 sparse-checkout: |
385 /*
386 !/.repos/
387 !/apps/mobile/modules/t3-terminal/Vendor/**/*.a
388 sparse-checkout-cone-mode: false
389
390 - name: Setup Vite+
391 uses: ./.github/actions/setup-ci-deps
392 with:
393 task-cache-read-token: ${{ secrets.T3_TASK_CACHE_READ_TOKEN }}
394
395 # The browser project runs React tests in headless Chromium. Same cache key as
396 # test_server, so both jobs share one downloaded browser.
397 - name: Resolve Playwright version
398 id: playwright_version
399 run: echo "version=$(node -p "require('./apps/web/node_modules/playwright/package.json').version")" >> "$GITHUB_OUTPUT"
400
401 - name: Cache Chromium
402 id: chromium_cache
403 uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
404 with:
405 path: ~/.cache/ms-playwright
406 key: playwright-chromium-shell-${{ runner.os }}-${{ runner.arch }}-${{ steps.playwright_version.outputs.version }}
407
408 - name: Install Chromium for web browser tests
409 if: steps.chromium_cache.outputs.cache-hit != 'true'
410 run: node apps/web/node_modules/playwright/cli.js install --only-shell chromium
411
412 - name: Install missing Chromium system dependencies
413 run: |
414 browser=$(find "$HOME/.cache/ms-playwright" -name chrome-headless-shell -type f -print -quit)
415 test -n "$browser"
416 if ldd "$browser" | grep '=> not found'; then
417 node apps/web/node_modules/playwright/cli.js install-deps chromium
418 fi
419
420 - name: Test
421 run: vp run --filter @t3tools/web test --shard ${{ matrix.shard }}/${{ strategy.job-total }}
422
423 # apps/server sets `fileParallelism: false`, so its test files run strictly
424 # one at a time. Sharding spreads them over separate runners instead of
425 # separate workers, so no two server test files ever share a machine and the
426 # isolation that flag buys is preserved exactly. One file at a time keeps
427 # about 1.5 cores busy, so 4 vCPU runners lose nothing against 8. The shards
428 # split files by recorded duration (apps/server/src/testUtils/weightedShardSequencer.ts).
429 # The shards are the longest jobs, so they gate themselves instead of waiting
430 # ~15s for `changes`: a shard the change cannot affect stops after checkout.
431 test_server:
432 permissions:
433 contents: read
434 id-token: write
435 name: Test Server ${{ matrix.shard }}
436 runs-on: blacksmith-4vcpu-ubuntu-2404
437 # Shards take 2-5 minutes. When the shared task cache throttles reads, each
438 # failed fetch stalls vp for 15-90s, which pushed shards past 10 minutes.
439 timeout-minutes: 20
440 strategy:
441 fail-fast: false
442 matrix:
443 shard: [1, 2, 3, 4, 5, 6, 7, 8]
444 steps:
445 # Depth 2 brings the base commit the change is diffed against.
446 - name: Checkout
447 uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
448 with:
449 fetch-depth: 2
450 sparse-checkout: |
451 /*
452 !/.repos/
453 !/apps/mobile/modules/t3-terminal/Vendor/**/*.a
454 sparse-checkout-cone-mode: false
455
456 - name: Detect affected jobs
457 id: changes
458 uses: ./.github/actions/ci-changes
459
460 - name: Setup Vite+
461 if: steps.changes.outputs.test_server != 'false'
462 uses: ./.github/actions/setup-ci-deps
463 with:
464 task-cache-read-token: ${{ secrets.T3_TASK_CACHE_READ_TOKEN }}
465
466 # No Electron setup here: `t3` (apps/server) has no Electron dependency
467 # and none of its tests touch the runtime. Only the non-server `test`
468 # job, which covers @t3tools/desktop, needs the download.
469 # Cache the pinned browser and skip apt unless shared libraries are missing.
470 - name: Resolve Playwright version
471 id: playwright_version
472 if: steps.changes.outputs.test_server != 'false'
473 run: echo "version=$(node -p "require('./apps/server/node_modules/playwright-core/package.json').version")" >> "$GITHUB_OUTPUT"
474
475 - name: Cache Chromium
476 id: chromium_cache
477 if: steps.changes.outputs.test_server != 'false'
478 uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
479 with:
480 path: ~/.cache/ms-playwright
481 key: playwright-chromium-shell-${{ runner.os }}-${{ runner.arch }}-${{ steps.playwright_version.outputs.version }}
482
483 - name: Install Chromium for server browser integration tests
484 if: steps.changes.outputs.test_server != 'false' && steps.chromium_cache.outputs.cache-hit != 'true'
485 run: node apps/server/node_modules/playwright-core/cli.js install --only-shell chromium
486
487 - name: Install missing Chromium system dependencies
488 if: steps.changes.outputs.test_server != 'false'
489 run: |
490 browser=$(find "$HOME/.cache/ms-playwright" -name chrome-headless-shell -type f -print -quit)
491 test -n "$browser"
492 if ldd "$browser" | grep '=> not found'; then
493 node apps/server/node_modules/playwright-core/cli.js install-deps chromium
494 fi
495
496 # Each server test file runs in its own Vitest process, and a fresh install starts
497 # Vitest's content-keyed module cache empty, so every file re-transformed its imports.
498 # Only pushes to main save it, so pull requests never evict each other's entries.
499 - name: Restore Vitest module cache
500 if: steps.changes.outputs.test_server != 'false'
501 uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
502 with:
503 path: node_modules/.vitest-cache
504 key: vitest-modules-server-${{ matrix.shard }}-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.sha }}
505 restore-keys: vitest-modules-server-${{ matrix.shard }}-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }}-
506
507 - name: Test
508 if: steps.changes.outputs.test_server != 'false'
509 env:
510 T3CODE_TRANSFER_BUDGET_REPORT_PATH: ${{ runner.temp }}/t3code-transfer-budget.md
511 T3CODE_TRANSFER_BUDGET_RESULT_PATH: ${{ runner.temp }}/thread-transfer-result.json
512 T3CODE_TRANSFER_BUDGET_SCENARIOS_PATH: ${{ runner.temp }}/thread-transfer-scenarios.json
513 # One process per file spends ~2s starting before its tests run; one file per vCPU overlaps that.
514 run: >-
515 vp run test:cached -- --shard ${{ matrix.shard }}/${{ strategy.job-total }} --concurrency 4
516 --uncached apps/server/integration/transferBudgetV2.integration.test.ts
517 --verify-hits 1 apps/server
518
519 - name: Save Vitest module cache
520 if: github.event_name == 'push' && steps.changes.outputs.test_server != 'false'
521 uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
522 with:
523 path: node_modules/.vitest-cache
524 key: vitest-modules-server-${{ matrix.shard }}-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.sha }}
525
526 # integration/transferBudgetV2.integration.test.ts writes the report; exactly one shard
527 # produces these files. Gating the upload on their presence keeps a
528 # single `thread-transfer-results` artifact per run, which is the name
529 # thread-transfer-report.yml resolves.
530 - name: Detect transfer budget report
531 id: transfer_budget
532 if: always()
533 run: |
534 if test -f "${{ runner.temp }}/thread-transfer-result.json"; then
535 echo "present=true" >> "$GITHUB_OUTPUT"
536 else
537 echo "present=false" >> "$GITHUB_OUTPUT"
538 fi
539
540 - name: Publish transfer budget report
541 if: always() && steps.transfer_budget.outputs.present == 'true'
542 run: |
543 if test -f "${{ runner.temp }}/t3code-transfer-budget.md"; then
544 tee -a "$GITHUB_STEP_SUMMARY" < "${{ runner.temp }}/t3code-transfer-budget.md"
545 else
546 echo "Transfer budget report was not produced." >> "$GITHUB_STEP_SUMMARY"
547 fi
548
549 - name: Upload thread transfer result
550 if: always() && steps.transfer_budget.outputs.present == 'true'
551 uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
552 with:
553 name: thread-transfer-results
554 path: |
555 ${{ runner.temp }}/thread-transfer-result.json
556 ${{ runner.temp }}/thread-transfer-scenarios.json
557 if-no-files-found: ignore
558 retention-days: 30
559
560 # Split out of Check and Test: both paid ~7-9s to install a Rust toolchain
561 # for checks that take under 3s, on the critical path of every PR.
562 rust:
563 name: Rust
564 needs: changes
565 if: ${{ !cancelled() && needs.changes.outputs.rust != 'false' }}
566 runs-on: blacksmith-4vcpu-ubuntu-2404
567 timeout-minutes: 10
568 steps:
569 - name: Checkout
570 uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
571 with:
572 sparse-checkout: |
573 /*
574 !/.repos/
575 !/apps/mobile/modules/t3-terminal/Vendor/**/*.a
576 sparse-checkout-cone-mode: false
577
578 - name: Setup Rust
579 uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # master
580 with:
581 toolchain: stable
582 components: rustfmt
583
584 - name: Check Rust formatting
585 run: |
586 for crate in resource-monitor kde-snap-shot hyprland-snap-shot; do
587 cargo fmt --manifest-path "native/$crate/Cargo.toml" -- --check
588 done
589
590 - name: Test Rust crates
591 run: |
592 for crate in resource-monitor kde-snap-shot hyprland-snap-shot; do
593 cargo test --locked --manifest-path "native/$crate/Cargo.toml"
594 done
595
596 mobile_native_static_analysis:
597 name: Mobile Native Static Analysis
598 needs: changes
599 if: ${{ !cancelled() && needs.changes.outputs.mobile_native != 'false' }}
600 runs-on: blacksmith-6vcpu-macos-27
601 timeout-minutes: 10
602 steps:
603 - name: Checkout
604 uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
605 with:
606 sparse-checkout: |
607 /*
608 !/.repos/
609 sparse-checkout-cone-mode: false
610
611 - name: Setup Vite+
612 uses: voidzero-dev/setup-vp@250f29ce396baf5e8f24498e17c0dfdebabc26eb # v1.15.0
613 with:
614 node-version-file: package.json
615 cache: true
616 run-install: |
617 args:
618 - --filter=@t3tools/scripts...
619
620 - name: Install mobile native static analysis tools
621 run: brew bundle install --file apps/mobile/Brewfile
622
623 - name: Lint mobile native sources
624 run: vp run lint:mobile
625
626 release_smoke:
627 permissions:
628 contents: read
629 id-token: write
630 name: Release Smoke
631 needs: changes
632 if: ${{ !cancelled() && needs.changes.outputs.release_smoke != 'false' }}
633 runs-on: blacksmith-8vcpu-ubuntu-2404
634 timeout-minutes: 15
635 steps:
636 - name: Checkout
637 uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
638 with:
639 sparse-checkout: |
640 /*
641 !/.repos/
642 !/apps/mobile/modules/t3-terminal/Vendor/**/*.a
643 sparse-checkout-cone-mode: false
644
645 - name: Setup Vite+
646 uses: ./.github/actions/setup-ci-deps
647 with:
648 task-cache-read-token: ${{ secrets.T3_TASK_CACHE_READ_TOKEN }}
649
650 - name: Exercise release-only workflow steps
651 run: node scripts/release-smoke.ts
652
653 # Branch protection requires this job by its name, `Check`. It fails when any
654 # other job fails, is cancelled, or is skipped without a reason, so splitting
655 # or resharding jobs needs no ruleset change. Add every new job to `needs`.
656 # `always()` rather than `!cancelled()`: a skipped job reports success to
657 # branch protection, so a cancelled run must still produce a failing check.
658 check:
659 name: Check
660 if: ${{ always() }}
661 needs:
662 [
663 changes,
664 lint,
665 build,
666 test,
667 test_web,
668 test_server,
669 rust,
670 mobile_native_static_analysis,
671 release_smoke,
672 ]
673 runs-on: blacksmith-2vcpu-ubuntu-2404
674 timeout-minutes: 5
675 steps:
676 - name: Require every job to pass
677 env:
678 RESULTS: ${{ toJSON(needs) }}
679 run: |
680 echo "$RESULTS" | jq -r 'to_entries[] | "\(.key): \(.value.result)"'
681 # A job may skip only when `changes` said every gate it represents was
682 # not needed. Gates are keyed by job name, except merged Build and the
683 # macOS lint.
684 echo "$RESULTS" | jq -e '.changes.outputs as $gates
685 | {build: ["build", "typecheck", "desktop_launch"], mobile_native_static_analysis: ["mobile_native"]} as $renamed
686 | all(to_entries[];
687 .value.result == "success"
688 or (.value.result == "skipped"
689 and (($renamed[.key] // [.key]) | all(.[]; $gates[.] == "false"))))' > /dev/null
690
691 # thread-transfer-report.yml reads this artifact after CI, so a run whose
692 # server tests ran must have produced it.
693 - name: Require transfer measurements
694 if: needs.test_server.result == 'success' && needs.changes.outputs.test_server != 'false'
695 uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
696 with:
697 name: thread-transfer-results
698 path: ${{ runner.temp }}/thread-transfer