Skip to content

Commit

Permalink
Add image classification tests
Browse files Browse the repository at this point in the history
  • Loading branch information
berestovskyy committed Jun 19, 2024
1 parent 92c2e52 commit f2052cc
Show file tree
Hide file tree
Showing 19 changed files with 365 additions and 183 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/provision-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ tar -xf "wasmtime-v${wasmtime_version}-x86_64-linux.tar.xz" --directory "${HOME}
mv "${HOME}/bin/wasmtime-v${wasmtime_version}-x86_64-linux/wasmtime" "${HOME}/bin/wasmtime"
rm "wasmtime-v${wasmtime_version}-x86_64-linux.tar.xz"

# Install wasi2ic
git clone https://github.com/wasm-forge/wasi2ic
cargo install --path wasi2ic --root "${HOME}"

# Set environment variables.
echo "$HOME/bin" >> $GITHUB_PATH
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
Expand Down
45 changes: 45 additions & 0 deletions .github/workflows/rust-image-classification-example.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: rust-image-classification
on:
push:
branches:
- master
pull_request:
paths:
- rust/image-classification/**
- .github/workflows/provision-darwin.sh
- .github/workflows/provision-linux.sh
- .github/workflows/rust-image-classification-example.yaml
- .ic-commit
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
# There is no `wasi2ic` Darwin binary at the moment
# rust-simd-example-darwin:
# runs-on: macos-12
# steps:
# - uses: actions/checkout@v1
# - name: Provision Darwin
# run: DFX_VERSION="0.20.2-beta.0" bash .github/workflows/provision-darwin.sh
# - name: Remove networks.json
# run: rm -f ~/.config/dfx/networks.json
# - name: Rust Image Classification Darwin
# run: |
# dfx start --background
# pushd rust/image-classification
# make test
# popd
rust-image-classification-example-linux:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v1
- name: Provision Linux
run: DFX_VERSION="0.20.2-beta.0" bash .github/workflows/provision-linux.sh
- name: Remove networks.json
run: rm -f ~/.config/dfx/networks.json
- name: Rust Image Classification Linux
run: |
dfx start --background
pushd rust/image-classification
make test
popd
5 changes: 5 additions & 0 deletions rust/image-classification/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[build]
target = ["wasm32-wasi"]

[target.wasm32-wasi]
rustflags = ["-Ctarget-feature=+simd128"]
10 changes: 10 additions & 0 deletions rust/image-classification/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

# DFX CANISTER ENVIRONMENT VARIABLES
DFX_VERSION='0.20.2-beta.0'
DFX_NETWORK='local'
CANISTER_CANDID_PATH_BACKEND='/Users/a/tmp/examples/rust/image-classification/src/backend/backend.did'
CANISTER_ID_FRONTEND='bd3sg-teaaa-aaaaa-qaaba-cai'
CANISTER_ID_BACKEND='bkyz2-fmaaa-aaaaa-qaaaq-cai'
CANISTER_ID='bd3sg-teaaa-aaaaa-qaaba-cai'
CANISTER_CANDID_PATH='/Users/a/tmp/examples/rust/image-classification/.dfx/local/canisters/frontend/assetstorage.did'
# END DFX CANISTER ENVIRONMENT VARIABLES
1 change: 1 addition & 0 deletions rust/image-classification/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ _MACOSX
target/
*.old.did
.idea
src/backend/assets/mobilenetv2-7.onnx
Loading

0 comments on commit f2052cc

Please sign in to comment.