ref:6716058eb35c3baeeda67421c7945f8a5b31429c

Build and publish macOS release binaries (#26)

`anvil update` 404s on macOS because releases only ever published Linux binaries — the server and CLI both already map Darwin/{aarch64, x86_64} to macos_{arm64,amd64} assets, but the build script never produced them. Add aarch64/x86_64-apple-darwin to the cargo-zigbuild matrix (pure rustls CLI → zig's bundled macOS libc links it without a full Xcode SDK), stage + version them, include them in SHA256SUMS, and upload them in `release create`. The glibc-floor gate stays linux-only (Apple libSystem, not glibc). Closes #26 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
SHA: 6716058eb35c3baeeda67421c7945f8a5b31429c
Author: CI <ci@anvil.test>
Date: 2026-07-13 00:25
Parents: 0ed742e
1 files changed +28 -6
Type
ci/build-runner.sh +28 −6
@@ -55,15 +55,26 @@
command -v cargo-zigbuild >/dev/null 2>&1 || \
cargo install --locked cargo-zigbuild --version "$ZIGBUILD_VERSION" 2>&1
rustup target add \
aarch64-unknown-linux-gnu x86_64-unknown-linux-gnu \
aarch64-apple-darwin x86_64-apple-darwin 2>&1
rustup target add aarch64-unknown-linux-gnu x86_64-unknown-linux-gnu 2>&1
echo "==> Building linux arm64 (glibc $GLIBC_FLOOR floor)..."
echo "==> Building arm64 (glibc $GLIBC_FLOOR floor)..."
cargo zigbuild --release --target "aarch64-unknown-linux-gnu.${GLIBC_FLOOR}" 2>&1
echo "==> Building amd64 (glibc $GLIBC_FLOOR floor)..."
echo "==> Building linux amd64 (glibc $GLIBC_FLOOR floor)..."
cargo zigbuild --release --target "x86_64-unknown-linux-gnu.${GLIBC_FLOOR}" 2>&1
# macOS targets: no glibc floor (Apple libSystem, not glibc). The CLI is pure
# rustls (reqwest rustls-tls, default-features=false — no native-tls/Security
# framework), so zig's bundled macOS libc links it without a full Xcode SDK.
echo "==> Building macos arm64..."
cargo zigbuild --release --target aarch64-apple-darwin 2>&1
echo "==> Building macos amd64..."
cargo zigbuild --release --target x86_64-apple-darwin 2>&1
ARM64_BIN="target/aarch64-unknown-linux-gnu/release/anvil"
AMD64_BIN="target/x86_64-unknown-linux-gnu/release/anvil"
MACOS_ARM64_BIN="target/aarch64-apple-darwin/release/anvil"
MACOS_AMD64_BIN="target/x86_64-apple-darwin/release/anvil"
# Hard-gate the glibc floor: fail the build if either binary references a
# GLIBC symbol newer than the floor. This is the exact failure we're fixing
@@ -91,6 +102,8 @@
mkdir -p runner-dist
cp "$ARM64_BIN" runner-dist/anvil_linux_arm64
cp "$AMD64_BIN" runner-dist/anvil_linux_amd64
cp "$MACOS_ARM64_BIN" runner-dist/anvil_macos_arm64
cp "$MACOS_AMD64_BIN" runner-dist/anvil_macos_amd64
if [ "$PUBLISH" != "1" ]; then
exit 0
@@ -101,6 +114,8 @@
cp "$ARM64_BIN" "runner-dist/anvil_linux_arm64_${VERSION}"
cp "$AMD64_BIN" "runner-dist/anvil_linux_amd64_${VERSION}"
cp "$MACOS_ARM64_BIN" "runner-dist/anvil_macos_arm64_${VERSION}"
cp "$MACOS_AMD64_BIN" "runner-dist/anvil_macos_amd64_${VERSION}"
# Compute SHA256 checksums for every versioned asset — published as
# SHA256SUMS_${VERSION} alongside the binaries so install scripts can
@@ -110,10 +125,11 @@
(
cd runner-dist
# Use whichever is available; macOS has shasum, Linux has sha256sum.
ASSETS="anvil_linux_arm64_${VERSION} anvil_linux_amd64_${VERSION} anvil_macos_arm64_${VERSION} anvil_macos_amd64_${VERSION}"
if command -v sha256sum >/dev/null 2>&1; then
sha256sum "anvil_linux_arm64_${VERSION}" "anvil_linux_amd64_${VERSION}" > "SHA256SUMS_${VERSION}"
sha256sum $ASSETS > "SHA256SUMS_${VERSION}"
else
shasum -a 256 "anvil_linux_arm64_${VERSION}" "anvil_linux_amd64_${VERSION}" > "SHA256SUMS_${VERSION}"
shasum -a 256 $ASSETS > "SHA256SUMS_${VERSION}"
fi
)
cat "runner-dist/SHA256SUMS_${VERSION}"
@@ -128,7 +144,7 @@
else
CHANGELOG=$(git log --oneline -n 20)
fi
BODY=$(printf 'Runner binaries for linux/amd64 and linux/arm64.\n\n## Changes\n\n%s\n' "$CHANGELOG")
BODY=$(printf 'Runner binaries for linux/{amd64,arm64} and macos/{amd64,arm64}.\n\n## Changes\n\n%s\n' "$CHANGELOG")
"$ANVIL_CLI" release create \
--tag "$VERSION" \
@@ -149,6 +165,12 @@
--repo fangorn/anvil-cli
"$ANVIL_CLI" release upload "$VERSION" \
"runner-dist/anvil_linux_amd64_${VERSION}" \
--repo fangorn/anvil-cli
"$ANVIL_CLI" release upload "$VERSION" \
"runner-dist/anvil_macos_arm64_${VERSION}" \
--repo fangorn/anvil-cli
"$ANVIL_CLI" release upload "$VERSION" \
"runner-dist/anvil_macos_amd64_${VERSION}" \
--repo fangorn/anvil-cli
"$ANVIL_CLI" release upload "$VERSION" \
"runner-dist/SHA256SUMS_${VERSION}" \