Skip to content

Commit 0e1ac83

Browse files
feat: migrate @dfinity/* to @icp-sdk/core and icp-cli (#378) (#381)
Migrate the frontend library and backend infrastructure from deprecated @dfinity/* packages and dfx to @icp-sdk/core and icp-cli. Frontend library (frontend/ic_vetkeys): - Replace @dfinity/{agent,principal,candid,identity} with @icp-sdk/core - Regenerate declarations with @icp-sdk/bindgen@0.3.0 - Replace createActor wrappers with direct Actor.createActor calls - Update test host ports and add canister ID null guards - Reformat tsconfig, vite.config, eslint config Backend infrastructure: - Replace dfx.json with icp.yaml for all backend canisters - Update Makefiles for icp-cli compatible builds - Update test key from dfx_test_key to test_key_1 - Update CI workflows for icp-cli CI: - Update frontend.yml and backend-motoko.yml for icp-cli - Update provision scripts - Add .icp to .gitignore
1 parent d5aa2ee commit 0e1ac83

46 files changed

Lines changed: 954 additions & 494 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/backend-motoko-format-check.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ jobs:
2020
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
2121
with:
2222
persist-credentials: false
23+
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
24+
with:
25+
node-version: '22'
2326
- uses: ZenVoich/setup-mops@3e94e453352269b34137b5ce49f09a8df81bed7d # v1.4.1
2427
with:
2528
mops-version: 2

.github/workflows/backend-motoko.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,17 @@ jobs:
2424
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
2525
with:
2626
persist-credentials: false
27+
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
28+
with:
29+
node-version: '22'
2730
- uses: ZenVoich/setup-mops@3e94e453352269b34137b5ce49f09a8df81bed7d # v1.4.1
2831
with:
2932
mops-version: 2
3033
- name: Provision Linux
3134
run: bash .github/workflows/provision-linux.sh
3235
- name: Run MOPS Test Linux
36+
env:
37+
ICP_CLI_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3338
run: |
3439
set -eExuo pipefail
3540
cd backend/mo/ic_vetkeys
@@ -47,12 +52,17 @@ jobs:
4752
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
4853
with:
4954
persist-credentials: false
55+
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
56+
with:
57+
node-version: '22'
5058
- uses: ZenVoich/setup-mops@3e94e453352269b34137b5ce49f09a8df81bed7d # v1.4.1
5159
with:
5260
mops-version: 2
5361
- name: Provision Darwin
5462
run: bash .github/workflows/provision-darwin.sh
5563
- name: Run MOPS Test Darwin
64+
env:
65+
ICP_CLI_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5666
run: |
5767
set -eExuo pipefail
5868
cd backend/mo/ic_vetkeys

.github/workflows/frontend.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111
- backend/**/canisters/**
1212
- package.json
1313
- package-lock.json
14-
- .github/workflows/frontend_ic_vetkeys.yml
14+
- .github/workflows/frontend.yml
1515
- .github/workflows/provision-darwin.sh
1616
- .github/workflows/provision-linux.sh
1717
concurrency:
@@ -24,9 +24,14 @@ jobs:
2424
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
2525
with:
2626
persist-credentials: false
27+
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
28+
with:
29+
node-version: '22'
2730
- name: Provision Linux
2831
run: bash .github/workflows/provision-linux.sh
2932
- name: Frontend Tests and Lint
33+
env:
34+
ICP_CLI_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3035
run: |
3136
set -eExuo pipefail
3237
npm install
@@ -40,10 +45,15 @@ jobs:
4045
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
4146
with:
4247
persist-credentials: false
48+
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
49+
with:
50+
node-version: '22'
4351
- name: Provision Darwin
4452
run: |
4553
bash .github/workflows/provision-darwin.sh
4654
- name: Frontend Tests and Lint
55+
env:
56+
ICP_CLI_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4757
run: |
4858
set -eExuo pipefail
4959
npm install

.github/workflows/provision-darwin.sh

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,8 @@ set -ex
55
# Enter temporary directory.
66
pushd /tmp
77

8-
# Install Node.
9-
brew install nodejs
10-
11-
# Install DFINITY SDK.
12-
curl --location --output install-dfx.sh "https://raw.githubusercontent.com/dfinity/sdk/master/public/install-dfxvm.sh"
13-
DFX_VERSION=${DFX_VERSION:=0.26.1} DFXVM_INIT_YES=true bash install-dfx.sh
14-
rm install-dfx.sh
15-
echo "$HOME/Library/Application Support/org.dfinity.dfx/bin" >> $GITHUB_PATH
16-
source "$HOME/Library/Application Support/org.dfinity.dfx/env"
17-
dfx cache install
18-
19-
# check the current ic-commit found in the main branch, check if it differs from the one in this PR branch
20-
# if so, update the dfx cache with the latest ic artifacts
21-
if [ -f "${GITHUB_WORKSPACE}/.ic-commit" ]; then
22-
stable_sha=$(curl https://raw.githubusercontent.com/dfinity/examples/master/.ic-commit)
23-
current_sha=$(sed <"$GITHUB_WORKSPACE/.ic-commit" 's/#.*$//' | sed '/^$/d')
24-
arch="x86_64-darwin"
25-
if [ "$current_sha" != "$stable_sha" ]; then
26-
export current_sha
27-
export arch
28-
sh "$GITHUB_WORKSPACE/.github/workflows/update-dfx-cache.sh"
29-
fi
30-
fi
8+
# Install icp-cli (requires Node.js >=22, set up via actions/setup-node in the workflow).
9+
npm install -g @icp-sdk/icp-cli @icp-sdk/ic-wasm ic-mops
3110

3211
# Install rust
3312
curl --location --output install-rustup.sh "https://sh.rustup.rs"

.github/workflows/provision-linux.sh

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,12 @@ set -ex
55
# Enter temporary directory.
66
pushd /tmp
77

8-
# Install Node.
9-
sudo apt-get install nodejs
10-
11-
# Install DFINITY SDK.
12-
wget --output-document install-dfx.sh "https://raw.githubusercontent.com/dfinity/sdk/master/public/install-dfxvm.sh"
13-
DFX_VERSION=${DFX_VERSION:=0.26.1} DFXVM_INIT_YES=true bash install-dfx.sh
14-
rm install-dfx.sh
15-
echo "$HOME/.local/share/dfx/bin" >>$GITHUB_PATH
16-
source "$HOME/.local/share/dfx/env"
17-
dfx cache install
18-
# check the current ic-commit found in the main branch, check if it differs from the one in this PR branch
19-
# if so, update the dfx cache with the latest ic artifacts
20-
if [ -f "${GITHUB_WORKSPACE}/.ic-commit" ]; then
21-
stable_sha=$(curl https://raw.githubusercontent.com/dfinity/examples/master/.ic-commit)
22-
current_sha=$(sed <"$GITHUB_WORKSPACE/.ic-commit" 's/#.*$//' | sed '/^$/d')
23-
arch="x86_64-linux"
24-
if [ "$current_sha" != "$stable_sha" ]; then
25-
export current_sha
26-
export arch
27-
sh "$GITHUB_WORKSPACE/.github/workflows/update-dfx-cache.sh"
28-
fi
29-
fi
8+
# Install icp-cli (requires Node.js >=22, set up via actions/setup-node in the workflow).
9+
npm install -g @icp-sdk/icp-cli @icp-sdk/ic-wasm ic-mops
3010

3111
# Install rust
3212
wget --output-document install-rustup.sh "https://sh.rustup.rs"
33-
sudo bash install-rustup.sh -y
13+
bash install-rustup.sh -y
3414
rustup target add wasm32-unknown-unknown
3515

3616
# Set environment variables.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ target/
1717
.idea/
1818

1919
**/.dfx/*
20+
**/.icp/cache
2021
**/deps/*
2122
backend/**/declarations
2223
examples/**/declarations

backend/mo/canisters/ic_vetkeys_encrypted_maps_canister/dfx.json

Lines changed: 0 additions & 14 deletions
This file was deleted.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
canisters:
2+
- name: ic_vetkeys_encrypted_maps_canister
3+
recipe:
4+
type: "@dfinity/motoko@v4.1.0"
5+
configuration:
6+
main: src/Main.mo

backend/mo/canisters/ic_vetkeys_manager_canister/dfx.json

Lines changed: 0 additions & 14 deletions
This file was deleted.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
canisters:
2+
- name: ic_vetkeys_manager_canister
3+
recipe:
4+
type: "@dfinity/motoko@v4.1.0"
5+
configuration:
6+
main: src/Main.mo

0 commit comments

Comments
 (0)