-
Notifications
You must be signed in to change notification settings - Fork 15
131 lines (118 loc) · 4.38 KB
/
examples.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
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: |
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.3
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/second-state/wasmedge_rustls_plugin/releases/download/0.2.0/wasmedge_rustls_plugin_ubuntu-20.04.zip
unzip wasmedge_rustls_plugin_ubuntu-20.04.zip
sudo mv target/release/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