Skip to content

Commit d02e30a

Browse files
feat: Add dfx binaries for aarch64-darwin. (#4277)
* Update replica to e6f1348a5f3efc2d3828503d3268ab2a1f33e886. * Add 'aarch64-darwin' support in 'build.rs'. * Update the 'update-replica.sh' script. * Update the 'update-motoko.sh' script. * Add macos-14 to run tests on Arm64. * Use macos-13-xlarge to use macos-13 for consistency. * Update publish.yml file. * Update the arm64-Darwin hashes. * Remove debug line. * Update changelog.
1 parent b25437a commit d02e30a

File tree

12 files changed

+70
-26
lines changed

12 files changed

+70
-26
lines changed

.github/workflows/e2e.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,14 @@ jobs:
5555
matrix:
5656
# We build a dynamic-linked linux binary because otherwise HSM support fails with:
5757
# Error: IO: Dynamic loading not supported
58-
os: [macos-13, ubuntu-22.04, ubuntu-24.04, windows-2022]
58+
os: [macos-13, macos-13-xlarge, ubuntu-22.04, ubuntu-24.04, windows-2022]
5959
include:
6060
- os: macos-13
6161
target: x86_64-apple-darwin
6262
binary_path: target/x86_64-apple-darwin/release/dfx
63+
- os: macos-13-xlarge
64+
target: aarch64-apple-darwin
65+
binary_path: target/aarch64-apple-darwin/release/dfx
6366
- os: ubuntu-22.04
6467
target: x86_64-unknown-linux-gnu
6568
binary_path: target/x86_64-unknown-linux-gnu/release/dfx
@@ -111,7 +114,7 @@ jobs:
111114
strategy:
112115
fail-fast: false
113116
matrix:
114-
os: [macos-13, ubuntu-22.04, ubuntu-24.04]
117+
os: [macos-13, macos-13-xlarge, ubuntu-22.04, ubuntu-24.04]
115118
steps:
116119
- uses: actions/checkout@v4
117120
- name: Download dfx binary
@@ -181,7 +184,7 @@ jobs:
181184
strategy:
182185
fail-fast: false
183186
matrix:
184-
os: [macos-13, ubuntu-22.04, ubuntu-24.04]
187+
os: [macos-13, macos-13-xlarge, ubuntu-22.04, ubuntu-24.04]
185188
steps:
186189
- name: Checking out repo
187190
uses: actions/checkout@v4

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
strategy:
4444
fail-fast: false
4545
matrix:
46-
os: [ ubuntu-latest, macos-13-large, windows-latest ]
46+
os: [ ubuntu-latest, macos-13-large, macos-13-xlarge, windows-latest ]
4747

4848
steps:
4949
- uses: actions/checkout@v4

.github/workflows/prepare-dfx-assets.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
strategy:
2727
fail-fast: false
2828
matrix:
29-
os: [ ubuntu-latest, macos-13-large ]
29+
os: [ ubuntu-latest, macos-13-large, macos-13-xlarge ]
3030
steps:
3131
- uses: actions/checkout@v4
3232
- uses: actions/cache@v4

.github/workflows/publish.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,18 @@ jobs:
3131
matrix:
3232
# We build a dynamic-linked linux binary because otherwise HSM support fails with:
3333
# Error: IO: Dynamic loading not supported
34-
target: [ x86_64-apple-darwin, x86_64-unknown-linux-gnu ]
34+
target: [ x86_64-apple-darwin, aarch64-apple-darwin, x86_64-unknown-linux-gnu ]
3535
include:
3636
- os: macos-13-large
3737
target: x86_64-apple-darwin
3838
binary_path: target/x86_64-apple-darwin/release
3939
name: x86_64-darwin
4040
tar: gtar
41+
- os: macos-13-xlarge
42+
target: aarch64-apple-darwin
43+
binary_path: target/aarch64-apple-darwin/release
44+
name: aarch64-darwin
45+
tar: gtar
4146
- os: ubuntu-22.04
4247
target: x86_64-unknown-linux-gnu
4348
binary_path: target/x86_64-unknown-linux-gnu/release
@@ -146,7 +151,7 @@ jobs:
146151
strategy:
147152
fail-fast: false
148153
matrix:
149-
name: [ 'x86_64-darwin', 'x86_64-linux' ]
154+
name: [ 'x86_64-darwin', 'aarch64-darwin', 'x86_64-linux' ]
150155
steps:
151156
- uses: actions/checkout@v4
152157

.github/workflows/unit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
strategy:
4646
fail-fast: false
4747
matrix:
48-
os: [ ubuntu-latest, macos-13-large ]
48+
os: [ ubuntu-latest, macos-13-large, macos-13-xlarge ]
4949
steps:
5050
- uses: actions/checkout@v4
5151
- uses: actions/cache@v4

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ You can get the fees by `get_config` API on the [BTC Mainnet Canister](https://d
3636
If you were using the contents of the `pocket-ic-proxy-port` file to determine the port for
3737
the `/http_gateway` endpoint, you should instead use `dfx info pocketic-config-port`
3838

39+
### feat: add dfx native support for aarch64-Darwin
40+
41+
Add dfx native support for aarch64-Darwin.
42+
3943
## Dependencies
4044

4145
### Replica

scripts/update-motoko.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ motoko_base_sha=$(curl --proto '=https' --tlsv1.2 -sSfL "$motoko_base_url" | sha
2929
jq '.common."motoko-base" = {url: $url, sha256: $sha256, version: $version}' --arg version "$version" \
3030
--arg url "$motoko_base_url" --arg sha256 "$motoko_base_sha" "$sources" | sponge "$sources"
3131

32-
declare -A variants=([x86_64-darwin]=Darwin-x86_64 [x86_64-linux]=Linux-x86_64)
32+
declare -A variants=([x86_64-darwin]=Darwin-x86_64 [x86_64-linux]=Linux-x86_64 [arm64-darwin]=Darwin-arm64)
3333
for platform in "${!variants[@]}"; do
3434
motoko_url=$(printf 'https://github.com/dfinity/motoko/releases/download/%s/motoko-%s-%s.tar.gz' \
3535
"$(urlencode "$version")" "$(urlencode "${variants[$platform]}")" "$(urlencode "$version")")

scripts/update-replica.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,10 @@ sources="src/dfx/assets/dfx-asset-sources.json"
2121
rev=$1
2222
echo "Updating sources to rev ${rev}"
2323
jq '."replica-rev" = $rev' --arg rev "$rev" "$sources" | sponge "$sources"
24-
for platform in x86_64-darwin x86_64-linux; do
25-
pocketic_url=$(printf 'https://download.dfinity.systems/ic/%s/binaries/%s/pocket-ic.gz' "$rev" "$platform")
24+
25+
declare -A variants=([x86_64-darwin]=pocket-ic.gz [x86_64-linux]=pocket-ic.gz [arm64-darwin]=pocket-ic-server-arm64-darwin)
26+
for platform in "${!variants[@]}"; do
27+
pocketic_url=$(printf 'https://download.dfinity.systems/ic/%s/binaries/%s/%s' "$rev" "$platform" "${variants[$platform]}")
2628
pocketic_sha=$(curl --proto '=https' --tlsv1.2 -sSfL "$pocketic_url" | sha256sum | head -c 64)
2729
jq '.[$platform]."pocket-ic" = {url: $url, sha256: $sha256, rev: $rev}' --arg platform "$platform" --arg rev "$rev" \
2830
--arg url "$pocketic_url" --arg sha256 "$pocketic_sha" "$sources" | sponge "$sources"

scripts/workflows/e2e-matrix.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ def test_scripts(prefix):
3838
"os": "macos-13",
3939
"serial": serial,
4040
})
41+
include.append({
42+
"test": test,
43+
"os": "macos-13-xlarge",
44+
"serial": serial,
45+
})
4146

4247
matrix = {
4348
"include": include,

src/dfx/assets/build.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ struct Sources {
6464
x86_64_linux: HashMap<String, Source>,
6565
#[serde(rename = "x86_64-darwin")]
6666
x86_64_darwin: HashMap<String, Source>,
67+
#[serde(rename = "arm64-darwin")]
68+
aarch64_darwin: HashMap<String, Source>,
6769
common: HashMap<String, Source>,
6870
#[serde(rename = "replica-rev")]
6971
replica_rev: String,
@@ -99,7 +101,8 @@ fn find_assets(sources: Sources) -> PathBuf {
99101
&*env::var("CARGO_CFG_TARGET_ARCH").unwrap(),
100102
&*env::var("CARGO_CFG_TARGET_OS").unwrap(),
101103
) {
102-
("x86_64" | "aarch64", "macos") => sources.x86_64_darwin, // rosetta
104+
("x86_64", "macos") => sources.x86_64_darwin, // rosetta
105+
("aarch64", "macos") => sources.aarch64_darwin, // aarch64
103106
("x86_64", "linux" | "windows") => sources.x86_64_linux,
104107
(arch, os) => panic!("Unsupported OS type {arch}-{os}"),
105108
};

0 commit comments

Comments
 (0)