diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 62a2011..ccc4afd 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, macos-latest] + os: [ubuntu-latest, ubuntu-24.04-arm, macos-latest-large, macos-latest] steps: - uses: actions/checkout@v4 diff --git a/CHANGELOG.md b/CHANGELOG.md index 23737ad..4a8ca3c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] - ReleaseDate +- `dfxvm` now has the aarch64-linux version and supports installing dfx with the aarch64-linux binaries. + ## [1.0.1] - 2025-07-02 - `dfxvm --list` now supports listing the available dfx versions. diff --git a/dist-workspace.toml b/dist-workspace.toml index e16cf89..5b19c0d 100644 --- a/dist-workspace.toml +++ b/dist-workspace.toml @@ -10,7 +10,7 @@ ci = "github" # The installers to generate for each app installers = [] # Target platforms to build apps for (Rust target-triple syntax) -targets = ["aarch64-apple-darwin", "x86_64-apple-darwin", "x86_64-unknown-linux-gnu"] +targets = ["aarch64-apple-darwin", "aarch64-unknown-linux-gnu", "x86_64-apple-darwin", "x86_64-unknown-linux-gnu"] # Which actions to run on pull requests pr-run-mode = "plan" # The archive format to use for non-windows builds (defaults .tar.xz) @@ -21,5 +21,6 @@ dist = true [dist.github-custom-runners] global = "ubuntu-22.04" x86_64-unknown-linux-gnu = "ubuntu-22.04" +aarch64-unknown-linux-gnu = "ubuntu-22.04-arm" x86_64-apple-darwin = "macos-13" aarch64-apple-darwin = "macos-15" diff --git a/src/dfxvm/install.rs b/src/dfxvm/install.rs index bdaf924..4043985 100644 --- a/src/dfxvm/install.rs +++ b/src/dfxvm/install.rs @@ -101,8 +101,10 @@ async fn download_verified_tarball( #[allow(unused_variables)] fn format_tarball_basename(version: &Version) -> &'static str { - #[cfg(target_os = "linux")] + #[cfg(all(target_os = "linux", target_arch = "x86_64"))] return "dfx-x86_64-unknown-linux-gnu"; + #[cfg(all(target_os = "linux", target_arch = "aarch64"))] + return "dfx-aarch64-unknown-linux-gnu"; #[cfg(all(target_os = "macos", target_arch = "x86_64"))] return "dfx-x86_64-apple-darwin"; #[cfg(all(target_os = "macos", target_arch = "aarch64"))] diff --git a/src/dfxvm/self_update.rs b/src/dfxvm/self_update.rs index bf84721..32b9eab 100644 --- a/src/dfxvm/self_update.rs +++ b/src/dfxvm/self_update.rs @@ -65,11 +65,13 @@ pub fn cleanup_self_updater(locations: &Locations) -> Result<(), CleanupSelfUpda } fn format_tarball_url(settings: &Settings) -> Result { - #[cfg(target_arch = "aarch64")] + #[cfg(all(target_os = "macos", target_arch = "aarch64"))] let architecture = "aarch64-apple-darwin"; #[cfg(all(target_os = "macos", target_arch = "x86_64"))] let architecture = "x86_64-apple-darwin"; - #[cfg(target_os = "linux")] + #[cfg(all(target_os = "linux", target_arch = "aarch64"))] + let architecture = "aarch64-unknown-linux-gnu"; + #[cfg(all(target_os = "linux", target_arch = "x86_64"))] let architecture = "x86_64-unknown-linux-gnu"; let basename = format!("dfxvm-{}", architecture); diff --git a/tests/suite/common/file_contents.rs b/tests/suite/common/file_contents.rs index 47ed675..b8033ad 100644 --- a/tests/suite/common/file_contents.rs +++ b/tests/suite/common/file_contents.rs @@ -1,6 +1,7 @@ use crate::common::ReleaseAsset; use flate2::write::GzEncoder; use flate2::Compression; +use semver::Version; use serde_json::json; use sha2::{Digest, Sha256}; use std::io::Write; @@ -48,8 +49,8 @@ pub fn dist_manifest_json(latest: &str) -> String { .to_string() } -pub fn dfx_tarball(contents: &[u8]) -> Vec { - let dirname = ReleaseAsset::dfx_tarball_basename(); +pub fn dfx_tarball(version: &Version, contents: &[u8]) -> Vec { + let dirname = ReleaseAsset::dfx_tarball_basename(version); let include_docs = false; tool_tarball("dfx", dirname, contents, include_docs) diff --git a/tests/suite/common/release_asset.rs b/tests/suite/common/release_asset.rs index 74e66b5..8213763 100644 --- a/tests/suite/common/release_asset.rs +++ b/tests/suite/common/release_asset.rs @@ -18,13 +18,13 @@ impl ReleaseAsset { } pub fn dfx_tarball_with_dfx_contents(version: &str, executable: &[u8]) -> ReleaseAsset { - let filename = Self::dfx_tarball_filename().to_string(); let version = Version::parse(version).unwrap(); + let filename = Self::dfx_tarball_filename(&version).to_string(); // must match the download_url_template in ReleaseServer::new let url_path = format!("/any/arbitrary/path/{version}/{filename}"); - let contents = dfx_tarball(executable); + let contents = dfx_tarball(&version, executable); ReleaseAsset { url_path, filename, @@ -52,27 +52,41 @@ impl ReleaseAsset { .unwrap() } - pub fn dfx_tarball_basename() -> &'static str { - #[cfg(target_os = "macos")] - let basename = "dfx-x86_64-apple-darwin"; - #[cfg(target_os = "linux")] - let basename = "dfx-x86_64-unknown-linux-gnu"; - basename + #[allow(unused_variables)] + pub fn dfx_tarball_basename(version: &Version) -> &'static str { + #[cfg(all(target_os = "macos", target_arch = "x86_64"))] + return "dfx-x86_64-apple-darwin"; + #[cfg(all(target_os = "macos", target_arch = "aarch64"))] + { + // This is the first version that supports aarch64-apple-darwin. + let aarch64_apple_darwin_version = Version::parse("0.28.0-beta.1").unwrap(); + if version >= &aarch64_apple_darwin_version { + return "dfx-aarch64-apple-darwin"; + } + return "dfx-x86_64-apple-darwin"; + } + #[cfg(all(target_os = "linux", target_arch = "x86_64"))] + return "dfx-x86_64-unknown-linux-gnu"; + #[cfg(all(target_os = "linux", target_arch = "aarch64"))] + return "dfx-aarch64-unknown-linux-gnu"; } - pub fn dfx_tarball_filename() -> String { - let basename = Self::dfx_tarball_basename(); + pub fn dfx_tarball_filename(version: &Version) -> String { + let basename = Self::dfx_tarball_basename(version); let archive_format = "tar.gz"; format!("{basename}.{archive_format}") } + #[allow(unused_variables)] pub fn dfxvm_tarball_basename() -> String { - #[cfg(target_arch = "aarch64")] - let arch_and_os = "aarch64-apple-darwin"; + #[cfg(all(target_os = "linux", target_arch = "x86_64"))] + let arch_and_os = "x86_64-unknown-linux-gnu"; + #[cfg(all(target_os = "linux", target_arch = "aarch64"))] + let arch_and_os = "aarch64-unknown-linux-gnu"; #[cfg(all(target_os = "macos", target_arch = "x86_64"))] let arch_and_os = "x86_64-apple-darwin"; - #[cfg(target_os = "linux")] - let arch_and_os = "x86_64-unknown-linux-gnu"; + #[cfg(all(target_os = "macos", target_arch = "aarch64"))] + let arch_and_os = "aarch64-apple-darwin"; format!("dfxvm-{}", arch_and_os) }