forked from pingdotgg/t3code
-
Notifications
You must be signed in to change notification settings - Fork 0
404 lines (345 loc) · 13.2 KB
/
Copy pathci.yml
File metadata and controls
404 lines (345 loc) · 13.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
name: CI
on:
merge_group:
pull_request:
push:
branches:
- main
concurrency:
group: ci-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
check:
name: Check
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v6
with:
sparse-checkout: |
/*
!/.repos/
sparse-checkout-cone-mode: false
- name: Setup Vite+
uses: voidzero-dev/setup-vp@v1
with:
node-version-file: package.json
cache: true
run-install: true
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: Ensure Electron runtime is installed
run: vp run --filter @t3tools/desktop ensure:electron
- name: Check
run: vp check
- name: Codex usage auth guard
run: node scripts/codex-usage-auth-guard.mjs
- name: Typecheck
run: vpr typecheck
- name: Check resource monitor formatting
run: cargo fmt --manifest-path native/resource-monitor/Cargo.toml -- --check
- name: Build desktop pipeline
run: vp run build:desktop
- name: Verify preload bundle output
run: |
test -f apps/desktop/dist-electron/preload.cjs
grep -nE "desktopBridge|getLocalEnvironmentBootstrap|PICK_FOLDER_CHANNEL|wsUrl" apps/desktop/dist-electron/preload.cjs
grep -n "__clerk_internal_electron_passkeys" apps/desktop/dist-electron/preload.cjs
desktop_linux_package_smoke:
name: Desktop Linux Package Smoke
if: github.event_name == 'pull_request'
runs-on: ubuntu-24.04
timeout-minutes: 45
steps:
- name: Checkout
uses: actions/checkout@v6
with:
sparse-checkout: |
/*
!/.repos/
sparse-checkout-cone-mode: false
- name: Install launch smoke dependencies
run: |
sudo apt-get update
sudo apt-get install -y xvfb imagemagick libgtk-3-0 libnss3 libasound2t64 libgbm1
- name: Setup Vite+
uses: voidzero-dev/setup-vp@v1
with:
node-version-file: package.json
cache: true
run-install: true
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
- name: Ensure Electron runtime is installed
run: vp run --filter @t3tools/desktop ensure:electron
- name: Build Linux desktop artifact
run: vp run dist:desktop:linux
- name: Launch packaged Linux desktop app
run: xvfb-run -a node scripts/desktop-launch-smoke.mjs --artifact "release/*.AppImage" --timeout-ms 180000
desktop_launch_gate_changes:
name: Desktop Launch Gate Changes
if: github.event_name == 'pull_request'
runs-on: ubuntu-24.04
timeout-minutes: 5
outputs:
run_desktop_launch_smoke: ${{ steps.filter.outputs.run_desktop_launch_smoke }}
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version-file: package.json
- id: filter
name: Classify changed files
shell: bash
run: |
set -euo pipefail
changed_files="$RUNNER_TEMP/changed-files.txt"
git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.sha }}" > "$changed_files"
node scripts/desktop-ci-change-gate.ts --files "$changed_files"
build_wsl_node_pty_for_windows_smoke:
name: Build WSL node-pty for Windows Smoke
needs: desktop_launch_gate_changes
if: needs.desktop_launch_gate_changes.outputs.run_desktop_launch_smoke == 'true'
runs-on: ubuntu-24.04
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Vite+
uses: voidzero-dev/setup-vp@v1
with:
node-version-file: package.json
cache: true
run-install: true
- name: Build node-pty linux-x64 prebuild
shell: bash
run: |
set -euo pipefail
pty_pkg="$(node -e "console.log(require.resolve('node-pty/package.json', { paths: ['$GITHUB_WORKSPACE/apps/server'] }))")"
pty_dir="$(dirname "$pty_pkg")"
( cd "$pty_dir" && npx --yes node-gyp rebuild )
mkdir -p wsl-prebuild
cp "$pty_dir/build/Release/pty.node" wsl-prebuild/pty.node
file wsl-prebuild/pty.node
- name: Upload node-pty prebuild
uses: actions/upload-artifact@v7
with:
name: ci-wsl-node-pty-x64
path: wsl-prebuild/pty.node
if-no-files-found: error
desktop_windows_package_smoke:
name: Desktop Windows Package Smoke
needs: [desktop_launch_gate_changes, build_wsl_node_pty_for_windows_smoke]
if: >-
${{
always() &&
needs.desktop_launch_gate_changes.outputs.run_desktop_launch_smoke == 'true' &&
needs.build_wsl_node_pty_for_windows_smoke.result == 'success'
}}
runs-on: windows-latest
timeout-minutes: 60
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Vite+
uses: voidzero-dev/setup-vp@v1
with:
node-version-file: package.json
cache: true
run-install: true
- name: Download WSL node-pty prebuild
uses: actions/download-artifact@v7
with:
name: ci-wsl-node-pty-x64
path: wsl-prebuild
- name: Ensure Electron runtime is installed
run: vp run --filter @t3tools/desktop ensure:electron
- name: Build Windows desktop artifact
shell: bash
run: |
set -euo pipefail
vp run dist:desktop:artifact \
--platform win \
--target nsis \
--arch x64 \
--wsl-prebuild "$GITHUB_WORKSPACE/wsl-prebuild/pty.node" \
--verbose
- id: install
name: Install Windows desktop artifact
shell: pwsh
run: |
$ErrorActionPreference = "Stop"
$installer = Get-ChildItem -Path release -Filter "*.exe" |
Sort-Object Length -Descending |
Select-Object -First 1
if (-not $installer) {
throw "No NSIS installer found in release."
}
$installDir = Join-Path $env:RUNNER_TEMP "t3code-install"
if (Test-Path $installDir) {
Remove-Item -Recurse -Force $installDir
}
New-Item -ItemType Directory -Force -Path $installDir | Out-Null
$process = Start-Process `
-FilePath $installer.FullName `
-ArgumentList @("/S", "/D=$installDir") `
-Wait `
-PassThru
if ($process.ExitCode -ne 0) {
throw "NSIS installer exited with code $($process.ExitCode)."
}
$expectedExeNames = @("T3 Code (Alpha).exe", "T3 Code (Nightly).exe")
$appExe = Get-ChildItem -Path $installDir -Filter "*.exe" -File |
Where-Object { $expectedExeNames -contains $_.Name } |
Select-Object -First 1
if (-not $appExe) {
$topLevelExecutables = Get-ChildItem -Path $installDir -Filter "*.exe" -File |
Select-Object -ExpandProperty Name
throw "No expected installed application executable found under $installDir. Expected one of: $($expectedExeNames -join ', '). Top-level executables: $($topLevelExecutables -join ', ')"
}
"app_exe=$($appExe.FullName)" >> $env:GITHUB_OUTPUT
"install_dir=$installDir" >> $env:GITHUB_OUTPUT
Write-Host "Installed desktop executable: $($appExe.FullName)"
- name: Assert minimal unpacked desktop footprint
shell: pwsh
run: |
$ErrorActionPreference = "Stop"
$unpackedRoot = Join-Path "${{ steps.install.outputs.install_dir }}" "resources/app.asar.unpacked"
node scripts/desktop-unpacked-footprint.mjs `
--root "$unpackedRoot" `
--max-files 300
- name: Assert launch smoke reports missing unpacked runtime file
shell: pwsh
run: |
$ErrorActionPreference = "Stop"
$cleanInstallDir = "${{ steps.install.outputs.install_dir }}"
$cleanAppExe = "${{ steps.install.outputs.app_exe }}"
$brokenInstallDir = Join-Path $env:RUNNER_TEMP "t3code-broken-install"
if (Test-Path $brokenInstallDir) {
Remove-Item -Recurse -Force $brokenInstallDir
}
New-Item -ItemType Directory -Force -Path $brokenInstallDir | Out-Null
Copy-Item -Recurse -Force (Join-Path $cleanInstallDir "*") $brokenInstallDir
$brokenAppExe = Join-Path $brokenInstallDir (Split-Path -Leaf $cleanAppExe)
$removedRuntimeFile = Join-Path $brokenInstallDir "resources/app.asar.unpacked/apps/server/dist/bin.mjs"
if (-not (Test-Path $removedRuntimeFile)) {
throw "Negative launch-smoke fixture could not find packaged runtime file to remove: $removedRuntimeFile"
}
Remove-Item -Force $removedRuntimeFile
$output = & node scripts/desktop-launch-smoke.mjs --command "$brokenAppExe" --timeout-ms 45000 --stability-ms 1000 2>&1
$exitCode = $LASTEXITCODE
$outputText = $output | Out-String
$output | ForEach-Object { Write-Host $_ }
if ($exitCode -eq 0) {
throw "Launch smoke passed against a packaged artifact with a required unpacked runtime file removed; the gate is not trustworthy."
}
if ($outputText -notmatch "(?i)(installation is incomplete|apps/server/dist/bin\.mjs)") {
throw "Launch smoke failed against the broken packaged artifact, but did not report the expected incomplete-installation diagnostic."
}
Write-Host "Launch smoke rejected the deliberately broken packaged artifact with exit code $exitCode."
exit 0
- name: Launch installed Windows desktop app
shell: pwsh
run: node scripts/desktop-launch-smoke.mjs --command "${{ steps.install.outputs.app_exe }}" --timeout-ms 90000
test:
name: Test
runs-on: ubuntu-24.04
# The preserved fork coordinator suite deliberately covers real 20-42 second
# timeout races and already required this allowance before the upstream sync.
timeout-minutes: 60
steps:
- name: Checkout
uses: actions/checkout@v6
with:
sparse-checkout: |
/*
!/.repos/
sparse-checkout-cone-mode: false
- name: Setup Vite+
uses: voidzero-dev/setup-vp@v1
with:
node-version-file: package.json
cache: true
run-install: true
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
- name: Ensure Electron runtime is installed
run: vp run --filter @t3tools/desktop ensure:electron
- name: Test
env:
T3CODE_TRANSFER_BUDGET_REPORT_PATH: ${{ runner.temp }}/t3code-transfer-budget.md
T3CODE_TRANSFER_BUDGET_RESULT_PATH: ${{ runner.temp }}/thread-transfer-result.json
run: vp run test
- name: Publish transfer budget report
if: always()
run: |
if test -f "${{ runner.temp }}/t3code-transfer-budget.md"; then
tee -a "$GITHUB_STEP_SUMMARY" < "${{ runner.temp }}/t3code-transfer-budget.md"
else
echo "Transfer budget report was not produced." >> "$GITHUB_STEP_SUMMARY"
fi
- name: Upload thread transfer result
if: always()
uses: actions/upload-artifact@v7
with:
name: thread-transfer-results
path: ${{ runner.temp }}/thread-transfer-result.json
if-no-files-found: ignore
retention-days: 30
- name: Test resource monitor
run: cargo test --locked --manifest-path native/resource-monitor/Cargo.toml
mobile_native_static_analysis:
name: Mobile Native Static Analysis
runs-on: macos-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v6
with:
sparse-checkout: |
/*
!/.repos/
sparse-checkout-cone-mode: false
- name: Setup Vite+
uses: voidzero-dev/setup-vp@v1
with:
node-version-file: package.json
cache: true
run-install: |
args:
- --filter=@t3tools/scripts...
- --filter=t3...
- name: Install mobile native static analysis tools
run: brew bundle install --file apps/mobile/Brewfile
- name: Lint mobile native sources
run: vp run lint:mobile
release_smoke:
name: Release Smoke
runs-on: ubuntu-24.04
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
sparse-checkout: |
/*
!/.repos/
sparse-checkout-cone-mode: false
- name: Setup Vite+
uses: voidzero-dev/setup-vp@v1
with:
node-version-file: package.json
cache: true
run-install: |
args:
- --filter=@t3tools/scripts...
- name: Exercise release-only workflow steps
run: node scripts/release-smoke.ts