- 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
Unified · Split
| @@ -53,16 +53,50 @@ jobs: · 52 unmodified lines | ||
| 53 | 53 | test -f apps/desktop/dist-electron/preload.js |
| 54 | 54 | grep -nE "desktopBridge|getWsUrl|PICK_FOLDER_CHANNEL|wsUrl" apps/desktop/dist-electron/preload.js |
| 55 | 55 | |
| 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 | + | |
| 56 | 77 | - name: Desktop perf trace test |
| 57 | 78 | if: github.event_name != 'pull_request' |
| 79 | + env: | |
| 80 | + T3CODE_PERF_TIMEOUT_MS: "420000" | |
| 58 | 81 | run: xvfb-run -a bun run test:desktop-perf |
| 59 | 82 | |
| 60 | 83 | - name: Desktop perf trace test (fork PR) |
| 61 | 84 | if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository |
| 85 | + env: | |
| 86 | + T3CODE_PERF_TIMEOUT_MS: "420000" | |
| 62 | 87 | run: xvfb-run -a bun run test:desktop-perf |
| 63 | 88 | |
| 64 | 89 | - name: Desktop perf trace test and PR summary |
| 65 | 90 | if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository |
| 66 | 91 | env: |
| 67 | 92 | GH_TOKEN: ${{ github.token }} |
| 93 | + T3CODE_PERF_TIMEOUT_MS: "420000" | |
| 68 | 94 | 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 | |
| @@ -339,6 +339,34 @@ async function waitForDoneFile(donePath, child, timeoutMs) { · 338 unmodified lines | ||
| 339 | 339 | throw new Error(`Timed out waiting for done marker at ${donePath}`); |
| 340 | 340 | } |
| 341 | 341 | |
| 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 | + | |
| 342 | 370 | async function terminateProcessTree(child) { |
| 343 | 371 | if (child.exitCode !== null) return; |
| 344 | 372 | |
| @@ -522,6 +550,19 @@ async function main() { · 177 unmodified lines | ||
| 522 | 550 | let donePayload; |
| 523 | 551 | try { |
| 524 | 552 | 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 | + ); | |
| 525 | 566 | } finally { |
| 526 | 567 | await terminateProcessTree(child); |
| 527 | 568 | } |