-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Build aarch64-apple-darwin binaries on CI #6989
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
Conversation
I have no idea if this will work, but I couldn't figure how to trigger the action on my fork. |
@lnicola I guess you could get the action to trigger by merging this change into |
I think you can also trigger them manually, but actions don't usually run on forks. |
Oh, I had to push it to the |
@lnicola Looks like it's building on your fork after pushing to |
Hmm, looks like the build failed during linking. I think it's because compilation for https://github.com/lnicola/rust-analyzer/runs/1591171874#step:9:477
There are two ways around this: you can manually select the macOS 11 SDK, according to shepmaster's instructions:
Or you can set GitHub Actions to run on the jobs:
dist:
name: dist
runs-on: ${{ matrix.os }}
strategy:
matrix:
- os: [ubuntu-16.04, windows-latest, macos-latest]
+ os: [ubuntu-16.04, windows-latest, macos-11.0] |
Also, will the necessary code change to |
Thanks for looking it up -- I had to step out for a bit. I do wonder if the
Yeah, I planned to do it in a different PR, after making sure that the binaries are built fine. |
@lnicola Looks like the binaries built on CI: https://github.com/lnicola/rust-analyzer/releases/tag/nightly |
I don't think they did, there's no ARM binary. Maybe it used the code from the wrong branch? EDIT: ah, the real nightly kicked in and overwritten the release. Anyway, I suppose it would be better to restructure the workflow to build them in parallel. |
Yep, the real nightly kicked in. I wish there was a way for you to tag it to build as separate. Potentially add an I don't know if there's a way to build them in parallel in the same job. Wouldn't it take more time to set up another whole macOS runner just to build the additional binary? |
@richiksc if you don't mind, can you download a
In separate jobs, I meant. Not sure if it's better to use a single job or two, but it might make sense to have two. I tried to implement that (untested, I don't want to trigger another release until someone tests the latest one) |
359beb5
to
45e4f25
Compare
|
||
let toolchain = get_toolchain(&target); | ||
cmd!("cargo +{toolchain} build --manifest-path ./crates/rust-analyzer/Cargo.toml --bin rust-analyzer --target {target} --release").run()?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if this works..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
THe +{toolchain}
syntax? Yeah, it should work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, thanks for looking into this, @lnicola !
As a super-minor stylistic changes, I am not a fan of get_
/ compute_
/ find_
preffixes on function names (get_executable_extension
). I feel that they add zero additional information, and can be removed.
It might be argueed that let ext = get_extension(target)
reads better than let ext = extension(target)
, but that depends on how do you look at the code.
If you look at it as action, then, yes, first one is better. But you can also see this as a predicate/assetion -- ext is extension of target
. In that second reading, get
prefix is not required.
To be clear, this is absolutely irrelevant in practice :-)
|
||
let toolchain = get_toolchain(&target); | ||
cmd!("cargo +{toolchain} build --manifest-path ./crates/rust-analyzer/Cargo.toml --bin rust-analyzer --target {target} --release").run()?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
THe +{toolchain}
syntax? Yeah, it should work
xtask/src/dist.rs
Outdated
} | ||
} | ||
|
||
fn get_executable_extension(target: &str) -> String { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fn get_executable_extension(target: &str) -> String { | |
fn get_executable_suffix(target: &str) -> String { |
https://doc.rust-lang.org/std/env/consts/constant.EXE_SUFFIX.html
extensioni s a thing without .
.
xtask/src/dist.rs
Outdated
} | ||
} | ||
|
||
fn get_release_artifact_name(target: &str) -> String { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the plan here is to add full target tripple to the executable name? With two different macs that makes sense actually, 👍.
For the transition, we should adjust vscode, and broadcast the change to the clients issue. We might also just publish to sets of artifacts? THat is, run cp rust-analyzer-windows.exe rust-analyzer-x86_64-pc-windows-msvc.exe
in `.yaml.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the plan here is to add full target tripple to the executable name? With two different macs that makes sense actually, +1.
We also had requests for Windows ARM binaries, so using the target tuple seems reasonable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the transition, we should adjust vscode, and broadcast the change to the clients issue. We might also just publish to sets of artifacts? THat is, run cp rust-analyzer-windows.exe rust-analyzer-x86_64-pc-windows-msvc.exe in `.yaml.
I did it the other way around, but in xtask
.
r=me |
No problem, I shortened those, maybe even too much. I left |
I triggered another test run (sorry), to make sure the workflow changes still work. |
55173a3
to
3f7e904
Compare
https://github.com/lnicola/rust-analyzer/releases/tag/nightly 🎉 bors r=matklad |
bors seems stuck again (I think I've seen it merge workflows changes once), I'll merge manually. |
6989: Build aarch64-apple-darwin binaries on CI r=matklad a=lnicola This splits the `dist` matrix job into four and tries to make `xtask dist` more principled about target and artifact naming. Co-authored-by: Laurențiu Nicola <[email protected]>
@lnicola I wasn't able to test this earlier due to my timezone. I'd love to test the binary today but I can't see a release on your fork anymore - was it deleted for some reason? I can definitely run the benchmark in the rust-analyzer repo if necessary. |
Oof, I deleted the branch and they're gone. I triggered a new build, but they don't seem to have a lot of
It's not necessary, of course :-). |
@richiksc I think it's ready |
@lnicola Hmm, the release seems to have both binaries with the old naming scheme ("rust-analyzer-mac") and the new naming scheme ("rust-analyzer-x86_64-apple-darwin") - are you building it twice? |
both names are essential, to give time for non-vs-code clients to migrate
to new names
…On Tue, 22 Dec 2020 at 23:10, Richik SC ***@***.***> wrote:
@lnicola <https://github.com/lnicola> Hmm, the release seems to have both
binaries with the old naming scheme ("rust-analyzer-mac") and the new
naming scheme ("rust-analyzer-x86_64-apple-darwin") - are you building it
twice?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#6989 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AANB3M2IR2EO7ECPLYA2X6DSWD4NFANCNFSM4VETS3JA>
.
|
No, it's just making a copy. |
@lnicola Ok, I've ran the benchmark. Here's the results (13" MacBook Pro, M1, Late 2020, 16GB RAM): rust-analyzer-aarch64-apple-darwin (ARM Native)
rust-analyzer-x86_64-apple-darwin (Rosetta 2)
As you can see, a significant 35% reduction in analysis time just by being ARM native. This is the second run of the x86_64 binary, as the first time, it just hung. I'm guessing it was because Rosetta 2 was performing AOT translation of it. It reported |
Then it works! Can you also use it with Code? You can set the server path in the settings. |
@lnicola Yep, works great on the arm64 native Insiders build of VSCode! Edit: this is the rust-analyzer extension v0.2.424 downloaded from the VSCode Extension Marketplace - I didn't load the nightly vsix from your release. |
This splits the
dist
matrix job into four and tries to makextask dist
more principled about target and artifact naming.