Skip to content

Commit 75bea11

Browse files
authored
Add support for Apple Silicon (arm64) binaries (#46)
Include architecture name in macOS platform keywords Add arm64 foreman build
1 parent caadcd6 commit 75bea11

File tree

4 files changed

+34
-8
lines changed

4 files changed

+34
-8
lines changed

.github/workflows/release.yml

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,32 @@ jobs:
2727
- uses: actions/checkout@v1
2828

2929
- name: Install Rust
30-
run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
30+
run: |
31+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
32+
rustup target install aarch64-apple-darwin
33+
rustup target install x86_64-apple-darwin
3134
32-
- name: Build release binary
35+
- name: Build x86_64 release binary
3336
run: |
3437
source $HOME/.cargo/env
35-
cargo build --verbose --locked --release
38+
cargo build --verbose --locked --release --target x86_64-apple-darwin
3639
37-
- name: Upload artifacts
40+
- name: Upload x86_64 artifacts
41+
uses: actions/upload-artifact@v1
42+
with:
43+
name: foreman-macos-x86_64
44+
path: target/x86_64-apple-darwin/release/foreman
45+
46+
- name: Build arm64 release binary
47+
run: |
48+
source $HOME/.cargo/env
49+
cargo build --verbose --locked --release --target aarch64-apple-darwin
50+
51+
- name: Upload arm64 artifacts
3852
uses: actions/upload-artifact@v1
3953
with:
40-
name: foreman-macos
41-
path: target/release/foreman
54+
name: foreman-macos-arm64
55+
path: target/arm64-apple-darwin/release/foreman
4256

4357
linux:
4458
runs-on: ubuntu-latest

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
/target
2+
/.vscode

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Foreman Changelog
22

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

56
## 1.0.3 (2022-02-04)
67

src/artifact_choosing.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
11
#[cfg(target_os = "windows")]
22
static PLATFORM_KEYWORDS: &[&str] = &["win32", "win64", "windows"];
33

4-
#[cfg(target_os = "macos")]
5-
static PLATFORM_KEYWORDS: &[&str] = &["macos", "darwin"];
4+
#[cfg(all(target_os = "macos", target_arch = "x86_64"))]
5+
static PLATFORM_KEYWORDS: &[&str] = &["macos-x86_64", "darwin-x86_64", "macos", "darwin"];
6+
7+
#[cfg(all(target_os = "macos", target_arch = "aarch64"))]
8+
static PLATFORM_KEYWORDS: &[&str] = &[
9+
"macos-arm64",
10+
"darwin-arm64",
11+
"macos-x86_64",
12+
"darwin-x86_64",
13+
"macos",
14+
"darwin",
15+
];
616

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

0 commit comments

Comments
 (0)