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