Skip to content

Commit 64a58d3

Browse files
t3dotggclaude
andcommitted
perf(release): start Windows builds without waiting for the Linux job
The Windows jobs needed the whole same-arch Linux job, only to embed its CLI archive as the WSL runtime. Windows arm64 is the slowest release job and sat idle for about 3.5 minutes waiting on Linux arm64. The Windows jobs now start with the other platforms. Right before the desktop build, a step waits for the cli-linux-<arch> artifact itself, so checkout, install, MSVC, and signing setup all overlap the Linux job. - The wait checks for the artifact before reading job status, and once more before failing when the Linux job ended without uploading it. - Windows jobs get a 70 minute timeout (was 30), since the wait now runs inside their own budget. The wait step allows 40. - release-desktop.yml asks for actions: read; both callers grant it. Tested on Blacksmith Windows x64 and windows-11-arm through a reusable workflow: the wait found an archive uploaded 62s later, and failed 2s after a Linux job ended without one. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
1 parent 8630e1a commit 64a58d3

4 files changed

Lines changed: 75 additions & 22 deletions

File tree

‎.github/workflows/desktop-macos-preview-publish.yml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,10 @@ jobs:
284284
concurrency:
285285
group: desktop-macos-preview-${{ needs.resolve.outputs.pr_number }}-build
286286
cancel-in-progress: true
287+
# release-desktop.yml asks for actions: read (its Windows builds list artifacts).
288+
permissions:
289+
actions: read
290+
contents: read
287291
uses: ./.github/workflows/release-desktop.yml
288292
secrets:
289293
CSC_LINK: ${{ secrets.CSC_LINK }}

‎.github/workflows/release-desktop.yml‎

Lines changed: 56 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,17 @@ on:
9393
type: string
9494

9595
permissions:
96+
# Windows builds read this run's artifact list to wait for the Linux CLI archive.
97+
actions: read
9698
contents: read
9799

98100
jobs:
99101
build:
100102
name: Build ${{ inputs.label }}
101103
runs-on: ${{ inputs.runner }}
102-
timeout-minutes: 30
104+
# Windows waits for the Linux CLI archive inside its own budget (see
105+
# "Wait for Linux CLI archive"), so it gets that wait on top of the usual 30.
106+
timeout-minutes: ${{ inputs.platform == 'win' && 70 || 30 }}
103107
env:
104108
T3CODE_CLERK_PUBLISHABLE_KEY: ${{ inputs.clerk_publishable_key }}
105109
T3CODE_CLERK_JWT_TEMPLATE: ${{ inputs.clerk_jwt_template }}
@@ -204,15 +208,6 @@ jobs:
204208
name: js-bundle
205209
path: apps
206210

207-
# The WSL backend runs the Linux CLI archive inside the distro, so the
208-
# Windows desktop embeds the same-arch archive the release attaches.
209-
- name: Download Linux CLI archive for WSL
210-
if: inputs.platform == 'win'
211-
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
212-
with:
213-
name: cli-linux-${{ inputs.arch }}
214-
path: wsl-runtime
215-
216211
# Only the resource monitor build needs these libraries. With a cached
217212
# monitor, the desktop build's preflight skips its MSVC check, and node-pty
218213
# ships prebuilt Windows binaries, so the 30-60s install is skipped too.
@@ -314,6 +309,57 @@ jobs:
314309
Select-Object -Unique
315310
"PSModulePath=$($modulePathEntries -join ';')" >> $env:GITHUB_ENV
316311
312+
# The WSL backend runs the Linux CLI archive inside the distro, so the
313+
# Windows desktop embeds the same-arch archive the release attaches.
314+
# This job starts alongside that Linux job instead of after it, and the
315+
# Linux job uploads the archive partway through, so the wait is placed
316+
# after all other setup. It stops early if the Linux job ended without
317+
# uploading the archive.
318+
- name: Wait for Linux CLI archive
319+
if: inputs.platform == 'win'
320+
shell: pwsh
321+
timeout-minutes: 40
322+
env:
323+
GITHUB_TOKEN: ${{ github.token }}
324+
ARTIFACT: cli-linux-${{ inputs.arch }}
325+
LINUX_JOB: Build Linux ${{ inputs.arch }}
326+
run: |
327+
$headers = @{ Authorization = "Bearer $env:GITHUB_TOKEN"; Accept = "application/vnd.github+json" }
328+
$run = "$env:GITHUB_API_URL/repos/$env:GITHUB_REPOSITORY/actions/runs/$env:GITHUB_RUN_ID"
329+
function Test-Archive {
330+
(Invoke-RestMethod -Headers $headers -Uri "$run/artifacts?name=$env:ARTIFACT").total_count -gt 0
331+
}
332+
while ($true) {
333+
try {
334+
if (Test-Archive) {
335+
Write-Host "$env:ARTIFACT is ready."
336+
exit 0
337+
}
338+
$jobs = Invoke-RestMethod -Headers $headers -Uri "$run/attempts/$env:GITHUB_RUN_ATTEMPT/jobs?per_page=100"
339+
$linux = $jobs.jobs | Where-Object { $_.name.EndsWith($env:LINUX_JOB) } | Select-Object -First 1
340+
if ($linux.conclusion) {
341+
# The upload may have landed between the two requests above.
342+
if (Test-Archive) {
343+
Write-Host "$env:ARTIFACT is ready."
344+
exit 0
345+
}
346+
Write-Host "::error::$env:LINUX_JOB ended ($($linux.conclusion)) without uploading $env:ARTIFACT."
347+
exit 1
348+
}
349+
} catch {
350+
Write-Warning "Could not read this run's artifacts or jobs: $($_.Exception.Message)"
351+
}
352+
Write-Host "Waiting for $env:ARTIFACT..."
353+
Start-Sleep -Seconds 10
354+
}
355+
356+
- name: Download Linux CLI archive for WSL
357+
if: inputs.platform == 'win'
358+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
359+
with:
360+
name: cli-linux-${{ inputs.arch }}
361+
path: wsl-runtime
362+
317363
- name: Build desktop artifact
318364
shell: bash
319365
env:

