Skip to content

Commit 569bd02

Browse files
t3dotggclaude
andauthored
ci(release): build Windows x64 on Linux like arm64 (#22584)
Co-authored-by: Claude Opus 5.5 <[email protected]>
1 parent 5bc19ac commit 569bd02

3 files changed

Lines changed: 28 additions & 110 deletions

File tree

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

Lines changed: 15 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,11 @@ on:
9999
required: true
100100
type: string
101101

102+
# electron-builder leaves the default arch (x64) out of the unpacked app's
103+
# directory name.
104+
env:
105+
UNPACKED_DIR: ${{ inputs.platform }}-${{ inputs.arch != 'x64' && format('{0}-', inputs.arch) || '' }}unpacked
106+
102107
permissions:
103108
# Windows builds read this run's artifact list to wait for the Linux CLI archive.
104109
actions: read
@@ -136,17 +141,11 @@ jobs:
136141
git sparse-checkout set --no-cone '/*' '!/.repos/'
137142
git -c checkout.workers=0 checkout --detach FETCH_HEAD
138143
139-
# Windows installs straight from the registry. There, linking the packages
140-
# takes the time, not downloading them, so a ~700 MB package cache did not
141-
# pay for its own restore. Across recent nightlies, restore plus install
142-
# took 183-233s on arm64 and 116-172s on x64, while a plain install took
143-
# 142-210s and 84-160s. The arm64 entries also filled 4 GB of the
144-
# repository's 10 GB Actions cache.
145144
- name: Setup Vite+
146145
uses: voidzero-dev/setup-vp@250f29ce396baf5e8f24498e17c0dfdebabc26eb # v1
147146
with:
148147
node-version-file: package.json
149-
cache: ${{ runner.os != 'Windows' }}
148+
cache: true
150149
run-install: false
151150

152151
# pnpm checks the lockfile and policy before reusing this result. A missing
@@ -215,28 +214,8 @@ jobs:
215214
name: js-bundle
216215
path: apps
217216

218-
# Only the resource monitor build needs these libraries. With a cached
219-
# monitor, the desktop build's preflight skips its MSVC check, and node-pty
220-
# ships prebuilt Windows binaries, so the 30-60s install is skipped too.
221-
- name: Install Spectre-mitigated MSVC libs
222-
if: runner.os == 'Windows' && steps.resource_monitor_cache.outputs.cache-hit != 'true'
223-
shell: pwsh
224-
run: |
225-
$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
226-
$installPath = & $vswhere -products * -latest -property installationPath
227-
$setupExe = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\setup.exe"
228-
$proc = Start-Process -FilePath $setupExe `
229-
-ArgumentList "modify", "--installPath", "`"$installPath`"", "--add", `
230-
"Microsoft.VisualStudio.Component.VC.Runtimes.${{ inputs.arch == 'arm64' && 'ARM64' || 'x86.x64' }}.Spectre", "--quiet", "--norestart" `
231-
-Wait -PassThru -NoNewWindow
232-
if ($null -eq $proc -or $proc.ExitCode -ne 0) {
233-
$code = if ($null -ne $proc) { $proc.ExitCode } else { 1 }
234-
Write-Error "Visual Studio Installer failed with exit code $code"
235-
exit $code
236-
}
237-
238217
- name: Install cargo-xwin
239-
if: runner.os != 'Windows' && inputs.platform == 'win' && steps.resource_monitor_cache.outputs.cache-hit != 'true'
218+
if: inputs.platform == 'win' && steps.resource_monitor_cache.outputs.cache-hit != 'true'
240219
uses: taiki-e/install-action@8cca0918f8471c33515202b73f56ab27f2bed283 # v2
241220
with:
242221
@@ -246,74 +225,12 @@ jobs:
246225
- name: Build resource monitor
247226
if: steps.resource_monitor_cache.outputs.cache-hit != 'true'
248227
shell: bash
249-
run: cargo ${{ runner.os != 'Windows' && inputs.platform == 'win' && 'xwin build' || 'build' }} --locked --release --manifest-path native/resource-monitor/Cargo.toml --target "${{ inputs.rust_target }}"
250-
251-
- name: Prepare Azure Trusted Signing
252-
if: inputs.platform == 'win' && runner.os == 'Windows'
253-
shell: pwsh
254-
env:
255-
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
256-
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
257-
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
258-
AZURE_TRUSTED_SIGNING_ENDPOINT: ${{ secrets.AZURE_TRUSTED_SIGNING_ENDPOINT }}
259-
AZURE_TRUSTED_SIGNING_ACCOUNT_NAME: ${{ secrets.AZURE_TRUSTED_SIGNING_ACCOUNT_NAME }}
260-
AZURE_TRUSTED_SIGNING_CERTIFICATE_PROFILE_NAME: ${{ secrets.AZURE_TRUSTED_SIGNING_CERTIFICATE_PROFILE_NAME }}
261-
AZURE_TRUSTED_SIGNING_PUBLISHER_NAME: ${{ secrets.AZURE_TRUSTED_SIGNING_PUBLISHER_NAME }}
262-
run: |
263-
$ErrorActionPreference = "Stop"
264-
265-
$requiredSecrets = @(
266-
$env:AZURE_TENANT_ID,
267-
$env:AZURE_CLIENT_ID,
268-
$env:AZURE_CLIENT_SECRET,
269-
$env:AZURE_TRUSTED_SIGNING_ENDPOINT,
270-
$env:AZURE_TRUSTED_SIGNING_ACCOUNT_NAME,
271-
$env:AZURE_TRUSTED_SIGNING_CERTIFICATE_PROFILE_NAME,
272-
$env:AZURE_TRUSTED_SIGNING_PUBLISHER_NAME
273-
)
274-
if ($requiredSecrets | Where-Object { [string]::IsNullOrWhiteSpace($_) }) {
275-
Write-Host "Azure Trusted Signing disabled; skipping TrustedSigning module preparation."
276-
exit 0
277-
}
278-
279-
try {
280-
Install-PackageProvider `
281-
-Name NuGet `
282-
-MinimumVersion 2.8.5.201 `
283-
-Force `
284-
-Scope CurrentUser `
285-
-ErrorAction Stop
286-
} catch {
287-
Write-Warning "Could not bootstrap NuGet package provider. Continuing because the runner may already have a usable provider. $($_.Exception.Message)"
288-
}
289-
290-
Install-Module `
291-
-Name TrustedSigning `
292-
-MinimumVersion 0.5.0 `
293-
-Force `
294-
-AllowClobber `
295-
-Repository PSGallery `
296-
-Scope CurrentUser `
297-
-ErrorAction Stop
298-
299-
Import-Module TrustedSigning -MinimumVersion 0.5.0 -Force
300-
Get-Command Invoke-TrustedSigning -ErrorAction Stop
301-
302-
$moduleRoots = @(
303-
[System.IO.Path]::Combine([Environment]::GetFolderPath("MyDocuments"), "PowerShell", "Modules"),
304-
[System.IO.Path]::Combine([Environment]::GetFolderPath("MyDocuments"), "WindowsPowerShell", "Modules"),
305-
[System.IO.Path]::Combine($env:ProgramFiles, "PowerShell", "Modules"),
306-
[System.IO.Path]::Combine($env:ProgramFiles, "WindowsPowerShell", "Modules")
307-
)
308-
$modulePathEntries = @($moduleRoots + ($env:PSModulePath -split ";")) |
309-
Where-Object { $_ -and (Test-Path $_) } |
310-
Select-Object -Unique
311-
"PSModulePath=$($modulePathEntries -join ';')" >> $env:GITHUB_ENV
228+
run: cargo ${{ inputs.platform == 'win' && 'xwin build' || 'build' }} --locked --release --manifest-path native/resource-monitor/Cargo.toml --target "${{ inputs.rust_target }}"
312229

313230
# Off Windows, scripts/lib/windows-jsign.ts signs through jsign instead of
314231
# the TrustedSigning PowerShell module.
315232
- name: Install jsign
316-
if: inputs.platform == 'win' && runner.os != 'Windows'
233+
if: inputs.platform == 'win'
317234
shell: bash
318235
run: |
319236
set -euo pipefail
@@ -338,9 +255,8 @@ jobs:
338255
339256
# The single-executable is built with a Node that supports --build-sea
340257
# (25.7+); the repo itself stays on the engines.node version. A native
341-
# build injects into the runner's own Node: tsdown's cross-target download
342-
# path runs `tar` on a drive-letter path on Windows, which GNU tar reads as
343-
# a remote host. Off Windows, a Windows target downloads its node.exe.
258+
# build injects into the runner's own Node; a Windows target downloads its
259+
# node.exe.
344260
- name: Build CLI single-executable
345261
if: inputs.cli_archive
346262
shell: bash
@@ -352,7 +268,7 @@ jobs:
352268
# The executable bundles the server again, so it needs the same stamp
353269
# as release.yml's JS bundle.
354270
T3CODE_TELEMETRY_CHANNEL: ${{ github.repository == 'pingdotgg/t3code' && inputs.release_channel || 'dev' }}
355-
run: node apps/server/scripts/cli.ts build-exe --verbose ${{ runner.os != 'Windows' && inputs.platform == 'win' && format('--target win-{0}', inputs.arch) || '' }}
271+
run: node apps/server/scripts/cli.ts build-exe --verbose ${{ inputs.platform == 'win' && format('--target win-{0}', inputs.arch) || '' }}
356272

357273
- name: Import macOS signing certificate for the CLI archive
358274
if: inputs.cli_archive && inputs.platform == 'mac'
@@ -614,7 +530,7 @@ jobs:
614530
run: |
615531
set -euo pipefail
616532
mkdir -p verify
617-
unpacked=$(ls -d "${TMPDIR:-/tmp}"/t3code-desktop-${{ inputs.platform }}-stage-*/app/dist/${{ inputs.platform }}-${{ inputs.arch }}-unpacked)
533+
unpacked=$(ls -d "${TMPDIR:-/tmp}"/t3code-desktop-${{ inputs.platform }}-stage-*/app/dist/"$UNPACKED_DIR")
618534
tar -C "$(dirname "$unpacked")" -cf verify/unpacked.tar "$(basename "$unpacked")"
619535
esbuild=scripts/node_modules/.bin/esbuild
620536
banner="import{createRequire as __cr}from'node:module';const require=__cr(import.meta.url);"
@@ -734,7 +650,7 @@ jobs:
734650
set -euo pipefail
735651
tar -C verify -xf verify/unpacked.tar
736652
node verify/verify-windows-desktop-artifact.mjs \
737-
--app-dir "$(cygpath -w "$PWD/verify/${{ inputs.platform }}-${{ inputs.arch }}-unpacked")" \
653+
--app-dir "$(cygpath -w "$PWD/verify/$UNPACKED_DIR")" \
738654
--arch "${{ inputs.arch }}" --build-version "${{ inputs.version }}" --verbose
739655
740656
- name: Smoke-test CLI archive
@@ -749,7 +665,7 @@ jobs:
749665
- name: Smoke-test resource monitor
750666
shell: bash
751667
env:
752-
MONITOR: verify/${{ inputs.platform }}-${{ inputs.arch }}-unpacked/resources/resource-monitor/t3-resource-monitor.exe
668+
MONITOR: verify/${{ env.UNPACKED_DIR }}/resources/resource-monitor/t3-resource-monitor.exe
753669
EXPECTED_ARCH: ${{ inputs.arch == 'arm64' && 'aarch64' || 'x86_64' }}
754670
run: |
755671
node --input-type=module <<'EOF'

‎.github/workflows/release.yml‎

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -573,8 +573,9 @@ jobs:
573573
if-no-files-found: error
574574
retention-days: 1
575575

576-
# One job per platform and architecture (see release-desktop.yml), each on
577-
# hardware of its own architecture, and each gated only on the JS bundle.
576+
# One job per platform and architecture (see release-desktop.yml), each
577+
# gated only on the JS bundle. Windows targets build on Linux and run their
578+
# native checks on a Windows runner of their own architecture.
578579
# The Windows jobs also embed the same-arch Linux CLI archive as the WSL
579580
# runtime; they wait for that artifact partway through instead of for the
580581
# whole Linux job. Every job builds the desktop app; all but macOS x64 also
@@ -677,9 +678,11 @@ jobs:
677678
resource_key: linux-arm64
678679
cli_archive: true
679680

680-
# The Windows jobs start with the other platforms. Their checkout, install,
681-
# and toolchain setup take longer than the same-arch Linux job needs to
682-
# upload its CLI archive, so the wait inside is usually instant.
681+
# The Windows jobs start with the other platforms and wait for the same-arch
682+
# Linux CLI archive after their other setup. Packaging is mostly CPU and
683+
# small-file work, which Linux runners do faster than Windows ones, so both
684+
# Windows targets build and sign on Linux and only the native checks run on
685+
# Windows.
683686
desktop_win_x64:
684687
name: Desktop Windows x64
685688
needs: [preflight, relay_public_config, build_bundle]
@@ -695,16 +698,15 @@ jobs:
695698
clerk_cli_oauth_client_id: ${{ needs.relay_public_config.outputs.clerk_cli_oauth_client_id }}
696699
relay_url: ${{ needs.relay_public_config.outputs.relay_url }}
697700
label: Windows x64
698-
runner: blacksmith-32vcpu-windows-2025
701+
runner: blacksmith-16vcpu-ubuntu-2404
702+
verify_runner: windows-2025
699703
platform: win
700704
target: nsis
701705
arch: x64
702706
rust_target: x86_64-pc-windows-msvc
703707
resource_key: win32-x64
704708
cli_archive: true
705709

706-
# Windows arm64 runners have 4 vCPUs, and the packaging is mostly CPU-bound,
707-
# so the build runs on Linux and only the native checks run on arm64.
708710
desktop_win_arm64:
709711
name: Desktop Windows arm64
710712
needs: [preflight, relay_public_config, build_bundle]

‎docs/operations/release.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ the version.
3131
- Runs lint, typecheck, and tests alongside artifact builds. Publishing waits for every check.
3232
- Reads the shared production T3 Connect relay URL and Clerk client configuration before packaging clients.
3333
- 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.
34-
- Builds six desktop artifacts in parallel for both channels, each as its own job (`desktop_<platform>_<arch>`, one call of `release-desktop.yml`), gated only on the bundle. Every target builds on hardware of its own architecture except Windows arm64: its runners have 4 vCPUs, so it builds and signs (with jsign) on a Linux runner, and a `windows-11-arm` job runs the packaged natives and the CLI archive (`verify_runner`). 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:
34+
- Builds six desktop artifacts in parallel for both channels, each as its own job (`desktop_<platform>_<arch>`, one call of `release-desktop.yml`), gated only on the bundle. macOS and Linux targets build on hardware of their own architecture. Both Windows targets build and sign (with jsign) on a Linux runner, which packages faster than Windows runners, and a Windows job of the target's architecture (`windows-2025` or `windows-11-arm`, the `verify_runner`) runs the packaged natives and the CLI archive. 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:
3535
- macOS `arm64` DMG
3636
- macOS `x64` DMG
3737
- 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`.
@@ -42,11 +42,11 @@ the version.
4242
- Nightly runs are always GitHub prereleases and never marked latest.
4343
- Automatically generated release notes are pinned to the previous tag in the same channel, so stable compares to the previous stable tag and nightly compares to the previous nightly tag.
4444
- Includes Electron auto-update metadata (for example `latest*.yml`, `nightly*.yml`, and `*.blockmap`) in release assets.
45-
- Builds a self-contained CLI archive per platform (`t3-<version>-<platform>-<arch>.tar.gz`, `.zip` on Windows) in the same job as that target's desktop artifact and attaches them to the GitHub Release with a `SHA256SUMS` file, on every channel, for five targets: macOS arm64, Linux x64 and arm64, Windows x64 and arm64. Every archive is smoke-tested on hardware of its own architecture, and every one but Windows arm64 is also built and signed there. There is no macOS x64 archive: Node single-executables are unsupported on x64 macOS (the SEA docs list macOS as arm64 only) and the binary segfaults on start; the x64 desktop app is Electron and unaffected.
45+
- Builds a self-contained CLI archive per platform (`t3-<version>-<platform>-<arch>.tar.gz`, `.zip` on Windows) in the same job as that target's desktop artifact and attaches them to the GitHub Release with a `SHA256SUMS` file, on every channel, for five targets: macOS arm64, Linux x64 and arm64, Windows x64 and arm64. Every archive is smoke-tested on hardware of its own architecture, and every one but the Windows archives is also built and signed there. There is no macOS x64 archive: Node single-executables are unsupported on x64 macOS (the SEA docs list macOS as arm64 only) and the binary segfaults on start; the x64 desktop app is Electron and unaffected.
4646
- The archive holds the server as a Node single-executable (`scripts/build-cli-archive.ts`), so unpacking it needs neither Node, npm, nor a compiler. It is the only form in which T3 Code manages a runtime: the desktop's SSH environments, the boot service, `t3 update`, and the install scripts all download and verify this archive against `SHA256SUMS`. The `t3` npm package exists for people who run `npx t3` or `npm install -g t3` themselves, and it downloads this same archive too; nothing in the product installs from npm. The `curl | sh` installers are `scripts/install.sh` and `scripts/install.ps1`; the marketing site copies them into its `public/` at build time (`apps/marketing/scripts/stage-install-scripts.mjs`) and serves them at `t3.codes/install.sh` and `/install.ps1`.
4747
- The executable is built with a Node that supports `--build-sea` (`VP_NODE_VERSION=26.8.2`, kept in step with `SEA_NODE_VERSION` in `apps/server/vite.config.ts`), while the repo stays on `engines.node`.
4848
- macOS archives are signed with the Developer ID certificate and notarized when the Apple secrets are present (ad hoc otherwise, which still runs from `curl`/`tar` installs). Windows executables use the same Azure Trusted Signing setup as the installer. Every native addon in the macOS archive is signed too, since the hardened runtime refuses unsigned libraries.
49-
- Each archive is extracted and executed (`scripts/smoke-cli-archive.ts`) on its build runner, or on the `verify_runner` for Windows arm64.
49+
- Each archive is extracted and executed (`scripts/smoke-cli-archive.ts`) on its build runner, or on the `verify_runner` for Windows.
5050
- After the GitHub Release is published, publishes the `t3` npm package with OIDC trusted publishing from the same workflow file. It is only a launcher (`scripts/npm-launcher/t3.mjs`): on first run it downloads its exact version's CLI archive from the GitHub Release, verifies it against `SHA256SUMS`, and unpacks it into `<T3 home>/runtime/versions/<version>`, the layout the install scripts and `t3 update` share. The executables are not on npm. They used to be, as `@t3code/t3-<platform>-<arch>` optional dependencies, but npm's publish-time scanning held those 80-250 MB packages back for up to an hour after the launcher was live, and every install in that window got a launcher with no executable. Those packages stay on npm at their old versions and get no new ones. Because the launcher reads from the release, `publish_cli` runs after `release`, never before.
5151
- stable releases publish npm dist-tag `latest`
5252
- nightly releases publish npm dist-tag `nightly`

0 commit comments

Comments
 (0)