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

feat: add aarch64-apple-darwin platform #22

Merged
merged 1 commit into from
Aug 2, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
10 changes: 9 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ pub enum Platform {
LinuxMuslArm,
LinuxMuslArmV7,
MacOs,
MacOsAarch64,
Windows,
}

Expand All @@ -104,6 +105,7 @@ impl fmt::Display for Platform {
Platform::LinuxMuslArm => write!(f, "arm-unknown-linux-musleabi"),
Platform::LinuxMuslArmV7 => write!(f, "armv7-unknown-linux-musleabihf"),
Platform::MacOs => write!(f, "x86_64-apple-darwin"),
Platform::MacOsAarch64 => write!(f, "aarch64-apple-darwin"),
Platform::Windows => write!(f, "x86_64-pc-windows-msvc"), // This appears to be the same as the above, so I'm using the same string.
}
}
Expand Down Expand Up @@ -427,7 +429,13 @@ pub fn get_running_platform() -> Result<Platform> {
}
Ok(Platform::Windows)
}
"macos" => Ok(Platform::MacOs),
"macos" => match ARCH {
"x86_64" => Ok(Platform::MacOs),
"aarch64" => Ok(Platform::MacOsAarch64),
&_ => Err(Error::PlatformNotSupported(format!(
"We currently do not have binaries for the {OS}/{ARCH} combination"
))),
},
&_ => Err(Error::PlatformNotSupported(format!(
"{OS} is not currently supported"
))),
Expand Down
13 changes: 12 additions & 1 deletion tests/test_download_from_s3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use sn_releases::{ArchiveType, Platform, ReleaseType, SafeReleaseRepoActions};
const FAUCET_VERSION: &str = "0.1.98";
const NAT_DETECTION_VERSION: &str = "0.1.0";
const NODE_LAUNCHPAD_VERSION: &str = "0.1.0";
const SAFE_VERSION: &str = "0.83.51";
const SAFE_VERSION: &str = "0.94.0";
const SAFENODE_VERSION: &str = "0.93.7";
const SAFENODE_MANAGER_VERSION: &str = "0.1.8";
const SAFENODE_MANAGERD_VERSION: &str = "0.4.1";
Expand Down Expand Up @@ -132,6 +132,17 @@ async fn should_download_and_extract_safe_for_macos() {
.await;
}

#[tokio::test]
async fn should_download_and_extract_safe_for_macos_aarch64() {
download_and_extract(
&ReleaseType::Safe,
SAFE_VERSION,
&Platform::MacOsAarch64,
&ArchiveType::TarGz,
)
.await;
}

#[tokio::test]
async fn should_download_and_extract_safe_for_windows() {
download_and_extract(
Expand Down
Loading