‎.github/workflows/release.yml‎

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ concurrency:
3737
queue: max
3838

3939
permissions:
40+
# The Windows desktop jobs read this run's artifact list to wait for the
41+
# Linux CLI archive they embed (see release-desktop.yml).
42+
actions: read
4043
contents: read
4144
id-token: none
4245

@@ -531,11 +534,12 @@ jobs:
531534
retention-days: 1
532535

533536
# One job per platform and architecture (see release-desktop.yml), each on
534-
# hardware of its own architecture, and each gated only on what it consumes:
535-
# every platform needs the JS bundle, and the Windows jobs also need the
536-
# same-arch Linux job, whose CLI archive they embed as the WSL runtime. Every
537-
# job builds the desktop app; all but macOS x64 also build the CLI archive
538-
# for their platform, so a target either ships fully or not at all.
537+
# hardware of its own architecture, and each gated only on the JS bundle.
538+
# The Windows jobs also embed the same-arch Linux CLI archive as the WSL
539+
# runtime; they wait for that artifact partway through instead of for the
540+
# whole Linux job. Every job builds the desktop app; all but macOS x64 also
541+
# build the CLI archive for their platform, so a target either ships fully or
542+
# not at all.
539543
desktop_mac_arm64:
540544
name: Desktop macOS arm64
541545
needs: [preflight, relay_public_config, build_bundle]
@@ -633,13 +637,12 @@ jobs:
633637
resource_key: linux-arm64
634638
cli_archive: true
635639

636-
# The Windows jobs embed the same-arch Linux CLI archive as the WSL runtime.
637-
# `!cancelled()` (not `!failure()`) still lets them start when that Linux job
638-
# failed; the download step inside then fails this single platform if the
639-
# archive is missing.
640+
# The Windows jobs start with the other platforms. Their checkout, install,
641+
# and toolchain setup take longer than the same-arch Linux job needs to
642+
# upload its CLI archive, so the wait inside is usually instant.
640643
desktop_win_x64:
641644
name: Desktop Windows x64
642-
needs: [preflight, relay_public_config, build_bundle, desktop_linux_x64]
645+
needs: [preflight, relay_public_config, build_bundle]
643646
if: ${{ !cancelled() && needs.preflight.result == 'success' && needs.relay_public_config.result == 'success' && needs.build_bundle.result == 'success' }}
644647
uses: ./.github/workflows/release-desktop.yml
645648
secrets: inherit
@@ -662,7 +665,7 @@ jobs:
662665

663666
desktop_win_arm64:
664667
name: Desktop Windows arm64
665-
needs: [preflight, relay_public_config, build_bundle, desktop_linux_arm64]
668+
needs: [preflight, relay_public_config, build_bundle]
666669
if: ${{ !cancelled() && needs.preflight.result == 'success' && needs.relay_public_config.result == 'success' && needs.build_bundle.result == 'success' }}
667670
uses: ./.github/workflows/release-desktop.yml
668671
secrets: inherit

‎docs/operations/release.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ This document covers the unified release workflow for stable and nightly desktop
2626
- Runs lint, typecheck, and tests alongside artifact builds. Publishing waits for every check.
2727
- Reads the shared production T3 Connect relay URL and Clerk client configuration before packaging clients.
2828
- Builds the platform-independent JS (server bundle, web client, Electron main) once in the `build_bundle` job and hands it to every platform job as the `js-bundle` artifact; the platform jobs only package it, so no runner rebuilds it.
29-
- Builds six desktop artifacts in parallel for both channels, each as its own job (`desktop_<platform>_<arch>`, one call of `release-desktop.yml`) on hardware of its own architecture, gated only on the bundle (the Windows jobs also wait for the same-arch Linux job, whose CLI archive they embed as the WSL runtime):
29+
- Builds six desktop artifacts in parallel for both channels, each as its own job (`desktop_<platform>_<arch>`, one call of `release-desktop.yml`) on hardware of its own architecture, gated only on the bundle. The Windows jobs embed the same-arch Linux CLI archive as the WSL runtime and wait for that artifact partway through, not for the whole Linux job:
3030
- macOS `arm64` DMG
3131
- macOS `x64` DMG
3232
- Linux `x64` and `arm64` AppImage and `.deb`, from one electron-builder run. The `.deb` updates in the app through electron-updater, which installs it with `dpkg`.

0 commit comments

Comments
 (0)