Skip to content

Commit a5fe9ef

Browse files
committed
Build aarch64-apple-darwin binaries on CI
1 parent e4f922a commit a5fe9ef

File tree

2 files changed

+28
-13
lines changed

2 files changed

+28
-13
lines changed

.github/workflows/release.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,14 @@ jobs:
4141
profile: minimal
4242
override: true
4343

44+
- name: Install Rust toolchain (beta)
45+
if: matrix.os == 'macos-latest'
46+
uses: actions-rs/toolchain@v1
47+
with:
48+
toolchain: beta
49+
profile: minimal
50+
override: false
51+
4452
- name: Install Nodejs
4553
if: matrix.os == 'ubuntu-16.04'
4654
uses: actions/setup-node@v1

xtask/src/dist.rs

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -61,23 +61,30 @@ fn dist_server() -> Result<()> {
6161
if cfg!(target_os = "linux") {
6262
env::set_var("CC", "clang");
6363
}
64-
cmd!("cargo build --manifest-path ./crates/rust-analyzer/Cargo.toml --bin rust-analyzer --release").run()?;
6564

66-
let (src, dst) = if cfg!(target_os = "linux") {
67-
("./target/release/rust-analyzer", "./dist/rust-analyzer-linux")
65+
fn copy_artifact(src: &str, dst: &str) -> Result<()> {
66+
let src = Path::new(src);
67+
let dst = Path::new(dst);
68+
69+
cp(&src, &dst)?;
70+
gzip(&src, &dst.with_extension("gz"))?;
71+
72+
Ok(())
73+
}
74+
75+
cmd!("cargo build --manifest-path ./crates/rust-analyzer/Cargo.toml --bin rust-analyzer --release").run()?;
76+
if cfg!(target_os = "linux") {
77+
copy_artifact("./target/release/rust-analyzer", "./dist/rust-analyzer-linux")?;
6878
} else if cfg!(target_os = "windows") {
69-
("./target/release/rust-analyzer.exe", "./dist/rust-analyzer-windows.exe")
79+
copy_artifact("./target/release/rust-analyzer.exe", "./dist/rust-analyzer-windows.exe")?
7080
} else if cfg!(target_os = "macos") {
71-
("./target/release/rust-analyzer", "./dist/rust-analyzer-mac")
72-
} else {
73-
panic!("Unsupported OS")
74-
};
81+
copy_artifact("./target/release/rust-analyzer", "./dist/rust-analyzer-mac")?;
7582

76-
let src = Path::new(src);
77-
let dst = Path::new(dst);
78-
79-
cp(&src, &dst)?;
80-
gzip(&src, &dst.with_extension("gz"))?;
83+
cmd!("cargo +beta build --manifest-path ./crates/rust-analyzer/Cargo.toml --bin rust-analyzer --target aarch64-apple-darwin --release").run()?;
84+
copy_artifact("./target/release/rust-analyzer", "./dist/rust-analyzer-mac-arm")?;
85+
} else {
86+
panic!("Unsupported OS");
87+
}
8188

8289
Ok(())
8390
}

0 commit comments

Comments
 (0)