Skip to content

Commit fd1125d

Browse files
authored
ci: cross-compile macOS Intel on the arm64 runner (#47)
The macos-13 (Intel) runners are deprecated and so queue-starved the job sat unscheduled for over an hour, wedging the whole release (latest.json needs every platform). Build darwin-x86_64 on the plentiful macos-14 (arm64) runner via --target x86_64-apple-darwin instead, vendoring the matching x64 node sidecar (a TARGET_TRIPLE override in vendor-node.sh).
1 parent 764e4e0 commit fd1125d

2 files changed

Lines changed: 20 additions & 8 deletions

File tree

.github/workflows/release.yml

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,11 @@ jobs:
5353
bundles: 'app,dmg'
5454
target: darwin-aarch64
5555
updater: '*.app.tar.gz'
56-
- platform: macos-13 # macOS Intel
57-
bundles: 'app,dmg'
58-
target: darwin-x86_64
56+
- platform: macos-14 # macOS Intel — cross-compiled on arm64, since the
57+
bundles: 'app,dmg' # macos-13 (Intel) runners are deprecated and badly
58+
target: darwin-x86_64 # queue-starved. arm64 runners are plentiful.
5959
updater: '*.app.tar.gz'
60+
rust_target: x86_64-apple-darwin
6061
- platform: windows-latest # Windows x64
6162
bundles: 'nsis'
6263
target: windows-x86_64
@@ -84,6 +85,10 @@ jobs:
8485
- uses: swatinem/rust-cache@v2
8586
with:
8687
workspaces: app/src-tauri
88+
# Cross-compile target (Intel macOS on the arm64 runner); no-op otherwise.
89+
- name: Add the cross-compile Rust target
90+
if: ${{ matrix.rust_target != '' }}
91+
run: rustup target add ${{ matrix.rust_target }}
8792

8893
# vite-plus toolchain + app deps (same as ci.yml).
8994
- uses: voidzero-dev/setup-vp@v1
@@ -94,12 +99,12 @@ jobs:
9499
working-directory: app
95100
run: vp install
96101

97-
# Vendor the node sidecar for this runner's platform (gitignored, so it isn't
98-
# in the checkout). vendor-node.sh resolves the host triple itself.
102+
# Vendor the node sidecar (gitignored, so it isn't in the checkout). For a
103+
# cross-compile it must match the *target* arch, not the runner's host arch.
99104
- name: Vendor the node sidecar
100105
working-directory: app/src-tauri
101106
shell: bash
102-
run: ./vendor-node.sh
107+
run: TARGET_TRIPLE="${{ matrix.rust_target }}" ./vendor-node.sh
103108

104109
# The release tag this run targets: release-please's tag on a push, or the
105110
# dispatch input on a manual rebuild. Empty on a build-only smoke test.
@@ -119,7 +124,10 @@ jobs:
119124
env:
120125
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
121126
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
122-
run: ./node_modules/.bin/tauri build --bundles ${{ matrix.bundles }}
127+
run: |
128+
target_arg=""
129+
[ -n "${{ matrix.rust_target }}" ] && target_arg="--target ${{ matrix.rust_target }}"
130+
./node_modules/.bin/tauri build $target_arg --bundles ${{ matrix.bundles }}
123131
124132
# Both macOS arches emit `PyOps.app.tar.gz` (no arch in the name), so they'd
125133
# clobber each other on upload. Arch-suffix it (and its .sig) so each is

app/src-tauri/vendor-node.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,15 @@
55
# and again after a Node major bump (keep it matching the ABI the native modules in
66
# .output/server/node_modules were built for).
77
#
8+
# Defaults to this host's triple; set TARGET_TRIPLE to vendor for a cross-compile
9+
# target instead (e.g. building x86_64 macOS on an arm64 runner):
10+
#
811
# NODE_VERSION=24.18.0 ./vendor-node.sh
12+
# TARGET_TRIPLE=x86_64-apple-darwin ./vendor-node.sh
913
set -euo pipefail
1014

1115
NODE_VERSION="${NODE_VERSION:-24.18.0}"
12-
TRIPLE="$(rustc -Vv | sed -n 's/host: //p')"
16+
TRIPLE="${TARGET_TRIPLE:-$(rustc -Vv | sed -n 's/host: //p')}"
1317
DIR="$(cd "$(dirname "$0")" && pwd)"
1418

1519
case "$TRIPLE" in

0 commit comments

Comments
 (0)