CI: Update run-wasm-app-from-host & set-env-vars-via-wasi #94
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release for RustSDK | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} | |
cancel-in-progress: true | |
on: | |
push: | |
paths-ignore: | |
- ".github/workflows/latest.yml" | |
- "**/*.md" | |
- "install_zh.sh" | |
pull_request: | |
paths-ignore: | |
- ".github/workflows/latest.yml" | |
- "**/*.md" | |
- "install_zh.sh" | |
jobs: | |
build_ubuntu: | |
name: Ubuntu | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-22.04, ubuntu-20.04] | |
rust: [1.78, 1.77, 1.76] | |
container: | |
image: wasmedge/wasmedge:ubuntu-build-clang | |
steps: | |
- name: Checkout WasmEdge RustSDK Examples | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Install PyTorch | |
env: | |
PYTORCH_VERSION: "1.8.2" | |
PYTORCH_ABI: "libtorch-cxx11-abi" | |
run: | | |
apt update | |
apt install -y curl wget unzip | |
curl -s -L -O --remote-name-all https://download.pytorch.org/libtorch/lts/1.8/cpu/${PYTORCH_ABI}-shared-with-deps-${PYTORCH_VERSION}%2Bcpu.zip | |
unzip -q "${PYTORCH_ABI}-shared-with-deps-${PYTORCH_VERSION}%2Bcpu.zip" | |
ls -al | |
- name: Install WasmEdge with Wasi-NN PyTorch plugin | |
env: | |
CMAKE_BUILD_TYPE: "Release" | |
VERSION: "0.14.0" | |
run: | | |
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$(pwd)/libtorch/lib | |
curl -sSf https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install.sh | bash -s -- -v $VERSION -p /usr/local --plugins wasi_nn-pytorch | |
ldconfig | |
- name: Install Rust-stable | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: ${{ matrix.rust }} | |
targets: wasm32-wasi | |
- name: async-wasi | |
working-directory: async-wasi | |
run: | | |
cargo build -p wasm-app --target wasm32-wasi --release | |
cargo run -p run-wasm-app -- ../target/wasm32-wasi/release/wasm-app.wasm | |
- name: async-wasi-socket | |
working-directory: async-wasi-socket-addr | |
run: | | |
cargo build -p socket-addr --target wasm32-wasi --release | |
cargo run -p main-app -- ../target/wasm32-wasi/release/socket-addr.wasm | |
- name: call-wasm-lib-from-host example | |
working-directory: call-wasm-lib-from-host | |
run: | | |
cargo build -p wasm-lib --target wasm32-wasi --release | |
cargo run -p call-wasm-lib -- ../target/wasm32-wasi/release/wasm_lib.wasm 5 | |
- name: call-wasm-lib-with-external-deps | |
working-directory: call-wasm-lib-with-external-deps | |
run: | | |
cargo build -p call-host --target wasm32-wasi --release | |
cargo run -p host-app -- ../target/wasm32-wasi/release/call_host.wasm 2 3 | |
- name: define-async-host-func | |
working-directory: define-async-host-func | |
run: | | |
cargo run | |
- name: define-host-func | |
working-directory: define-host-func | |
run: | | |
cargo run | |
- name: load-module-in-module | |
working-directory: load-module-in-module | |
run: | | |
cargo build -p alice-wasm-lib --target wasm32-wasi --release | |
cargo build -p bob-wasm-lib --target wasm32-wasi --release | |
cargo run -p multi-module-host-app -- 2 3 | |
- name: manipulate-linear-memory | |
working-directory: manipulate-linear-memory | |
run: | | |
cargo run | |
- name: multi-threaded-parallel | |
if: false | |
working-directory: multi-threaded-parallel | |
run: | | |
cd mandelbrot-c | |
wget https://ziglang.org/download/0.10.1/zig-linux-x86_64-0.10.1.tar.xz | |
tar -xf zig-linux-x86_64-0.10.1.tar.xz | |
./zig-linux-x86_64-0.10.1/zig build-obj -O ReleaseSmall -target wasm32-wasi mandelbrot.c | |
wasm-ld-15 --no-entry mandelbrot.o -o mandelbrot.wasm --import-memory --export-all --shared-memory --features=mutable-globals,atomics,bulk-memory | |
cd .. | |
cargo run -p run-mandelbrot-in-parallel -- ./mandelbrot-c/mandelbrot.wasm | |
- name: object-detection-via-wasinn | |
working-directory: object-detection-via-wasinn | |
run: | | |
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$(pwd)/../libtorch/lib | |
export Torch_DIR=$(pwd)/../WasmEdge/libtorch | |
cargo run -- .:. wasmedge-wasinn-example-mobilenet-image.wasm mobilenet.pt input.jpg | |
- name: run-wasm-app-from-host | |
working-directory: run-wasm-app-from-host | |
run: | | |
cargo build -p sync-wasm-app --target wasm32-wasi --release | |
cargo run -p sync-run-wasm-app -- ../target/wasm32-wasi/release/sync-wasm-app.wasm | |
- name: run-wasm-func-in-aot-mode | |
working-directory: run-wasm-func-in-aot-mode | |
run: | | |
cargo run | |
- name: say_hello | |
working-directory: say_hello | |
run: | | |
cargo run | |
- name: set-env-vars-via-wasi | |
working-directory: set-env-vars-via-wasi | |
run: | | |
cargo build -p print-env-vars --target wasm32-wasi --release | |
cargo run -p set-env-vars-via-wasi -- ../target/wasm32-wasi/release/print_env_vars.wasm | |
- name: wasmedge-bindgen | |
if: false | |
working-directory: wasmedge-bindgen | |
run: | | |
cargo build -p wasm-lib --target wasm32-wasi --release | |
cargo run -p call-wasm-lib -- ./target/wasm32-wasi/release/wasm_lib.wasm 5 |