Build native ARM64 Windows installer tooling instead of reusing the x64

The ARM64 installer still died with "installer has no payload for this CPU
(x86_64)". Two installers, two architectures, and each needs tooling compiled
for its own target.

fromchat-pack embeds the app-image payload, and payload.rs selects it with
std::env::consts::ARCH — the stub's own compile-time architecture, not the
machine's. The stub is a Windows x64 binary, so on ARM64 it runs emulated,
reports x86_64, and looks for an x86_64 payload that the ARM-only bundle never
embeds. The ARM asset was therefore structurally incapable of installing.

So the ARM64 leg now builds its own aarch64-pc-windows-msvc tooling on the ARM
runner (cargo build --release --workspace with no --target builds for the
host) instead of downloading the x64 artifact, which is now x64-only.
ensureWindowsRustBinaries is existence-based and rebuilds when binaries are
absent, so this leg is self-healing if the explicit build step ever misfires.

The Rust cache key was also arch-blind — windows-rust-${{ runner.os }}-v3-... —
so an x64 target/ directory could be restored onto the ARM runner and make the
"binaries ready" check pass with the wrong architecture. It now includes
${{ runner.arch }} and is bumped to v4, so the two legs cannot share a cache.

This also reverts the PROCESSOR_ARCHITEW6432 sniffing added in 35492fc: with
natively compiled stubs it is unnecessary, and it would have been actively
wrong — an x64 installer running emulated on ARM64 should install the x64
payload, not be redirected to the arm64 one.

Turn the Windows tooling job into a 2-entry matrix

The ARM64 fix had grown into duplicated, arch-conditional steps inside
windows-package: rust-toolchain, rust cache, a binary verification loop and a
build step, all gated on matrix.arch. That is per-architecture data, not control
flow, so it belongs in a matrix.

windows-common (x64-only) becomes windows-tools, a 2-entry matrix over
{x64 -> windows-latest -> x86_64-pc-windows-msvc} and
{arm64 -> windows-11-arm -> aarch64-pc-windows-msvc}. Each leg builds the
installer tooling natively — cargo has no --target, so it builds for the host —
and uploads it as windows-rust-tools-<arch>. windows-package then downloads
that artifact unconditionally again, and its two setup-java-gradle calls
collapse into one driven by a matrix key.

The ARM leg still needs its own step for the packaging JDK
(ensure-windows-arm64-jdk.cmd); that one is genuinely arch-specific rather than
matrix data.

