From 9bc79efe55ad3f3aedeb1804e57715c33173c621 Mon Sep 17 00:00:00 2001 From: JGZ_YES Date: Mon, 3 Aug 2026 20:55:39 +0800 Subject: [PATCH] ci(macos): cross-compile x64 on macos-14 runner MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit macos-13 (x64 runner) consistently stuck in queued state — GitHub provisioning issue. Switch both architectures to macos-14 (arm64): - osx-x64: cross-published via .NET (valid native x64 single-file) - osx-arm64: native build as before - x64 smoke test runs via Rosetta 2 (available on macos-14) - arm64 smoke test now uses --arch arm to test its own target --- .github/workflows/build-macos.yml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index 6c3096d..5154428 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -15,8 +15,10 @@ jobs: fail-fast: false matrix: include: + # macos-13 (x64 runner) 长期排队/不分配,改用 macos-14 (arm64) 交叉编译两个架构。 + # .NET 在 arm64 主机上 `publish -r osx-x64` 产出原生 x64 单文件;x64 产物经 Rosetta 2 可在 arm64 上运行(冒烟测试仍生效)。 - arch: x64 - runner: macos-13 + runner: macos-14 rid: osx-x64 - arch: arm64 runner: macos-14 @@ -90,15 +92,19 @@ jobs: ls -lh paze-*.tar.gz - name: Smoke test — compile hello.pe + env: + # arm64 构建用 --arch arm 产出 arm64 Mach-O;x64 用默认 AMD64。 + # x64 产物在 macos-14 (arm64) 上经 Rosetta 2 运行。 + ARCH_FLAG: ${{ matrix.arch == 'arm64' && '--arch arm' || '' }} run: | BIN="staging/paze-${{ steps.meta.outputs.version }}-macos-${{ matrix.arch }}/bin" if [ -f "$BIN/paze" ]; then - "$BIN/paze" tests/hello.pe --target macos -o /tmp/hello.macos + "$BIN/paze" tests/hello.pe --target macos $ARCH_FLAG -o /tmp/hello.macos file /tmp/hello.macos - # macOS 上执行编译产物(Mach-O 原生可执行) + # macOS 上执行编译产物(Mach-O 原生可执行;x64 经 Rosetta 2) /tmp/hello.macos || true elif [ -f "$BIN/paze.dll" ]; then - dotnet "$BIN/paze.dll" tests/hello.pe --target macos -o /tmp/hello.macos + dotnet "$BIN/paze.dll" tests/hello.pe --target macos $ARCH_FLAG -o /tmp/hello.macos file /tmp/hello.macos /tmp/hello.macos || true else