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 universal binary for Mac #1635

Merged
merged 4 commits into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 4 additions & 37 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,40 +37,22 @@ jobs:
macos:
name: Build - MacOS
runs-on: macos-latest
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Set up cargo
uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Cargo Cache
uses: Swatinem/rust-cache@v2
- name: Compile and package Volta
run: ./ci/build-macos-x86_64.sh volta-macos
- name: Upload release artifact
uses: actions/upload-artifact@v3
with:
name: macos
path: target/release/volta-macos.tar.gz

macos-aarch64:
name: Build - MacOS (ARM)
runs-on: macos-latest
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Set up cargo
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
target: aarch64-apple-darwin
target: aarch64-apple-darwin,x86_64-apple-darwin
- name: Cargo Cache
uses: Swatinem/rust-cache@v2
- name: Compile and package Volta
run: ./ci/build-macos-arm.sh volta-macos-aarch64
run: ./ci/build-macos.sh volta-macos
- name: Upload release artifact
uses: actions/upload-artifact@v3
with:
name: macos-aarch64
path: target/aarch64-apple-darwin/release/volta-macos-aarch64.tar.gz
name: macos
path: target/universal-apple-darwin/release/volta-macos.tar.gz

windows:
name: Build - Windows
Expand Down Expand Up @@ -107,7 +89,6 @@ jobs:
needs:
- linux
- macos
- macos-aarch64
- windows
if: github.event_name == 'push'
steps:
Expand All @@ -128,11 +109,6 @@ jobs:
with:
name: macos
path: release
- name: Fetch MacOS (ARM) artifact
uses: actions/download-artifact@v2
with:
name: macos-aarch64
path: release
- name: Fetch Windows installer
uses: actions/download-artifact@v2
with:
Expand Down Expand Up @@ -172,15 +148,6 @@ jobs:
asset_path: ./release/volta-macos.tar.gz
asset_name: volta-${{ steps.release_info.outputs.version }}-macos.tar.gz
asset_content_type: application/gzip
- name: Upload MacOS (ARM) artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./release/volta-macos-aarch64.tar.gz
asset_name: volta-${{ steps.release_info.outputs.version }}-macos-aarch64.tar.gz
asset_content_type: application/gzip
- name: Upload Windows installer
uses: actions/upload-release-asset@v1
env:
Expand Down
12 changes: 0 additions & 12 deletions ci/build-macos-arm.sh

This file was deleted.

12 changes: 0 additions & 12 deletions ci/build-macos-x86_64.sh

This file was deleted.

21 changes: 21 additions & 0 deletions ci/build-macos.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

set -e

echo "Building Volta"

MACOSX_DEPLOYMENT_TARGET=11.0 cargo build --release --target=aarch64-apple-darwin
MACOSX_DEPLOYMENT_TARGET=11.0 cargo build --release --target=x86_64-apple-darwin

echo "Packaging Binaries"

mkdir -p target/universal-apple-darwin/release

for exe in volta volta-shim volta-migrate
do
lipo -create -output target/universal-apple-darwin/release/$exe target/x86_64-apple-darwin/release/$exe target/aarch64-apple-darwin/release/$exe
done

cd target/universal-apple-darwin/release

tar -zcvf "$1.tar.gz" volta volta-shim volta-migrate
6 changes: 1 addition & 5 deletions dev/unix/volta-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,7 @@ parse_os_info() {
fi
;;
Darwin)
if [ "$(uname -m)" == "arm64" ]; then
echo "macos-aarch64"
else
echo "macos"
fi
echo "macos"
;;
*)
return 1
Expand Down