diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 121543d030..48cb6a3076 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -55,11 +55,14 @@ jobs: matrix: # We build a dynamic-linked linux binary because otherwise HSM support fails with: # Error: IO: Dynamic loading not supported - os: [macos-13, ubuntu-22.04, ubuntu-24.04, windows-2022] + os: [macos-13, macos-13-xlarge, ubuntu-22.04, ubuntu-24.04, windows-2022] include: - os: macos-13 target: x86_64-apple-darwin binary_path: target/x86_64-apple-darwin/release/dfx + - os: macos-13-xlarge + target: aarch64-apple-darwin + binary_path: target/aarch64-apple-darwin/release/dfx - os: ubuntu-22.04 target: x86_64-unknown-linux-gnu binary_path: target/x86_64-unknown-linux-gnu/release/dfx @@ -111,7 +114,7 @@ jobs: strategy: fail-fast: false matrix: - os: [macos-13, ubuntu-22.04, ubuntu-24.04] + os: [macos-13, macos-13-xlarge, ubuntu-22.04, ubuntu-24.04] steps: - uses: actions/checkout@v4 - name: Download dfx binary @@ -181,7 +184,7 @@ jobs: strategy: fail-fast: false matrix: - os: [macos-13, ubuntu-22.04, ubuntu-24.04] + os: [macos-13, macos-13-xlarge, ubuntu-22.04, ubuntu-24.04] steps: - name: Checking out repo uses: actions/checkout@v4 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 77d27dcb96..324ae38863 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -43,7 +43,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ ubuntu-latest, macos-13-large, windows-latest ] + os: [ ubuntu-latest, macos-13-large, macos-13-xlarge, windows-latest ] steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/prepare-dfx-assets.yml b/.github/workflows/prepare-dfx-assets.yml index 4a405b762b..070cfd3dcb 100644 --- a/.github/workflows/prepare-dfx-assets.yml +++ b/.github/workflows/prepare-dfx-assets.yml @@ -26,7 +26,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ ubuntu-latest, macos-13-large ] + os: [ ubuntu-latest, macos-13-large, macos-13-xlarge ] steps: - uses: actions/checkout@v4 - uses: actions/cache@v4 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 2fc921e514..6dfd8beac0 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -31,13 +31,18 @@ jobs: matrix: # We build a dynamic-linked linux binary because otherwise HSM support fails with: # Error: IO: Dynamic loading not supported - target: [ x86_64-apple-darwin, x86_64-unknown-linux-gnu ] + target: [ x86_64-apple-darwin, aarch64-apple-darwin, x86_64-unknown-linux-gnu ] include: - os: macos-13-large target: x86_64-apple-darwin binary_path: target/x86_64-apple-darwin/release name: x86_64-darwin tar: gtar + - os: macos-13-xlarge + target: aarch64-apple-darwin + binary_path: target/aarch64-apple-darwin/release + name: aarch64-darwin + tar: gtar - os: ubuntu-22.04 target: x86_64-unknown-linux-gnu binary_path: target/x86_64-unknown-linux-gnu/release @@ -146,7 +151,7 @@ jobs: strategy: fail-fast: false matrix: - name: [ 'x86_64-darwin', 'x86_64-linux' ] + name: [ 'x86_64-darwin', 'aarch64-darwin', 'x86_64-linux' ] steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/unit.yml b/.github/workflows/unit.yml index 89495e8b4d..f4b44a3368 100644 --- a/.github/workflows/unit.yml +++ b/.github/workflows/unit.yml @@ -45,7 +45,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ ubuntu-latest, macos-13-large ] + os: [ ubuntu-latest, macos-13-large, macos-13-xlarge ] steps: - uses: actions/checkout@v4 - uses: actions/cache@v4 diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c78b735bb..1591753df7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,10 @@ You can get the fees by `get_config` API on the [BTC Mainnet Canister](https://d If you were using the contents of the `pocket-ic-proxy-port` file to determine the port for the `/http_gateway` endpoint, you should instead use `dfx info pocketic-config-port` +### feat: add dfx native support for aarch64-Darwin + +Add dfx native support for aarch64-Darwin. + ## Dependencies ### Replica diff --git a/scripts/update-motoko.sh b/scripts/update-motoko.sh index 7be55cdc52..cb59c4d3f7 100755 --- a/scripts/update-motoko.sh +++ b/scripts/update-motoko.sh @@ -29,7 +29,7 @@ motoko_base_sha=$(curl --proto '=https' --tlsv1.2 -sSfL "$motoko_base_url" | sha jq '.common."motoko-base" = {url: $url, sha256: $sha256, version: $version}' --arg version "$version" \ --arg url "$motoko_base_url" --arg sha256 "$motoko_base_sha" "$sources" | sponge "$sources" -declare -A variants=([x86_64-darwin]=Darwin-x86_64 [x86_64-linux]=Linux-x86_64) +declare -A variants=([x86_64-darwin]=Darwin-x86_64 [x86_64-linux]=Linux-x86_64 [arm64-darwin]=Darwin-arm64) for platform in "${!variants[@]}"; do motoko_url=$(printf 'https://github.com/dfinity/motoko/releases/download/%s/motoko-%s-%s.tar.gz' \ "$(urlencode "$version")" "$(urlencode "${variants[$platform]}")" "$(urlencode "$version")") diff --git a/scripts/update-replica.sh b/scripts/update-replica.sh index be1a622fc1..7a6a9c9abc 100755 --- a/scripts/update-replica.sh +++ b/scripts/update-replica.sh @@ -21,8 +21,10 @@ sources="src/dfx/assets/dfx-asset-sources.json" rev=$1 echo "Updating sources to rev ${rev}" jq '."replica-rev" = $rev' --arg rev "$rev" "$sources" | sponge "$sources" -for platform in x86_64-darwin x86_64-linux; do - pocketic_url=$(printf 'https://download.dfinity.systems/ic/%s/binaries/%s/pocket-ic.gz' "$rev" "$platform") + +declare -A variants=([x86_64-darwin]=pocket-ic.gz [x86_64-linux]=pocket-ic.gz [arm64-darwin]=pocket-ic-server-arm64-darwin) +for platform in "${!variants[@]}"; do + pocketic_url=$(printf 'https://download.dfinity.systems/ic/%s/binaries/%s/%s' "$rev" "$platform" "${variants[$platform]}") pocketic_sha=$(curl --proto '=https' --tlsv1.2 -sSfL "$pocketic_url" | sha256sum | head -c 64) jq '.[$platform]."pocket-ic" = {url: $url, sha256: $sha256, rev: $rev}' --arg platform "$platform" --arg rev "$rev" \ --arg url "$pocketic_url" --arg sha256 "$pocketic_sha" "$sources" | sponge "$sources" diff --git a/scripts/workflows/e2e-matrix.py b/scripts/workflows/e2e-matrix.py index 78c9c78ce1..92a20eab99 100755 --- a/scripts/workflows/e2e-matrix.py +++ b/scripts/workflows/e2e-matrix.py @@ -38,6 +38,11 @@ def test_scripts(prefix): "os": "macos-13", "serial": serial, }) + include.append({ + "test": test, + "os": "macos-13-xlarge", + "serial": serial, + }) matrix = { "include": include, diff --git a/src/dfx/assets/build.rs b/src/dfx/assets/build.rs index 7513cd93c1..b320df95ea 100644 --- a/src/dfx/assets/build.rs +++ b/src/dfx/assets/build.rs @@ -64,6 +64,8 @@ struct Sources { x86_64_linux: HashMap, #[serde(rename = "x86_64-darwin")] x86_64_darwin: HashMap, + #[serde(rename = "arm64-darwin")] + aarch64_darwin: HashMap, common: HashMap, #[serde(rename = "replica-rev")] replica_rev: String, @@ -99,7 +101,8 @@ fn find_assets(sources: Sources) -> PathBuf { &*env::var("CARGO_CFG_TARGET_ARCH").unwrap(), &*env::var("CARGO_CFG_TARGET_OS").unwrap(), ) { - ("x86_64" | "aarch64", "macos") => sources.x86_64_darwin, // rosetta + ("x86_64", "macos") => sources.x86_64_darwin, // rosetta + ("aarch64", "macos") => sources.aarch64_darwin, // aarch64 ("x86_64", "linux" | "windows") => sources.x86_64_linux, (arch, os) => panic!("Unsupported OS type {arch}-{os}"), }; diff --git a/src/dfx/assets/dfx-asset-sources.json b/src/dfx/assets/dfx-asset-sources.json index d673e711dd..c6f2e501a5 100644 --- a/src/dfx/assets/dfx-asset-sources.json +++ b/src/dfx/assets/dfx-asset-sources.json @@ -12,6 +12,18 @@ "rev": "ac7ff452684f84ea0cfc3fd0a27228220a368b33" } }, + "arm64-darwin": { + "motoko": { + "url": "https://github.com/dfinity/motoko/releases/download/0.14.12/motoko-Darwin-arm64-0.14.12.tar.gz", + "sha256": "48460d0952f870f1e69b69a6eb956cf02f822166f5ae8853546c3e37319849ce", + "version": "0.14.12" + }, + "pocket-ic": { + "url": "https://download.dfinity.systems/ic/ac7ff452684f84ea0cfc3fd0a27228220a368b33/binaries/arm64-darwin/pocket-ic-server-arm64-darwin", + "sha256": "f6cd133fee202ce57a6b4c8c88d648d3d42d4c2d10d9d3d0fe264f2012a691d9", + "rev": "ac7ff452684f84ea0cfc3fd0a27228220a368b33" + } + }, "x86_64-linux": { "motoko": { "url": "https://github.com/dfinity/motoko/releases/download/0.14.12/motoko-Linux-x86_64-0.14.12.tar.gz", diff --git a/src/dfx/assets/prepare_assets.rs b/src/dfx/assets/prepare_assets.rs index 0967f8f38d..ec4a82d7c4 100644 --- a/src/dfx/assets/prepare_assets.rs +++ b/src/dfx/assets/prepare_assets.rs @@ -184,23 +184,33 @@ async fn download_binaries( .unwrap_or_else(|| panic!("Cannot find source for {bin}")) .clone(); let client_ = client.clone(); - joinset.spawn(async move { (bin, download_and_check_sha(client_, source).await) }); + joinset.spawn(async move { + ( + bin, + source.clone(), + download_and_check_sha(client_, source).await, + ) + }); } let mut map = HashMap::new(); while let Some(res) = joinset.join_next().await { - let (bin, content) = res.unwrap(); - let decompressed = spawn_blocking(|| { - let mut buf = BytesMut::new(); - io::copy( - &mut GzDecoder::new(content.reader()), - &mut (&mut buf).writer(), - ) - .unwrap(); - buf.freeze() - }) - .await - .unwrap(); - map.insert(bin.into(), decompressed); + let (bin, source, content) = res.unwrap(); + let final_content = if source.url.ends_with(".gz") { + spawn_blocking(|| { + let mut buf = BytesMut::new(); + io::copy( + &mut GzDecoder::new(content.reader()), + &mut (&mut buf).writer(), + ) + .unwrap(); + buf.freeze() + }) + .await + .unwrap() + } else { + content + }; + map.insert(bin.into(), final_content); } map }