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

Support macos-aarch64 as a platform keyword #60

Merged
merged 5 commits into from
Sep 27, 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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Foreman Changelog

## Unreleased

- Support `macos-aarch64` as an artifact name for Apple Silicon (arm64) binaries ([#60](https://github.com/Roblox/foreman/pull/60))

## 1.0.4 (2022-05-13)

- Introduce improved error output on using uninstalled tools ([#51](https://github.com/Roblox/foreman/pull/51))
Expand Down
2 changes: 2 additions & 0 deletions src/artifact_choosing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ static PLATFORM_KEYWORDS: &[&str] = &["macos-x86_64", "darwin-x86_64", "macos",
static PLATFORM_KEYWORDS: &[&str] = &[
"macos-arm64",
"darwin-arm64",
"macos-aarch64",
"darwin-aarch64",
"macos-x86_64",
"darwin-x86_64",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we keep the macos-x86_64 and darwin-x86_64 here? I think we could just remove them

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that should be possible actually - since the fallback "macos" will be picked anyways

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's fair to assume that if there are any disambiguated binaries, they'll probably all be disambiguated (rather than having macos-arm64 and macos, you'd have macos-arm64 and macos-x86_64 to make sure that both names are clear).

So I'm onboard with that as well; don't need to do it in this PR if you don't want to, though.

"macos",
Expand Down
38 changes: 38 additions & 0 deletions src/tool_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,44 @@ mod test {
assert_eq!(choose_asset(&release, &["linux"]), Some(0));
}

#[test]
fn select_correct_asset_macos() {
let release = Release {
prerelease: false,
tag_name: "v0.5.2".to_string(),
assets: vec![
ReleaseAsset {
name: "tool-linux.zip".to_string(),
url: "https://example.com/some/repo/releases/assets/1".to_string(),
},
ReleaseAsset {
name: "tool-macos-x86_64.zip".to_string(),
url: "https://example.com/some/repo/releases/assets/2".to_string(),
},
ReleaseAsset {
name: "tool-macos-aarch64.zip".to_string(),
url: "https://example.com/some/repo/releases/assets/3".to_string(),
},
],
};
assert_eq!(
choose_asset(
&release,
&[
"macos-arm64",
"darwin-arm64",
"macos-aarch64",
"darwin-aarch64",
"macos-x86_64",
"darwin-x86_64",
"macos",
"darwin",
]
),
Some(2)
);
}

mod load {
use super::*;

Expand Down