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