Skip to content

ci(release): macOS Intel 改为在 Apple Silicon 交叉编译,修复 Rust 缓存路径 - #1148

Merged
xiaozhou26 merged 1 commit into
mainfrom
ci/faster-release
Nov 3, 2026
Merged

xiaozhou26 merged 1 commit into
mainfrom
ci/faster-release

Conversation

@xiaozhou26

Copy link
Copy Markdown
Contributor

Linked issue

Closes #1147

Summary

Two fixes to desktop-release.yml.

1. The Rust cache never worked. Swatinem/rust-cache had workspaces: crates/agent-gui/src-tauri, so it cached crates/agent-gui/src-tauri/target. The cargo workspace root is the repo root, and artifacts go to ./target. Every release logged "No cache found" and compiled from scratch, including reruns of a failed job (for example the notarization 403 retries). All three jobs now use ". -> target", and the macOS matrix gets a per-target key so Intel and Apple Silicon don't overwrite each other.

2. Intel is cross-compiled on macos-15 (Apple Silicon) instead of macos-15-intel. On v2.0.2, Rust compilation took about 16 min on Intel and about 10 min on Apple Silicon. Intel jobs took 23–35 min overall, Apple Silicon 15–21.

  • No bundled sidecar needs an x86 host:
    • K-brain and k-brain-computer are prebuilt per target from kbrain.lock.json.
    • The gateway is cross-compiled by prepare-gateway.mjs from TAURI_ENV_TARGET_TRIPLE with CGO_ENABLED=0.
    • The packaging verify scripts don't execute target binaries.
  • Signing, notarization and dmgbuild don't depend on the host architecture.
  • New guard step: every Mach-O in LiveAgent.app/Contents/MacOS must report exactly the target architecture (lipo -archs), so a wrong-arch package fails the job instead of shipping.

Expected result: Intel drops to the Apple Silicon time, and the release finishes when Windows/Linux do (about 22 min). Reruns of a failed job also reuse the compiled dependencies.

Known limit: GitHub only lets a tag run restore caches from that same tag or the default branch. A new tag therefore still compiles cold the first time. Warming release caches from main would fix that, but it costs macOS minutes and cache quota, so it isn't included here.

Change scope

  • .github/workflows/desktop-release.yml only

Screenshots / preview

N/A, CI-only change.

Verification

  • Local cross-build on Apple Silicon: cargo build --target x86_64-apple-darwin for crates/agent-gui/src-tauri builds and links. Output: Mach-O 64-bit executable x86_64.
  • The next release tag exercises the full signed and notarized path, and the new arch check guards the result.

…cache path

rust-cache pointed at crates/agent-gui/src-tauri/target, but the cargo
workspace root is the repo root, so it never restored or saved anything.
The macos-15-intel runner compiles about 2x slower than macos-15; build
the x86_64 target there instead and assert every bundled Mach-O matches
the target architecture.

Closes #1147
@xiaozhou26
xiaozhou26 merged commit 5b30bf3 into main Nov 3, 2026
12 checks passed
@xiaozhou26
xiaozhou26 deleted the ci/faster-release branch November 3, 2026 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Desktop Release 打包太慢(macOS Intel 23–35 分钟)

1 participant