Skip to content

Chore/update dependencies #88

Chore/update dependencies

Chore/update dependencies #88

Workflow file for this run

name: examples
on:
workflow_dispatch:
inputs:
logLevel:
description: 'Log level'
required: true
default: 'info'
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Install apt-get packages
run: |
echo RESET grub-efi/install_devices | sudo debconf-communicate grub-pc
sudo ACCEPT_EULA=Y apt-get update
sudo ACCEPT_EULA=Y apt-get upgrade
sudo apt-get install wget git curl software-properties-common build-essential
- name: Install Rust target for wasm
run: |
rustup target add wasm32-wasi
- name: Install WasmEdge
run: |
VERSION=0.13.5
TFVERSION=2.12.0
curl -s -L -O --remote-name-all https://github.com/second-state/WasmEdge-tensorflow-deps/releases/download/TF-2.12.0-CC/WasmEdge-tensorflow-deps-TFLite-TF-$TFVERSION-CC-manylinux2014_x86_64.tar.gz
tar -zxf WasmEdge-tensorflow-deps-TFLite-TF-$TFVERSION-CC-manylinux2014_x86_64.tar.gz
rm -f WasmEdge-tensorflow-deps-TFLite-TF-$TFVERSION-CC-manylinux2014_x86_64.tar.gz
sudo mv libtensorflowlite_c.so /usr/local/lib
sudo mv libtensorflowlite_flex.so /usr/local/lib
curl -sSf https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install.sh | sudo bash -s -- -v $VERSION --plugins wasi_nn-tensorflowlite -p /usr/local
wget https://github.com/WasmEdge/WasmEdge/releases/download/0.13.4/WasmEdge-plugin-wasmedge_rustls-0.13.4-ubuntu20.04_x86_64.tar.gz
tar -zxf WasmEdge-plugin-wasmedge_rustls-0.13.4-ubuntu20.04_x86_64.tar.gz
sudo mv libwasmedge_rustls.so /usr/local/lib/wasmedge
- name: Client https example
run: |
cd client-https
cargo build --target wasm32-wasi --release
wasmedgec target/wasm32-wasi/release/wasmedge_hyper_client_https.wasm wasmedge_hyper_client_https.wasm
resp=$(wasmedge wasmedge_hyper_client_https.wasm)
echo "$resp"
if [[ $resp == *"WasmEdge"* ]]; then
echo -e "Execution Success!"
else
echo -e "Execution Fail!"
exit 1
fi
- name: Server example
run: |
cd server
cargo build --target wasm32-wasi --release
wasmedgec target/wasm32-wasi/release/wasmedge_hyper_server.wasm wasmedge_hyper_server.wasm
nohup wasmedge wasmedge_hyper_server.wasm &
echo $! > wasmedge.pid
sleep 15
resp=$(curl http://localhost:8080/echo -X POST -d "WasmEdge")
echo "$resp"
kill -9 `cat wasmedge.pid`
rm wasmedge.pid
if [[ $resp == *"WasmEdge"* ]]; then
echo -e "Execution Success!"
else
echo -e "Execution Fail!"
exit 1
fi
- name: Warp example
run: |
cd server-warp
cargo build --target wasm32-wasi --release
wasmedgec target/wasm32-wasi/release/wasmedge_warp_server.wasm wasmedge_warp_server.wasm
nohup wasmedge wasmedge_warp_server.wasm &
echo $! > wasmedge.pid
sleep 15
resp=$(curl http://localhost:8080/echo -X POST -d "WasmEdge")
echo "$resp"
kill -9 `cat wasmedge.pid`
rm wasmedge.pid
if [[ $resp == *"WasmEdge"* ]]; then
echo -e "Execution Success!"
else
echo -e "Execution Fail!"
exit 1
fi
- name: TFLite Server example
run: |
cd server-tflite
cargo build --target wasm32-wasi --release
wasmedgec target/wasm32-wasi/release/wasmedge_hyper_server_tflite.wasm wasmedge_hyper_server_tflite.wasm
nohup wasmedge wasmedge_hyper_server_tflite.wasm &
echo $! > wasmedge.pid
sleep 15
resp=$(curl http://localhost:8080/classify -X POST --data-binary "@grace_hopper.jpg")
echo "$resp"
kill -9 `cat wasmedge.pid`
rm wasmedge.pid
if [[ $resp == *"uniform"* ]]; then
echo -e "Execution Success!"
else
echo -e "Execution Fail!"
exit 1
fi
- name: Client example
run: |
cd client
cargo build --target wasm32-wasi --release
wasmedgec target/wasm32-wasi/release/wasmedge_hyper_client.wasm wasmedge_hyper_client.wasm
resp=$(wasmedge wasmedge_hyper_client.wasm)
echo "$resp"
if [[ $resp == *"WasmEdge"* ]]; then
echo -e "Execution Success!"
else
echo -e "Execution Fail!"
exit 1
fi
- name: Client HTTPS example
run: |
cd client-https
cargo build --target wasm32-wasi --release
wasmedge compile target/wasm32-wasi/release/wasmedge_hyper_client_https.wasm wasmedge_hyper_client_https.wasm
resp=$(wasmedge wasmedge_hyper_client_https.wasm)
echo "$resp"
if [[ $resp == *"WasmEdge"* ]]; then
echo -e "Execution Success!"
else
echo -e "Execution Fail!"
exit 1
fi