Skip to content

Commit c1d8773

Browse files
Merge pull request #1112 from dfinity/add_new
chore: Add example of usage of low_wasm_memory_hook
2 parents c5cf5a6 + 3a11aa6 commit c1d8773

File tree

10 files changed

+1001
-0
lines changed

10 files changed

+1001
-0
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
/rust/icp_transfer/ @dfinity/growth
6161
/rust/image-classification/ @dfinity/execution
6262
/rust/inter-canister-calls/ @dfinity/ic-message-routing-owners
63+
/rust/low_wasm_memory/ @dfinity/execution
6364
/rust/nft-wallet/ @dfinity/growth
6465
/rust/parallel_calls/ @dfinity/research
6566
/rust/performance_counters/ @dfinity/execution
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: rust-low_wasm_memory
2+
on:
3+
push:
4+
branches:
5+
- master
6+
pull_request:
7+
paths:
8+
- rust/low_wasm_memory/**
9+
- .github/workflows/provision-darwin.sh
10+
- .github/workflows/provision-linux.sh
11+
- .github/workflows/rust-low_wasm_memory-example.yml
12+
- .github/workflows/rust-low_wasm_memory-skip.yml
13+
- .ic-commit
14+
concurrency:
15+
group: ${{ github.workflow }}-${{ github.ref }}
16+
cancel-in-progress: true
17+
jobs:
18+
rust-low_wasm_memory-darwin:
19+
runs-on: macos-15
20+
steps:
21+
- uses: actions/checkout@v1
22+
- name: Provision Darwin
23+
run: bash .github/workflows/provision-darwin.sh
24+
- name: Rust low_wasm_memory Darwin
25+
run: |
26+
pushd rust/low_wasm_memory
27+
dfx start --background
28+
dfx deploy low_wasm_memory_hook
29+
dfx canister update-settings low_wasm_memory_hook --wasm-memory-limit 3000000 --wasm-memory-threshold 2000000
30+
dfx canister status low_wasm_memory_hook
31+
dfx canister call low_wasm_memory_hook --query get_executed_functions_order | grep -q 'OnLowWasmMemory' || while ! dfx canister call low_wasm_memory_hook --query get_executed_functions_order | grep -q 'OnLowWasmMemory'; do
32+
sleep 1
33+
done
34+
popd
35+
rust-low_wasm_memory-linux:
36+
runs-on: ubuntu-22.04
37+
steps:
38+
- uses: actions/checkout@v1
39+
- name: Provision Linux
40+
run: bash .github/workflows/provision-linux.sh
41+
- name: Rust low_wasm_memory Linux
42+
run: |
43+
pushd rust/low_wasm_memory
44+
dfx start --background
45+
dfx deploy low_wasm_memory_hook
46+
dfx canister update-settings low_wasm_memory_hook --wasm-memory-limit 3000000 --wasm-memory-threshold 2000000
47+
dfx canister status low_wasm_memory_hook
48+
dfx canister call low_wasm_memory_hook --query get_executed_functions_order | grep -q 'OnLowWasmMemory' || while ! dfx canister call low_wasm_memory_hook --query get_executed_functions_order | grep -q 'OnLowWasmMemory'; do
49+
sleep 1
50+
done
51+
popd

rust/low_wasm_memory/.gitignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Various IDEs and Editors
2+
.vscode/
3+
.idea/
4+
**/*~
5+
6+
# Mac OSX temporary files
7+
.DS_Store
8+
**/.DS_Store
9+
10+
# dfx temporary files
11+
.dfx/
12+
13+
# generated files
14+
src/declarations/
15+
16+
# rust
17+
target/
18+
19+
# frontend code
20+
node_modules/
21+
dist/
22+
23+
# environment variables
24+
.env

0 commit comments

Comments
 (0)