Skip to content

Commit c7a740c

Browse files
robcohenclaude
andcommitted
ci(desktop): build x64 macOS sidecar on Intel runner; pass RUSTFAVA_VERSION
Folds #197 into this branch (both edit desktop-release.yml): - Build the x86_64-apple-darwin sidecar and Tauri bundle on macos-13 (Intel): PyInstaller can't cross-compile and macos-latest is now Apple Silicon (#193). - Verify sidecar/bundled-sidecar architecture with `file -b | grep -qw` so the arch-bearing filename can't false-match (#193). - Set RUSTFAVA_VERSION from the release tag before the PyInstaller build, so the spec bakes the real version into rustfava/_version.py (#191). Reconciles cleanly with this branch's switch of the engine wasm download from the removed ffi-wasi artifact to ffi-component. Co-Authored-By: Rob Cohen <rob@robcohen.dev> Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 0dd165a commit c7a740c

1 file changed

Lines changed: 52 additions & 2 deletions

File tree

.github/workflows/desktop-release.yml

Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,10 @@ jobs:
4040
- os: ubuntu-22.04
4141
target: x86_64-unknown-linux-gnu
4242
sidecar_name: rustfava-server-x86_64-unknown-linux-gnu
43-
- os: macos-latest
43+
# PyInstaller cannot cross-compile: it emits a binary for the
44+
# runner's own arch. macos-latest is now Apple Silicon, so the x64
45+
# sidecar must build on a real Intel runner (issue #193).
46+
- os: macos-13
4447
target: x86_64-apple-darwin
4548
sidecar_name: rustfava-server-x86_64-apple-darwin
4649
- os: macos-14
@@ -119,6 +122,13 @@ jobs:
119122
print(f'Compiled {po} -> {mo}')
120123
"
121124
125+
- name: Set RUSTFAVA_VERSION from tag
126+
# The spec bakes this into rustfava/_version.py so the frozen binary
127+
# reports the real version without dist-info metadata (issue #191).
128+
if: startsWith(github.ref, 'refs/tags/')
129+
shell: bash
130+
run: echo "RUSTFAVA_VERSION=${GITHUB_REF#refs/tags/v}" >> "$GITHUB_ENV"
131+
122132
- name: Build sidecar with PyInstaller
123133
shell: bash
124134
run: |
@@ -134,6 +144,24 @@ jobs:
134144
run: |
135145
move dist\rustfava.exe dist\${{ matrix.sidecar_name }}
136146
147+
- name: Verify sidecar architecture (macOS)
148+
if: runner.os == 'macOS'
149+
shell: bash
150+
run: |
151+
BIN="dist/${{ matrix.sidecar_name }}"
152+
file "$BIN"
153+
case "${{ matrix.target }}" in
154+
x86_64-*) EXPECT="x86_64" ;;
155+
aarch64-*) EXPECT="arm64" ;;
156+
*) echo "::error::Unknown macOS target ${{ matrix.target }}"; exit 1 ;;
157+
esac
158+
# Use `file -b` (no filename) so the sidecar_name — which itself
159+
# contains "x86_64"/"aarch64" — can't false-match the grep.
160+
if ! file -b "$BIN" | grep -qw "$EXPECT"; then
161+
echo "::error::Sidecar arch mismatch: expected $EXPECT for ${{ matrix.target }}, got: $(file -b "$BIN")"
162+
exit 1
163+
fi
164+
137165
- name: Upload sidecar artifact
138166
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
139167
with:
@@ -218,7 +246,9 @@ jobs:
218246
- os: ubuntu-22.04
219247
target: x86_64-unknown-linux-gnu
220248
sidecar_name: rustfava-server-x86_64-unknown-linux-gnu
221-
- os: macos-latest
249+
# Intel runner: builds x86_64 natively so the smoke test can launch
250+
# the binary (an arm64 runner has no Rosetta by default), issue #193.
251+
- os: macos-13
222252
target: x86_64-apple-darwin
223253
sidecar_name: rustfava-server-x86_64-apple-darwin
224254
- os: macos-14
@@ -317,6 +347,26 @@ jobs:
317347
ls -la "$APP_PATH" || { echo "App bundle not found!"; exit 1; }
318348
file "$BINARY"
319349
350+
# Verify the bundled sidecar matches the target arch (issue #193).
351+
# Tauri strips the target triple, so the bundled name is plain
352+
# `rustfava-server` (no arch substring to confuse the grep).
353+
SIDECAR="$APP_PATH/Contents/MacOS/rustfava-server"
354+
if [ -f "$SIDECAR" ]; then
355+
file "$SIDECAR"
356+
case "${{ matrix.target }}" in
357+
x86_64-*) EXPECT="x86_64" ;;
358+
aarch64-*) EXPECT="arm64" ;;
359+
*) echo "::error::Unknown macOS target ${{ matrix.target }}"; exit 1 ;;
360+
esac
361+
if ! file -b "$SIDECAR" | grep -qw "$EXPECT"; then
362+
echo "::error::Bundled sidecar arch mismatch: expected $EXPECT for ${{ matrix.target }}, got: $(file -b "$SIDECAR")"
363+
exit 1
364+
fi
365+
else
366+
echo "::error::Bundled sidecar not found at $SIDECAR"
367+
exit 1
368+
fi
369+
320370
# Run binary directly to capture stdout/stderr and panic backtrace
321371
echo "=== Launching with RUST_BACKTRACE=full ==="
322372
RUST_BACKTRACE=full RUST_LOG=debug "$BINARY" > /tmp/app.log 2>&1 &

0 commit comments

Comments
 (0)