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