Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add image classification tests #915

Merged
merged 1 commit into from
Jun 20, 2024
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
10 changes: 10 additions & 0 deletions .github/workflows/provision-darwin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,15 @@ tar -xf "wasmtime-v${wasmtime_version}-x86_64-macos.tar.xz" --directory "${HOME}
mv "${HOME}/bin/wasmtime-v${wasmtime_version}-x86_64-macos/wasmtime" "${HOME}/bin/wasmtime"
rm "wasmtime-v${wasmtime_version}-x86_64-macos.tar.xz"

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

# Install wasm-opt
version=117
curl -fsSLO "https://github.com/WebAssembly/binaryen/releases/download/version_117/binaryen-version_${version}-x86_64-macos.tar.gz"
tar -xzf "binaryen-version_${version}-x86_64-macos.tar.gz" --directory "${HOME}/" --strip-components 1
rm "binaryen-version_${version}-x86_64-macos.tar.gz"

# Exit temporary directory.
popd
10 changes: 10 additions & 0 deletions .github/workflows/provision-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,16 @@ 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}"

# Install wasm-opt
version=117
curl -fsSLO "https://github.com/WebAssembly/binaryen/releases/download/version_117/binaryen-version_${version}-x86_64-linux.tar.gz"
tar -xzf "binaryen-version_${version}-x86_64-linux.tar.gz" --directory "${HOME}/" --strip-components 1
rm "binaryen-version_${version}-x86_64-linux.tar.gz"

# Set environment variables.
echo "$HOME/bin" >> $GITHUB_PATH
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
Expand Down
44 changes: 44 additions & 0 deletions .github/workflows/rust-image-classification-example.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
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:
rust-image-classification-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"]
2 changes: 2 additions & 0 deletions rust/image-classification/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ _MACOSX
target/
*.old.did
.idea
src/backend/assets/mobilenetv2-7.onnx
.env
Loading
Loading