Skip to content

Commit

Permalink
Add support for Apple Silicon (arm64) binaries (#46)
Browse files Browse the repository at this point in the history
Include architecture name in macOS platform keywords
Add arm64 foreman build
  • Loading branch information
amatosov-rbx authored Mar 18, 2022
1 parent caadcd6 commit 75bea11
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 8 deletions.
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/target
/.vscode
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Foreman Changelog

## Unreleased Changes
- Add support for Apple Silicon (arm64) binaries ([#46](https://github.com/Roblox/foreman/pull/46))

## 1.0.3 (2022-02-04)

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

0 comments on commit 75bea11

Please sign in to comment.