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

Add support for Apple Silicon (arm64) binaries #46

Merged
merged 5 commits into from
Mar 18, 2022
Merged
Show file tree
Hide file tree
Changes from 3 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
26 changes: 20 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,32 @@ jobs:
- uses: actions/checkout@v1

- name: Install Rust
run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
rustup target install aarch64-apple-darwin
rustup target install x86_64-apple-darwin

- name: Build release binary
- name: Build x86_64 release binary
run: |
source $HOME/.cargo/env
cargo build --verbose --locked --release
cargo build --verbose --locked --release --target x86_64-apple-darwin

- name: Upload artifacts
- name: Upload x86_64 artifacts
uses: actions/upload-artifact@v1
with:
name: foreman-macos-x86_64
path: target/x86_64-apple-darwin/release/foreman

- name: Build arm64 release binary
run: |
source $HOME/.cargo/env
cargo build --verbose --locked --release --target aarch64-apple-darwin

- name: Upload arm64 artifacts
uses: actions/upload-artifact@v1
with:
name: foreman-macos
path: target/release/foreman
name: foreman-macos-arm64
path: target/arm64-apple-darwin/release/foreman

linux:
runs-on: ubuntu-latest
Expand Down
14 changes: 12 additions & 2 deletions src/artifact_choosing.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
#[cfg(target_os = "windows")]
static PLATFORM_KEYWORDS: &[&str] = &["win32", "win64", "windows"];

#[cfg(target_os = "macos")]
static PLATFORM_KEYWORDS: &[&str] = &["macos", "darwin"];
#[cfg(all(target_os = "macos", target_arch = "x86_64"))]
static PLATFORM_KEYWORDS: &[&str] = &["macos-x86_64", "darwin-x86_64", "macos", "darwin"];

#[cfg(all(target_os = "macos", target_arch = "aarch64"))]
static PLATFORM_KEYWORDS: &[&str] = &[
"macos-arm64",
"darwin-arm64",
"macos-x86_64",
"darwin-x86_64",
"macos",
"darwin",
];

#[cfg(target_os = "linux")]
static PLATFORM_KEYWORDS: &[&str] = &["linux"];
Expand Down