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 check:
18 name: Check
19 runs-on: blacksmith-8vcpu-ubuntu-2404
20 timeout-minutes: 10
21 steps:
22 - name: Checkout
23 uses: actions/checkout@v6
24 with:
25 sparse-checkout: |
26 /*
27 !/.repos/
28 sparse-checkout-cone-mode: false
29
30 - name: Reject repository-owned PR assets
31 run: |
32 files="$(git ls-files .github/pr-assets)"
33 if test -n "$files"; then
34 printf 'PR evidence must be uploaded to GitHub, not committed:\n%s\n' "$files" >&2
35 exit 1
36 fi
37
38 - name: Setup Vite+
39 uses: voidzero-dev/setup-vp@v1
40 with:
41 node-version-file: package.json
42 cache: true
43 run-install: true
44
45 - name: Ensure Electron runtime is installed
46 run: vp run --filter @t3tools/desktop ensure:electron
47
48 # Files/dependencies are repo-wide; export checks cover clean workspaces only.
49 - name: Check unused code
50 run: vp run knip:check
51
52 - name: Check
53 run: vp check
54
55 - name: Typecheck
56 run: vpr typecheck
57
58 - uses: ./.github/actions/setup-apt-mirrors
59
60 - name: Install browser secret helper build libraries
61 run: |
62 sudo sed -i 's|http://|https://|g' /etc/apt/blacksmith-ubuntu-mirrors.txt /etc/apt/sources.list.d/ubuntu.sources
63 sudo apt-get update && sudo apt-get install -y libsecret-1-dev pkg-config
64
65 - name: Build desktop pipeline
66 run: vp run build:desktop
67
68 - name: Verify preload bundle output
69 run: node apps/desktop/scripts/verify-preload-bundle.mjs
70
71 # Everything except `t3` (apps/server). `--parallel` drops the package
72 # dependency ordering that `vp run` applies by default: these `test` tasks
73 # declare no `dependsOn` and resolve workspace deps from source, so ordering
74 # only bought us idle runners between dependency layers. The concurrency
75 # limit stays at the default 4 so peak load per runner is unchanged.
76 test:
77 name: Test
78 runs-on: blacksmith-8vcpu-ubuntu-2404
79 timeout-minutes: 10
80 steps:
81 - name: Checkout
82 uses: actions/checkout@v6
83 with:
84 sparse-checkout: |
85 /*
86 !/.repos/
87 sparse-checkout-cone-mode: false
88
89 # Blacksmith boots GitHub's Ubuntu runner image (gcc is usually present),
90 # but ACP process-tree live tests compile a small pthread fixture with `cc`
91 # and soft-skip when it is missing. Install build-essential so that path
92 # always runs in CI instead of silently no-oping.
93 - name: Install C toolchain for process-tree fixtures
94 run: |
95 sudo apt-get update
96 sudo apt-get install -y --no-install-recommends build-essential
97 command -v cc
98
99 - name: Setup Vite+
100 uses: voidzero-dev/setup-vp@v1
101 with:
102 node-version-file: package.json
103 cache: true
104 run-install: true
105
106 - name: Ensure Electron runtime is installed
107 run: vp run --filter @t3tools/desktop ensure:electron
108
109 - uses: ./.github/actions/setup-apt-mirrors
110
111 - name: Install browser secret helper build libraries
112 run: |
113 sudo sed -i 's|http://|https://|g' /etc/apt/blacksmith-ubuntu-mirrors.txt /etc/apt/sources.list.d/ubuntu.sources
114 sudo apt-get update && sudo apt-get install -y libsecret-1-dev pkg-config
115
116 - name: Test preview artifact validation
117 run: python3 -B .github/scripts/stage-preview-bundle.test.py
118
119 - name: Test nightly release checks
120 run: node --test .github/scripts/check-nightly-release.test.cjs
121
122 - name: Test
123 run: vp run --parallel --concurrency-limit 4 --filter '!t3' --filter '!@t3tools/monorepo' test
124
125 # apps/server sets `fileParallelism: false`, so its 239 files run strictly
126 # one at a time. Sharding spreads them over separate runners instead of
127 # separate workers, so no two server test files ever share a machine and the
128 # isolation that flag buys is preserved exactly.
129 test_server:
130 name: Test Server ${{ matrix.shard }}
131 runs-on: blacksmith-8vcpu-ubuntu-2404
132 timeout-minutes: 10
133 strategy:
134 fail-fast: false
135 matrix:
136 shard: [1, 2, 3]
137 steps:
138 - name: Checkout
139 uses: actions/checkout@v6
140 with:
141 sparse-checkout: |
142 /*
143 !/.repos/
144 sparse-checkout-cone-mode: false
145
146 - name: Setup Vite+
147 uses: voidzero-dev/setup-vp@v1
148 with:
149 node-version-file: package.json
150 cache: true
151 run-install: true
152
153 # No Electron setup here: `t3` (apps/server) has no Electron dependency
154 # and none of its tests touch the runtime. Only the non-server `test`
155 # job, which covers @t3tools/desktop, needs the download.
156 - name: Test
157 env:
158 T3CODE_TRANSFER_BUDGET_REPORT_PATH: ${{ runner.temp }}/t3code-transfer-budget.md
159 T3CODE_TRANSFER_BUDGET_RESULT_PATH: ${{ runner.temp }}/thread-transfer-result.json
160 run: vp run --filter t3 test --shard ${{ matrix.shard }}/${{ strategy.job-total }}
161
162 # src/server.test.ts writes the budget report, so exactly one shard
163 # produces these files. Gating the upload on their presence keeps a
164 # single `thread-transfer-results` artifact per run, which is the name
165 # thread-transfer-report.yml resolves.
166 - name: Detect transfer budget report
167 id: transfer_budget
168 if: always()
169 run: |
170 if test -f "${{ runner.temp }}/thread-transfer-result.json"; then
171 echo "present=true" >> "$GITHUB_OUTPUT"
172 else
173 echo "present=false" >> "$GITHUB_OUTPUT"
174 fi
175
176 - name: Publish transfer budget report
177 if: always() && steps.transfer_budget.outputs.present == 'true'
178 run: |
179 if test -f "${{ runner.temp }}/t3code-transfer-budget.md"; then
180 tee -a "$GITHUB_STEP_SUMMARY" < "${{ runner.temp }}/t3code-transfer-budget.md"
181 else
182 echo "Transfer budget report was not produced." >> "$GITHUB_STEP_SUMMARY"
183 fi
184
185 - name: Upload thread transfer result
186 if: always() && steps.transfer_budget.outputs.present == 'true'
187 uses: actions/upload-artifact@v7
188 with:
189 name: thread-transfer-results
190 path: ${{ runner.temp }}/thread-transfer-result.json
191 if-no-files-found: ignore
192 retention-days: 30
193
194 # Split out of Check and Test: both paid ~7-9s to install a Rust toolchain
195 # for checks that take under 3s, on the critical path of every PR.
196 rust:
197 name: Rust
198 runs-on: blacksmith-4vcpu-ubuntu-2404
199 timeout-minutes: 10
200 steps:
201 - name: Checkout
202 uses: actions/checkout@v6
203 with:
204 sparse-checkout: |
205 /*
206 !/.repos/
207 sparse-checkout-cone-mode: false
208
209 - name: Setup Rust
210 uses: dtolnay/rust-toolchain@stable
211 with:
212 components: rustfmt
213
214 - name: Check Rust formatting
215 run: |
216 for crate in resource-monitor kde-snap-shot hyprland-snap-shot; do
217 cargo fmt --manifest-path "native/$crate/Cargo.toml" -- --check
218 done
219
220 - name: Test Rust crates
221 run: |
222 for crate in resource-monitor kde-snap-shot hyprland-snap-shot; do
223 cargo test --locked --manifest-path "native/$crate/Cargo.toml"
224 done
225
226 # The static analysis below needs a macOS runner, which bills ~6.7x a Linux
227 # minute, so gate it on the native sources it actually lints instead of paying
228 # for it on every push. Detection is API-only (no checkout) and fails open: if
229 # the diff cannot be resolved, the lint runs.
230 mobile_native_changes:
231 name: Mobile Native Changes
232 runs-on: blacksmith-2vcpu-ubuntu-2404
233 timeout-minutes: 5
234 permissions:
235 contents: read
236 pull-requests: read
237 outputs:
238 changed: ${{ steps.detect.outputs.changed }}
239 steps:
240 - name: Detect mobile native changes
241 id: detect
242 env:
243 GH_TOKEN: ${{ github.token }}
244 PR_NUMBER: ${{ github.event.pull_request.number }}
245 BEFORE_SHA: ${{ github.event.before }}
246 run: |
247 set -uo pipefail
248
249 fail_open() {
250 echo "$* Running native static analysis."
251 echo "changed=true" >> "$GITHUB_OUTPUT"
252 exit 0
253 }
254
255 count_rows() {
256 printf '%s\n' "$1" | grep -c . || true
257 }
258
259 # One row per changed file, holding the new path and, for a rename,
260 # the path it replaced: renaming a matched file out of the matched
261 # paths removes a lint input just like editing it.
262 row='[.filename, (.previous_filename // empty)] | @tsv'
263
264 if [[ -n "${PR_NUMBER}" ]]; then
265 # The PR files endpoint stops at 3000 files and pagination cannot
266 # extend it, so cross-check against the count the PR itself reports.
267 expected=$(gh api "repos/${GITHUB_REPOSITORY}/pulls/${PR_NUMBER}" --jq '.changed_files') \
268 || fail_open "Could not read the pull request."
269 rows=$(gh api "repos/${GITHUB_REPOSITORY}/pulls/${PR_NUMBER}/files" --paginate --jq ".[] | ${row}") \
270 || fail_open "Could not resolve changed files."
271
272 listed=$(count_rows "$rows")
273 if [[ "$listed" -lt "$expected" ]]; then
274 fail_open "GitHub listed only ${listed} of ${expected} changed files."
275 fi
276 else
277 rows=$(gh api "repos/${GITHUB_REPOSITORY}/compare/${BEFORE_SHA}...${GITHUB_SHA}" --jq ".files[]? | ${row}") \
278 || fail_open "Could not resolve changed files."
279
280 # The compare endpoint reports at most 300 files and pagination does
281 # not extend that list, so a full list may be hiding native changes.
282 listed=$(count_rows "$rows")
283 if [[ "$listed" -ge 300 ]]; then
284 fail_open "GitHub listed ${listed} changed files, the compare endpoint maximum."
285 fi
286 fi
287
288 paths=$(tr '\t' '\n' <<< "$rows")
289
290 # Sources scripts/mobile-native-static-check.ts lints, plus the tool
291 # and rule configuration that decides how it lints them, plus the
292 # root package.json that defines the lint:mobile command.
293 pattern='^apps/mobile/.*\.(swift|kt|kts)$|^apps/mobile/(\.swiftlint\.yml|detekt\.yml|\.editorconfig|Brewfile)$|^scripts/mobile-native-static-check\.ts$|^package\.json$|^\.github/workflows/ci\.yml$'
294
295 if grep -qE "$pattern" <<< "$paths"; then
296 echo "Native sources or lint configuration changed:"
297 grep -E "$pattern" <<< "$paths"
298 echo "changed=true" >> "$GITHUB_OUTPUT"
299 else
300 echo "No mobile native sources or lint configuration changed."
301 echo "changed=false" >> "$GITHUB_OUTPUT"
302 fi
303
304 mobile_native_static_analysis:
305 name: Mobile Native Static Analysis
306 needs: mobile_native_changes
307 # Skip only on an explicit "no": a gate job that failed or errored leaves the
308 # output empty, and that must run the lint rather than silently skip it.
309 if: ${{ !cancelled() && needs.mobile_native_changes.outputs.changed != 'false' }}
310 runs-on: blacksmith-6vcpu-macos-26
311 timeout-minutes: 10
312 steps:
313 - name: Checkout
314 uses: actions/checkout@v6
315 with:
316 sparse-checkout: |
317 /*
318 !/.repos/
319 sparse-checkout-cone-mode: false
320
321 - name: Setup Vite+
322 uses: voidzero-dev/setup-vp@v1
323 with:
324 node-version-file: package.json
325 cache: true
326 run-install: |
327 args:
328 - --filter=@t3tools/scripts...
329
330 - name: Install mobile native static analysis tools
331 run: brew bundle install --file apps/mobile/Brewfile
332
333 - name: Lint mobile native sources
334 run: vp run lint:mobile
335
336 release_smoke:
337 name: Release Smoke
338 runs-on: blacksmith-8vcpu-ubuntu-2404
339 timeout-minutes: 10
340 steps:
341 - name: Checkout
342 uses: actions/checkout@v6
343 with:
344 sparse-checkout: |
345 /*
346 !/.repos/
347 sparse-checkout-cone-mode: false
348
349 - name: Setup Vite+
350 uses: voidzero-dev/setup-vp@v1
351 with:
352 node-version-file: package.json
353 cache: true
354 run-install: |
355 args:
356 - --filter=@t3tools/scripts...
357
358 - name: Exercise release-only workflow steps
359 run: node scripts/release-smoke.ts