Skip to content

Commit a470a1a

Browse files
authored
feat: build macOS binaries natively for V8 code cache (#1014)
## Summary Build macOS binaries natively instead of cross-compiling from Linux. This enables fossilize 0.6.0's V8 code cache for macOS binaries, giving ~15% faster startup. ### Changes **Build matrix:** - `darwin-arm64`: `ubuntu-latest` → `macos-latest` (arm64, can smoke test) - `darwin-x64`: `ubuntu-latest` → `macos-13` (last Intel runner) - Linux and Windows targets unchanged (still cross-compiled from ubuntu-latest) **Codesign setup:** - Platform-aware rcodesign download (Linux musl, macOS arm64, macOS x64) - SHA256-pinned binaries for all three platforms - `shasum -a 256 -c` works on both Linux and macOS (replaces `sha256sum`) ### Code cache coverage after this PR | Target | Runner | Code Cache | Startup Improvement | |--------|--------|-----------|-------------------| | linux-x64 | ubuntu-latest | Yes | ~15% | | darwin-arm64 | macos-latest | **Yes (new)** | ~15% | | darwin-x64 | macos-13 | **Yes (new)** | ~15% | | linux-arm64 | ubuntu-latest | No (cross-compiled) | — | | windows-x64 | ubuntu-latest | No (cross-compiled) | — |
1 parent 13ef543 commit a470a1a

2 files changed

Lines changed: 82 additions & 8 deletions

File tree

.github/workflows/ci.yml

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,14 @@ jobs:
8181
]}'
8282
else
8383
# main, release/**, workflow_call: full cross-platform matrix.
84-
# All targets cross-compiled from ubuntu-latest via fossilize.
84+
# macOS targets build natively for V8 code cache (~15% faster startup).
85+
# Other targets cross-compile from ubuntu-latest via fossilize.
8586
echo '{"include":[
86-
{"target":"darwin-arm64", "os":"ubuntu-latest", "can-test":false},
87+
{"target":"darwin-arm64", "os":"macos-latest", "can-test":true},
88+
{"target":"darwin-x64", "os":"macos-13", "can-test":false},
8789
{"target":"linux-x64", "os":"ubuntu-latest", "can-test":true},
88-
{"target":"windows-x64", "os":"ubuntu-latest", "can-test":false},
89-
{"target":"darwin-x64", "os":"ubuntu-latest", "can-test":false},
90-
{"target":"linux-arm64", "os":"ubuntu-latest", "can-test":false}
90+
{"target":"linux-arm64", "os":"ubuntu-latest", "can-test":false},
91+
{"target":"windows-x64", "os":"ubuntu-latest", "can-test":false}
9192
]}'
9293
fi
9394
echo 'MATRIX_EOF'
@@ -261,12 +262,25 @@ jobs:
261262
env:
262263
APPLE_CERT_DATA: ${{ secrets.APPLE_CERT_DATA }}
263264
APPLE_API_KEY: ${{ secrets.APPLE_API_KEY }}
265+
shell: bash
264266
run: |
265-
curl -L 'https://github.com/indygreg/apple-platform-rs/releases/download/apple-codesign%2F0.29.0/apple-codesign-0.29.0-x86_64-unknown-linux-musl.tar.gz' -o 'rcodesign.tar.gz'
266-
echo 'dbe85cedd8ee4217b64e9a0e4c2aef92ab8bcaaa41f20bde99781ff02e600002 rcodesign.tar.gz' | sha256sum -c
267+
# Install rcodesign (platform-aware binary + checksum tool)
268+
if [[ "$RUNNER_OS" == "macOS" && "$RUNNER_ARCH" == "ARM64" ]]; then
269+
RCODESIGN_ARCHIVE="apple-codesign-0.29.0-aarch64-apple-darwin.tar.gz"
270+
RCODESIGN_SHA256="d1a532150adaf90048260d76359261aa716abafc45c53c5dc18845029184334a"
271+
elif [[ "$RUNNER_OS" == "macOS" ]]; then
272+
RCODESIGN_ARCHIVE="apple-codesign-0.29.0-x86_64-apple-darwin.tar.gz"
273+
RCODESIGN_SHA256="14ef11bedd51a8d95eafd767939ae96d5900e5a61511bef75bb21db6e7c74140"
274+
else
275+
RCODESIGN_ARCHIVE="apple-codesign-0.29.0-x86_64-unknown-linux-musl.tar.gz"
276+
RCODESIGN_SHA256="dbe85cedd8ee4217b64e9a0e4c2aef92ab8bcaaa41f20bde99781ff02e600002"
277+
fi
278+
curl -L "https://github.com/indygreg/apple-platform-rs/releases/download/apple-codesign%2F0.29.0/${RCODESIGN_ARCHIVE}" -o 'rcodesign.tar.gz'
279+
echo "${RCODESIGN_SHA256} rcodesign.tar.gz" | shasum -a 256 -c
267280
tar -xzf rcodesign.tar.gz --strip-components=1
268281
mv rcodesign /usr/local/bin/rcodesign
269282
rm rcodesign.tar.gz
283+
# Decode Apple signing credentials
270284
if [ -n "$APPLE_CERT_DATA" ]; then
271285
echo "$APPLE_CERT_DATA" | base64 --decode > /tmp/certs.p12
272286
echo 'APPLE_CERT_PATH=/tmp/certs.p12' >> $GITHUB_ENV

0 commit comments

Comments
 (0)