Skip to content

Commit 51f59df

Browse files
committed
Merge remote-tracking branch 'origin/master' into chore/migrate-asset-canister-to-static-site
2 parents 16e7c45 + cf1b1f8 commit 51f59df

66 files changed

Lines changed: 894 additions & 1090 deletions

Some content is hidden

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

.devcontainer/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ICP Examples (Motoko + Rust)",
3-
"image": "ghcr.io/dfinity/icp-dev-env-all:0.3.1",
3+
"image": "ghcr.io/dfinity/icp-dev-env-all:v1.2.0",
44
"forwardPorts": [8000, 5173],
55
"portsAttributes": {
66
"8000": {

.github/workflow-template.yml

Lines changed: 35 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
# Workflow template for ICP examples.
2-
# Copy this file to .github/workflows/<example_name>.yml and replace the placeholders.
2+
# Copy this file to .github/workflows/<example_name>.yml and replace <example_name>.
33
#
4-
# PLACEHOLDERS:
5-
# <example_name> e.g. hello_world
6-
# <language> motoko | rust
7-
# <image> ghcr.io/dfinity/icp-dev-env-motoko | ghcr.io/dfinity/icp-dev-env-rust
4+
# Examples run inside the ICP dev-env container via the reusable _run-example.yml
5+
# workflow, which is the single source of truth for the dev-env image version.
6+
#
7+
# This template shows a two-language example (Motoko + Rust). Adjust it:
8+
# - Single-language example: keep only the relevant job and its path entry.
9+
# - Frontend-only example: use one job with `language: all` and a
10+
# `hosting/<example_name>/**` path + `working-directory: hosting/<example_name>`.
11+
# - Integration tests needing PocketIC: add `install-pocketic: true` to the job
12+
# (and optionally `pocketic-version`).
13+
#
14+
# Keep one pull_request path entry per language directory the example ships, so a
15+
# change in any of them triggers this workflow.
816

917
name: <example_name>
1018

@@ -14,24 +22,32 @@ on:
1422
- master
1523
pull_request:
1624
paths:
17-
- <language>/<example_name>/**
25+
- motoko/<example_name>/**
26+
- rust/<example_name>/**
1827
- .github/workflows/<example_name>.yml
28+
- .github/workflows/_run-example.yml
1929

2030
concurrency:
2131
group: ${{ github.workflow }}-${{ github.ref }}
2232
cancel-in-progress: true
2333

2434
jobs:
25-
<language>-<example_name>:
26-
runs-on: ubuntu-24.04
27-
container: <image>
28-
env:
29-
ICP_CLI_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30-
steps:
31-
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
32-
- name: Deploy and test
33-
working-directory: <language>/<example_name>
34-
run: |
35-
icp network start -d
36-
icp deploy
37-
make test
35+
motoko-<example_name>:
36+
uses: ./.github/workflows/_run-example.yml
37+
with:
38+
language: motoko
39+
working-directory: motoko/<example_name>
40+
run: |
41+
icp network start -d
42+
icp deploy
43+
bash test.sh
44+
45+
rust-<example_name>:
46+
uses: ./.github/workflows/_run-example.yml
47+
with:
48+
language: rust
49+
working-directory: rust/<example_name>
50+
run: |
51+
icp network start -d
52+
icp deploy
53+
bash test.sh

.github/workflows/_run-example.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Reusable workflow that runs an example's CI steps inside the ICP dev-env container.
2+
#
3+
# This is the single source of truth for the dev-env image version used in CI.
4+
# It is kept in sync with .devcontainer/devcontainer.json by dev-env-version-check.yml.
5+
#
6+
# Callers provide the language (which selects the image variant), the working
7+
# directory, and the commands to run. Example:
8+
#
9+
# jobs:
10+
# motoko-hello_world:
11+
# uses: ./.github/workflows/_run-example.yml
12+
# with:
13+
# language: motoko
14+
# working-directory: motoko/hello_world
15+
# run: |
16+
# icp network start -d
17+
# icp deploy
18+
# bash test.sh
19+
#
20+
# Examples that need a PocketIC server for integration tests set
21+
# install-pocketic: true (optionally overriding pocketic-version).
22+
name: run-example
23+
24+
on:
25+
workflow_call:
26+
inputs:
27+
language:
28+
description: "Dev-env image variant to run in: motoko | rust | all"
29+
type: string
30+
required: true
31+
working-directory:
32+
description: "Path to the example directory to run the commands in"
33+
type: string
34+
required: true
35+
run:
36+
description: "Commands to execute inside the dev-env container"
37+
type: string
38+
default: |
39+
icp network start -d
40+
icp deploy
41+
install-pocketic:
42+
description: "Install the PocketIC server before running the commands"
43+
type: boolean
44+
default: false
45+
pocketic-version:
46+
description: "PocketIC server version to install when install-pocketic is true"
47+
type: string
48+
default: "15.0.0"
49+
50+
jobs:
51+
run:
52+
runs-on: ubuntu-24.04
53+
container: ghcr.io/dfinity/icp-dev-env-${{ inputs.language }}:v1.2.0
54+
env:
55+
ICP_CLI_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
56+
steps:
57+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
58+
- name: Install PocketIC server
59+
if: ${{ inputs.install-pocketic }}
60+
uses: dfinity/pocketic@a980c334fab1b21b0b8a6bba38e1a10836e7258b # main
61+
with:
62+
pocket-ic-server-version: ${{ inputs.pocketic-version }}
63+
- name: Run
64+
working-directory: ${{ inputs.working-directory }}
65+
run: ${{ inputs.run }}

.github/workflows/backend_only.yml

Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,36 +8,29 @@ on:
88
- motoko/backend_only/**
99
- rust/backend_only/**
1010
- .github/workflows/backend_only.yml
11+
- .github/workflows/_run-example.yml
1112

1213
concurrency:
1314
group: ${{ github.workflow }}-${{ github.ref }}
1415
cancel-in-progress: true
1516

1617
jobs:
1718
motoko-backend_only:
18-
runs-on: ubuntu-24.04
19-
container: ghcr.io/dfinity/icp-dev-env-motoko:1.0.1
20-
env:
21-
ICP_CLI_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
22-
steps:
23-
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
24-
- name: Deploy and test
25-
working-directory: motoko/backend_only
26-
run: |
27-
icp network start -d
28-
icp deploy
29-
bash test.sh
19+
uses: ./.github/workflows/_run-example.yml
20+
with:
21+
language: motoko
22+
working-directory: motoko/backend_only
23+
run: |
24+
icp network start -d
25+
icp deploy
26+
bash test.sh
3027
3128
rust-backend_only:
32-
runs-on: ubuntu-24.04
33-
container: ghcr.io/dfinity/icp-dev-env-rust:1.0.1
34-
env:
35-
ICP_CLI_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36-
steps:
37-
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
38-
- name: Deploy and test
39-
working-directory: rust/backend_only
40-
run: |
41-
icp network start -d
42-
icp deploy
43-
bash test.sh
29+
uses: ./.github/workflows/_run-example.yml
30+
with:
31+
language: rust
32+
working-directory: rust/backend_only
33+
run: |
34+
icp network start -d
35+
icp deploy
36+
bash test.sh

.github/workflows/backend_wasm64.yml

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,18 @@ on:
66
paths:
77
- rust/backend_wasm64/**
88
- .github/workflows/backend_wasm64.yml
9+
- .github/workflows/_run-example.yml
910
concurrency:
1011
group: ${{ github.workflow }}-${{ github.ref }}
1112
cancel-in-progress: true
13+
1214
jobs:
1315
rust-backend_wasm64:
14-
runs-on: ubuntu-24.04
15-
container: ghcr.io/dfinity/icp-dev-env-rust:1.0.1
16-
env:
17-
ICP_CLI_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
18-
steps:
19-
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
20-
- name: Deploy and test
21-
working-directory: rust/backend_wasm64
22-
run: |
23-
icp network start -d
24-
icp deploy
25-
bash test.sh
16+
uses: ./.github/workflows/_run-example.yml
17+
with:
18+
language: rust
19+
working-directory: rust/backend_wasm64
20+
run: |
21+
icp network start -d
22+
icp deploy
23+
bash test.sh

.github/workflows/basic_ethereum.yml

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,19 @@ on:
77
paths:
88
- rust/basic_ethereum/**
99
- .github/workflows/basic_ethereum.yml
10+
- .github/workflows/_run-example.yml
1011

1112
concurrency:
1213
group: ${{ github.workflow }}-${{ github.ref }}
1314
cancel-in-progress: true
1415

1516
jobs:
1617
rust-basic_ethereum:
17-
runs-on: ubuntu-24.04
18-
container: ghcr.io/dfinity/icp-dev-env-rust:1.0.1
19-
env:
20-
ICP_CLI_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21-
steps:
22-
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
23-
- name: Deploy and test
24-
working-directory: rust/basic_ethereum
25-
run: |
26-
icp network start -d
27-
icp deploy
28-
bash test.sh
18+
uses: ./.github/workflows/_run-example.yml
19+
with:
20+
language: rust
21+
working-directory: rust/basic_ethereum
22+
run: |
23+
icp network start -d
24+
icp deploy
25+
bash test.sh

.github/workflows/candid_type_generation.yml

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,19 @@ on:
88
paths:
99
- rust/candid_type_generation/**
1010
- .github/workflows/candid_type_generation.yml
11+
- .github/workflows/_run-example.yml
1112

1213
concurrency:
1314
group: ${{ github.workflow }}-${{ github.ref }}
1415
cancel-in-progress: true
1516

1617
jobs:
1718
rust-candid_type_generation:
18-
runs-on: ubuntu-24.04
19-
container: ghcr.io/dfinity/icp-dev-env-rust:1.0.1
20-
env:
21-
ICP_CLI_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
22-
steps:
23-
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
24-
- name: Deploy and test
25-
working-directory: rust/candid_type_generation
26-
run: |
27-
icp network start -d
28-
icp deploy
29-
bash test.sh
19+
uses: ./.github/workflows/_run-example.yml
20+
with:
21+
language: rust
22+
working-directory: rust/candid_type_generation
23+
run: |
24+
icp network start -d
25+
icp deploy
26+
bash test.sh

.github/workflows/canister-info.yml

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,19 @@ on:
77
paths:
88
- rust/canister-info/**
99
- .github/workflows/canister-info.yml
10+
- .github/workflows/_run-example.yml
1011

1112
concurrency:
1213
group: ${{ github.workflow }}-${{ github.ref }}
1314
cancel-in-progress: true
1415

1516
jobs:
1617
rust-canister-info:
17-
runs-on: ubuntu-24.04
18-
container: ghcr.io/dfinity/icp-dev-env-rust:1.0.1
19-
env:
20-
ICP_CLI_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21-
steps:
22-
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
23-
- name: Deploy and test
24-
working-directory: rust/canister-info
25-
run: |
26-
icp network start -d
27-
icp deploy
28-
bash test.sh
18+
uses: ./.github/workflows/_run-example.yml
19+
with:
20+
language: rust
21+
working-directory: rust/canister-info
22+
run: |
23+
icp network start -d
24+
icp deploy
25+
bash test.sh

.github/workflows/canister-snapshot-download.yml

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,19 @@ on:
77
paths:
88
- rust/canister-snapshot-download/**
99
- .github/workflows/canister-snapshot-download.yml
10+
- .github/workflows/_run-example.yml
1011

1112
concurrency:
1213
group: ${{ github.workflow }}-${{ github.ref }}
1314
cancel-in-progress: true
1415

1516
jobs:
1617
rust-canister-snapshot-download:
17-
runs-on: ubuntu-24.04
18-
container: ghcr.io/dfinity/icp-dev-env-rust:1.0.1
19-
env:
20-
ICP_CLI_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21-
steps:
22-
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
23-
- name: Deploy and test
24-
working-directory: rust/canister-snapshot-download
25-
run: |
26-
icp network start -d
27-
icp deploy
28-
bash test.sh
18+
uses: ./.github/workflows/_run-example.yml
19+
with:
20+
language: rust
21+
working-directory: rust/canister-snapshot-download
22+
run: |
23+
icp network start -d
24+
icp deploy
25+
bash test.sh

.github/workflows/canister-snapshots.yml

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,19 @@ on:
77
paths:
88
- rust/canister-snapshots/**
99
- .github/workflows/canister-snapshots.yml
10+
- .github/workflows/_run-example.yml
1011

1112
concurrency:
1213
group: ${{ github.workflow }}-${{ github.ref }}
1314
cancel-in-progress: true
1415

1516
jobs:
1617
rust-canister-snapshots:
17-
runs-on: ubuntu-24.04
18-
container: ghcr.io/dfinity/icp-dev-env-rust:1.0.1
19-
env:
20-
ICP_CLI_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21-
steps:
22-
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
23-
- name: Deploy and test
24-
working-directory: rust/canister-snapshots
25-
run: |
26-
icp network start -d
27-
icp deploy
28-
bash test.sh
18+
uses: ./.github/workflows/_run-example.yml
19+
with:
20+
language: rust
21+
working-directory: rust/canister-snapshots
22+
run: |
23+
icp network start -d
24+
icp deploy
25+
bash test.sh

0 commit comments

Comments
 (0)