Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/backend_wasm64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: backend_wasm64
on:
push:
branches: [master]
pull_request:
paths:
- rust/backend_wasm64/**
- .github/workflows/backend_wasm64.yml
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
rust-backend_wasm64:
runs-on: ubuntu-24.04
container: ghcr.io/dfinity/icp-dev-env-rust:1.0.1
env:
ICP_CLI_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Deploy and test
working-directory: rust/backend_wasm64
run: |
icp network start -d
icp deploy
bash test.sh
20 changes: 0 additions & 20 deletions rust/backend_wasm64/.devcontainer/devcontainer.json

This file was deleted.

26 changes: 0 additions & 26 deletions rust/backend_wasm64/BUILD.md

This file was deleted.

23 changes: 13 additions & 10 deletions rust/backend_wasm64/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,17 @@ The Wasm64 target allows canisters to:

This example uses the `build.sh` script to build for Wasm64 using Rust's nightly toolchain and the `-Z build-std` feature.

## Deploying from ICP Ninja

This example can be deployed directly from [ICP Ninja](https://icp.ninja), a browser-based IDE for ICP. To continue developing locally after deploying from ICP Ninja, see [BUILD.md](BUILD.md).

<!--
[![Open in ICP Ninja](https://icp.ninja/assets/open.svg)](https://icp.ninja/i?g=https://github.com/dfinity/examples/rust/backend_wasm64)

> **Note:** ICP Ninja currently uses `dfx` under the hood, which is why this example includes a `dfx.json` configuration file. `dfx` is the legacy CLI, being superseded by [icp-cli](https://cli.icp.build), which is what developers should use for local development.
-->

## Build and deploy from the command line

### Prerequisites

- [x] Install [Node.js](https://nodejs.org/en/download/)
- [x] Install [icp-cli](https://cli.icp.build): `npm install -g @icp-sdk/icp-cli @icp-sdk/ic-wasm`
- [Node.js](https://nodejs.org/) v18+
- [icp-cli](https://cli.internetcomputer.org/): `npm install -g @icp-sdk/icp-cli @icp-sdk/ic-wasm`
- [Rust](https://www.rust-lang.org/tools/install) with nightly toolchain (installed automatically by `build.sh`)

### Install

Expand All @@ -41,7 +38,7 @@ git clone https://github.com/dfinity/examples
cd examples/rust/backend_wasm64
```

### Deployment
### Deploy and test

Start the local network:

Expand All @@ -55,6 +52,12 @@ Deploy the canister:
icp deploy
```

Run the tests:

```bash
bash test.sh
```

Stop the local network when done:

```bash
Expand All @@ -63,4 +66,4 @@ icp network stop

## Security considerations and best practices

If you base your application on this example, it is recommended that you familiarize yourself with and adhere to the [security best practices](https://internetcomputer.org/docs/building-apps/security/overview) for developing on ICP. This example may not implement all the best practices.
If you base your application on this example, it is recommended that you familiarize yourself with and adhere to the [security best practices](https://docs.internetcomputer.org/guides/security/overview) for developing on ICP. This example may not implement all the best practices.
8 changes: 3 additions & 5 deletions rust/backend_wasm64/backend/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
[package]
name = "backend"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
edition = "2024"

[lib]
crate-type = ["cdylib"]
path = "lib.rs"

[dependencies]
candid = "0.10.10"
ic-cdk = "0.18.0"
candid = "0.10"
ic-cdk = "0.20"
19 changes: 0 additions & 19 deletions rust/backend_wasm64/dfx.json

This file was deleted.

7 changes: 7 additions & 0 deletions rust/backend_wasm64/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash
set -e

echo "=== Test 1: greet returns expected greeting ==="
result=$(icp canister call --query backend greet '("World")')
echo "$result"
echo "$result" | grep -q "Hello, World!" && echo "PASS" || (echo "FAIL" && exit 1)
Loading