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: Continuous integration | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} | |
cancel-in-progress: true | |
on: | |
push: | |
paths-ignore: | |
- ".github/workflows/release.yml" | |
- "**/*.md" | |
- "install_zh.sh" | |
pull_request: | |
paths-ignore: | |
- ".github/workflows/release.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: Checkout WasmEdge Runtime | |
uses: actions/checkout@v3 | |
with: | |
repository: WasmEdge/WasmEdge | |
path: WasmEdge | |
- name: Build WasmEdge with Release mode | |
working-directory: WasmEdge | |
run: | | |
apt update | |
apt install -y software-properties-common libboost-all-dev llvm-15-dev liblld-15-dev ninja-build curl wget unzip | |
# deploy libtorch | |
export PYTORCH_VERSION="1.8.2" | |
curl -s -L -O --remote-name-all https://download.pytorch.org/libtorch/lts/1.8/cpu/libtorch-cxx11-abi-shared-with-deps-${PYTORCH_VERSION}%2Bcpu.zip | |
unzip -q "libtorch-cxx11-abi-shared-with-deps-${PYTORCH_VERSION}%2Bcpu.zip" | |
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$(pwd)/libtorch/lib | |
export Torch_DIR=$(pwd)/libtorch | |
# build and deploy wasmedge | |
cmake -Bbuild -GNinja -DCMAKE_BUILD_TYPE=Release -DWASMEDGE_PLUGIN_PROCESS=On -DWASMEDGE_PLUGIN_WASI_NN_BACKEND="PyTorch" . | |
cmake --build build | |
cmake --install build | |
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)/../WasmEdge/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 |