Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(ci): Publish MacOS universal binaries to github releases #568

Merged
merged 12 commits into from
Oct 13, 2021
55 changes: 43 additions & 12 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,41 +48,72 @@ jobs:
path: build/*

mac:
# Note: This doesn't use a build matrix, as it requires a last step to merge the x86
# and ARM binaries into one universal one. This need will go away once
# https://github.com/rust-lang/cargo/issues/8875 is resolved.
name: Build Binary on MacOS
runs-on: macos-10.15

runs-on: macos-11
steps:
- name: Checkout sources
uses: actions/checkout@v2

- name: Install rust stable toolchain
- name: Install rust stable toolchain for x86_64
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
target: x86_64-apple-darwin

- name: Run cargo build
- name: Run cargo build for x86_64
uses: actions-rs/cargo@v1
env:
# Generates separate debug symbol files alongside release builds
CARGO_PROFILE_RELEASE_SPLIT_DEBUGINFO: packed
with:
command: build
args: --all --release --locked
args: --all --release --locked --target=x86_64-apple-darwin

- name: Install rust stable toolchain for ARM
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
target: aarch64-apple-darwin

- name: Archive debug info
- name: Run cargo build for ARM
uses: actions-rs/cargo@v1
env:
# Generates separate debug symbol files alongside release builds
CARGO_PROFILE_RELEASE_SPLIT_DEBUGINFO: packed
with:
command: build
args: --all --release --locked --target=aarch64-apple-darwin

- name: Archive debug info and create universal binary
run: |
mkdir -p build

# Move all binaries to output directory
mv target/release/symbolicator build/symbolicator-Darwin-x86_64
mv target/release/wasm-split build/wasm-split-Darwin-x86_64
mv target/release/symsorter build/symsorter-Darwin-x86_64
lipo -create -output build/symbolicator-Darwin-universal \
target/x86_64-apple-darwin/release/symbolicator \
target/aarch64-apple-darwin/release/symbolicator

lipo -create -output build/wasm-split-Darwin-universal \
target/x86_64-apple-darwin/release/wasm-split \
target/aarch64-apple-darwin/release/wasm-split

lipo -create -output build/symsorter-Darwin-universal \
target/x86_64-apple-darwin/release/symsorter \
target/aarch64-apple-darwin/release/symsorter

cd target/x86_64-apple-darwin/release
# Recursive zip the debug symbol folder and place the output in the output directory
cd target/release
zip -r ../../build/symbolicator-Darwin-x86_64-debug.zip symbolicator.dSYM
zip -r ../../../build/symbolicator-x86_64-apple-darwin-debug.zip symbolicator.dSYM
cd ../../../

cd target/x86_64-apple-darwin/release
zip -r ../../../build/symbolicator-aarch64-apple-darwin-debug.zip symbolicator.dSYM

- uses: actions/upload-artifact@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
### Tools

- `symsorter` no longer emits files with empty debug identifiers. ([#469](https://github.com/getsentry/symbolicator/pull/469))
- MacOS x86_64 builds of symbolicator, symsorter and wasm-split can be downloaded from GitHub releases now. ([#565](https://github.com/getsentry/symbolicator/pull/565))
- MacOS universal builds (x86_64 + ARM in one fat binary) of symbolicator, symsorter and wasm-split can be downloaded from GitHub releases now. ([#565](https://github.com/getsentry/symbolicator/pull/565), [#568](https://github.com/getsentry/symbolicator/pull/568))

### Internal

Expand Down