History

Harden desktop perf CI with deps, artifacts, and timeout hints

- Install required Linux desktop runtime packages before perf trace runs - Increase perf trace timeout in CI and always upload `/tmp/t3code-perf-artifacts` - Add timeout failure hints and recent log-tail output to `desktop-perf-trace` errors

Julius Marminge committed 9 months ago

Commit 758b3e11 parent ae08eb82 files · +75 −0Browse files

Unified · Split

2 files
  1. .github/workflows/ci.yml +34 −0
  2. scripts/desktop-perf-trace.mjs +41 −0
.github/workflows/ci.yml+34−0
@@ -53,16 +53,50 @@ jobs: · 52 unmodified lines
5353 test -f apps/desktop/dist-electron/preload.js
5454 grep -nE "desktopBridge|getWsUrl|PICK_FOLDER_CHANNEL|wsUrl" apps/desktop/dist-electron/preload.js
5555
56+ - name: Install desktop runtime deps (Linux)
57+ if: runner.os == 'Linux'
58+ run: |
59+ sudo apt-get update
60+ sudo apt-get install -y \
61+ xvfb \
62+ xauth \
63+ libgtk-3-0 \
64+ libnotify4 \
65+ libnss3 \
66+ libxss1 \
67+ libxtst6 \
68+ libatspi2.0-0 \
69+ libdrm2 \
70+ libgbm1 \
71+ libxrandr2 \
72+ libxshmfence1 \
73+ libxi6 \
74+ xdg-utils
75+ sudo apt-get install -y libasound2t64 || sudo apt-get install -y libasound2
76+
5677 - name: Desktop perf trace test
5778 if: github.event_name != 'pull_request'
79+ env:
80+ T3CODE_PERF_TIMEOUT_MS: "420000"
5881 run: xvfb-run -a bun run test:desktop-perf
5982
6083 - name: Desktop perf trace test (fork PR)
6184 if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository
85+ env:
86+ T3CODE_PERF_TIMEOUT_MS: "420000"
6287 run: xvfb-run -a bun run test:desktop-perf
6388
6489 - name: Desktop perf trace test and PR summary
6590 if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
6691 env:
6792 GH_TOKEN: ${{ github.token }}
93+ T3CODE_PERF_TIMEOUT_MS: "420000"
6894 run: xvfb-run -a bun run test:desktop-perf:post
95+
96+ - name: Upload desktop perf artifacts
97+ if: always()
98+ uses: actions/upload-artifact@v4
99+ with:
100+ name: desktop-perf-artifacts
101+ path: /tmp/t3code-perf-artifacts
102+ if-no-files-found: ignore
scripts/desktop-perf-trace.mjs+41−0
@@ -339,6 +339,34 @@ async function waitForDoneFile(donePath, child, timeoutMs) { · 338 unmodified lines
339339 throw new Error(`Timed out waiting for done marker at ${donePath}`);
340340 }
341341
342+function tailLogText(logChunks, lineCount = 120) {
343+ const lines = logChunks.join("").split(/\r?\n/);
344+ return lines.slice(-lineCount).join("\n").trim();
345+}
346+
347+function inferDesktopPerfTimeoutHint(logChunks) {
348+ const joined = logChunks.join("");
349+ const lowered = joined.toLowerCase();
350+
351+ if (lowered.includes("error while loading shared libraries")) {
352+ return "Electron failed to start due missing Linux shared libraries.";
353+ }
354+ if (lowered.includes("no usable sandbox")) {
355+ return "Electron sandbox failed to initialize in CI.";
356+ }
357+ if (lowered.includes("port is already in use")) {
358+ return "Dev server port collision prevented Electron from loading the renderer.";
359+ }
360+ if (!joined.includes("[desktop-perf]")) {
361+ return "Desktop perf automation never started; Electron likely did not boot successfully.";
362+ }
363+ if (joined.includes("[desktop-perf]") && !joined.includes("[desktop-perf] trace recorded")) {
364+ return "Desktop perf automation started but did not complete trace recording.";
365+ }
366+
367+ return "Desktop perf automation timed out before writing the done marker.";
368+}
369+
342370 async function terminateProcessTree(child) {
343371 if (child.exitCode !== null) return;
344372
@@ -522,6 +550,19 @@ async function main() { · 177 unmodified lines
522550 let donePayload;
523551 try {
524552 donePayload = await waitForDoneFile(donePath, child, timeoutMs);
553+ } catch (error) {
554+ const baseMessage = error instanceof Error ? error.message : String(error);
555+ const hint = inferDesktopPerfTimeoutHint(logs);
556+ const logTail = tailLogText(logs);
557+ throw new Error(
558+ [
559+ baseMessage,
560+ `Hint: ${hint}`,
561+ `Artifacts dir: ${artifactsDir}`,
562+ `Run log: ${logPath}`,
563+ logTail.length > 0 ? `Recent log tail:\n${logTail}` : "Recent log tail: <empty>",
564+ ].join("\n"),
565+ );
525566 } finally {
526567 await terminateProcessTree(child);
527568 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t