This keeps the invariant that matters: fromchat-pack selects the embedded
payload with std::env::consts::ARCH, so each architecture's installer must be
compiled for its own target or it reports the wrong CPU and finds no payload.
This commit is contained in:
2026-10-17 17:38:08 +03:00
Unverified
parent 599abc132f
commit b6849c2d09
2 changed files with 50 additions and 27 deletions
@@ -16,9 +16,8 @@ runs:
~/.cargo/registry
~/.cargo/git
app/desktop/windows-setup/target
key: windows-rust-${{ runner.os }}-v3-${{ hashFiles('app/desktop/windows-setup/Cargo.lock') }}
key: windows-rust-${{ runner.os }}-${{ runner.arch }}-v4-${{ hashFiles('app/desktop/windows-setup/Cargo.lock') }}
restore-keys: |
windows-rust-${{ runner.os }}-v3-
windows-rust-${{ runner.os }}-v2-
windows-rust-tools-v1-
windows-rust-${{ runner.os }}-${{ runner.arch }}-v4-
windows-rust-${{ runner.os }}-${{ runner.arch }}-v3-
cargo-registry-${{ runner.os }}-
+47 -23
View File
@@ -200,28 +200,46 @@ jobs:
if-no-files-found: error
retention-days: 3
windows-common:
name: Windows installer
windows-tools:
name: Windows tools (${{ matrix.label }})
needs: [resolve-version, check-build]
if: needs.check-build.outputs.should_build == 'true'
runs-on: windows-latest
timeout-minutes: 30
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
include:
- arch: x64
label: x64
runner: windows-latest
rust-target: x86_64-pc-windows-msvc
java-distribution: temurin
- arch: arm64
label: ARM
runner: windows-11-arm
rust-target: aarch64-pc-windows-msvc
# Adoptium publishes no Windows aarch64 build for 17, hence zulu. See the ARM leg of
# windows-package for why the Gradle JVM must not be 21+ on Windows ARM64.
java-distribution: zulu
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v5
- uses: ./.github/actions/restore-git-mtimes
- uses: ./.github/actions/set-version
with:
version: ${{ needs.resolve-version.outputs.version }}
# This job only needs a JVM to drive cargo; the app image is packaged by windows-package.
- uses: ./.github/actions/setup-java-gradle
with:
java-distribution: ${{ matrix.java-distribution }}
- uses: ./.github/actions/cache-gradle-build
id: gradle-build-cache
with:
scope: windows-installer
scope: windows-tools-${{ matrix.arch }}
- uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-pc-windows-msvc
targets: ${{ matrix.rust-target }}
- uses: ./.github/actions/cache-windows-rust-tools
id: rust-tools-cache
- name: Verify Windows Rust binaries
id: rust-binaries
shell: bash
@@ -240,6 +258,10 @@ jobs:
fi
done
echo "ready=$ready" >> "$GITHUB_OUTPUT"
# cargo builds for the host, so each runner produces tooling for its own architecture. That
# matters: fromchat-pack picks the embedded payload with std::env::consts::ARCH, the stub's
# compile-time arch, so an x64 stub running emulated on ARM64 looks for an x86_64 payload the
# ARM64 bundle does not contain ("installer has no payload for this CPU (x86_64)").
- name: Build Windows installer Rust tooling
if: steps.rust-binaries.outputs.ready != 'true'
shell: bash
@@ -248,7 +270,7 @@ jobs:
if: always()
- uses: actions/upload-artifact@v5
with:
name: windows-rust-tools
name: windows-rust-tools-${{ matrix.arch }}
path: app/desktop/windows-setup/target/release/*.exe
if-no-files-found: error
retention-days: 3
@@ -259,7 +281,7 @@ jobs:
windows-package:
name: Windows (${{ matrix.label }})
needs: [resolve-version, check-build, desktop-proguard, windows-common]
needs: [resolve-version, check-build, desktop-proguard, windows-tools]
if: needs.check-build.outputs.should_build == 'true'
env:
FROMCHAT_PREBUILT_PROGUARD: "1"
@@ -270,9 +292,18 @@ jobs:
- arch: x64
label: x64
runner: windows-latest
java-distribution: temurin
- arch: arm64
label: ARM
runner: windows-11-arm
# JDK-8371740: a LinkedTransferQueue race, fixed only in JDK 26, makes Gradle on
# Windows ARM64 hang at build shutdown ("Timeout waiting for concurrent jobs to
# complete") whenever it runs on JDK 21+. This runner's ambient JAVA_HOME is Temurin
# 21.0.12, so pin the Gradle JVM to 17 — exactly what the x64 leg does. Adoptium
# publishes no Windows aarch64 build for 17, hence zulu. Packaging is unaffected:
# resolvePackagingJdkHome() rejects 17 as too old and falls back to the Java 25
# toolchain JDK for jpackage.
java-distribution: zulu
runs-on: ${{ matrix.runner }}
timeout-minutes: 60
steps:
@@ -286,20 +317,9 @@ jobs:
shell: cmd
run: call scripts\ensure-windows-arm64-jdk.cmd
- uses: ./.github/actions/setup-java-gradle
if: matrix.arch == 'x64'
with:
cache-read-only: "true"
# JDK-8371740: a LinkedTransferQueue race, fixed only in JDK 26, makes Gradle on Windows
# ARM64 hang at build shutdown ("Timeout waiting for concurrent jobs to complete") whenever
# it runs on JDK 21+. This runner's ambient JAVA_HOME is Temurin 21.0.12, so pin the Gradle
# JVM to 17 — exactly what the x64 job does. Adoptium publishes no Windows aarch64 build
# for 17, hence zulu. Packaging is unaffected: resolvePackagingJdkHome() rejects 17 as too
# old and falls back to the Java 25 toolchain JDK for jpackage.
- uses: ./.github/actions/setup-java-gradle
if: matrix.arch == 'arm64'
with:
cache-read-only: "true"
java-distribution: zulu
java-distribution: ${{ matrix.java-distribution }}
- uses: ./.github/actions/cache-gradle-build
id: gradle-build-cache
with:
@@ -308,10 +328,14 @@ jobs:
with:
name: desktop-proguard
path: app/desktop/build/prebuilt/main-release/proguard
# Tooling for this architecture, built natively by the windows-tools matrix leg. The two
# architectures must not share: fromchat-pack selects the embedded payload with
# std::env::consts::ARCH, so an x64 stub on ARM64 reports "x86_64" and finds no x86_64
# payload in the ARM-only bundle.
- name: Restore Windows Rust installer tools
uses: actions/download-artifact@v5
with:
name: windows-rust-tools
name: windows-rust-tools-${{ matrix.arch }}
path: app/desktop/windows-setup/target/release
- name: Package Windows ${{ matrix.arch }} installer
shell: bash
@@ -592,7 +616,7 @@ jobs:
- resolve-version
- check-build
- desktop-proguard
- windows-common
- windows-tools
- windows-package
- macos
- linux