Skip to content

Commit

Permalink
feat: add aarch64-apple-darwin platform
Browse files Browse the repository at this point in the history
  • Loading branch information
mickvandijke committed Aug 2, 2024
1 parent 0a6084a commit bd93e58
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
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

0 comments on commit bd93e58

Please sign in to comment.