forked from containerd/runwasi
-
Notifications
You must be signed in to change notification settings - Fork 3
138 lines (115 loc) · 5.48 KB
/
demo.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
131
132
133
134
135
136
137
138
name: examples
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
on:
workflow_dispatch:
inputs:
logLevel:
description: 'Log level'
required: true
default: 'info'
push:
branches: [main]
pull_request:
branches: [main]
schedule:
- cron: "0 0 */1 * *"
jobs:
run-all-examples:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- 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 and run MySQL
run: |
sudo apt-get update
sudo apt-get -y install mysql-server libmysqlclient-dev curl
sudo service mysql start
mysql -e "PURGE BINARY LOGS BEFORE now();" -uroot -proot
- name: Install WasmEdge
run: |
curl -sSf https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install.sh | bash -s -- --version=0.11.2
sudo -E sh -c 'echo "$HOME/.wasmedge/lib" > /etc/ld.so.conf.d/libwasmedge.conf'
sudo ldconfig
- name: Build and install conatiner wasmedge shim
run: |
rustup default nightly
rustup target add wasm32-wasi
make build FEATURES=wasmedge
sudo make install RUNTIME=wasmedge
- name: Build all test and demo OCI images
run: |
make load
make load_demo
- name: Run basic test case
run: |
sudo ctr run --rm --runtime=io.containerd.wasmedge.v1 ghcr.io/containerd/runwasi/wasi-demo-app:latest testwasm /wasi-demo-app.wasm echo 'hello'
- name: Run hype demo conatiner
run: |
sudo ctr run --rm --net-host --runtime=io.containerd.wasmedge.v1 ghcr.io/containerd/runwasi/wasmedge_hyper_client:latest testclient
nohup sudo ctr run --rm --net-host --runtime=io.containerd.wasmedge.v1 ghcr.io/containerd/runwasi/wasmedge_hyper_server:latest testserver &
- name: Test hyper server
run: |
curl http://localhost:8080/echo -X POST -d "WasmEdge"
sudo ctr task kill -s SIGKILL testserver
- name: Run reqwest demo conatiner
run: |
sudo ctr run --rm --net-host --runtime=io.containerd.wasmedge.v1 ghcr.io/containerd/runwasi/wasmedge_reqwest_demo:latest testreqwest
- name: Run db demo conatiner
run: |
sudo ctr run --rm --net-host --env DATABASE_URL=mysql://root:[email protected]:3306/mysql --runtime=io.containerd.wasmedge.v1 ghcr.io/containerd/runwasi/wasmedge-mysql-driver-demo:latest testdb /insert.wasm
sudo ctr run --rm --net-host --env DATABASE_URL=mysql://root:[email protected]:3306/mysql --runtime=io.containerd.wasmedge.v1 ghcr.io/containerd/runwasi/wasmedge-mysql-driver-demo:latest testdb /query.wasm
sudo ctr run --rm --net-host --env DATABASE_URL=mysql://root:[email protected]:3306/mysql --runtime=io.containerd.wasmedge.v1 ghcr.io/containerd/runwasi/crud:latest testdb
- name: Run rootfs mounts demo conatiner
run: |
sudo ctr run --rm --runtime=io.containerd.wasmedge.v1 \
--mount type=bind,src=$PWD/demo/wasmedge-rootfs-mounts-demo,dst=/mnt,options=rbind:ro \
ghcr.io/containerd/runwasi/wasmedge-rootfs-mounts-demo:latest preopens
- name: Run microservice with database demo conatiner
run: |
nohup sudo ctr run --rm --net-host \
--env DATABASE_URL=mysql://root:[email protected]:3306/mysql \
--runtime=io.containerd.wasmedge.v1 \
ghcr.io/containerd/runwasi/order_demo_service:latest testmicroservice &
- name: Test microservice
run: |
curl http://localhost:8080/init
curl http://localhost:8080/create_orders -X POST -d @demo/microservice_db/orders.json
curl http://localhost:8080/orders
curl http://localhost:8080/update_order -X POST -d @demo/microservice_db/update_order.json
curl http://localhost:8080/delete_order?id=2
sudo ctr task kill -s SIGKILL testmicroservice
- name: Download PyTorch library, Wasmedge Library and WASINN PyTorch plugin
run: |
./demo/utils/setup_wasinn_plugin.sh
echo "WASMEDGE_INCLUDE_DIR=$PWD/WasmEdge-0.11.1-Linux/include" >> $GITHUB_ENV
echo "WASMEDGE_LIB_DIR=$PWD/WasmEdge-0.11.1-Linux/lib" >> $GITHUB_ENV
echo "WASMEDGE_PLUGIN_PATH=$PWD/WasmEdge-0.11.1-Linux/lib/wasmedge" >> $GITHUB_ENV
- name: Build and install conatiner wasmedge shim with support wasi-nn plugin
run: |
make build FEATURES=wasmedge,wasi_nn
sudo make install RUNTIME=wasmedge
- name: Add WASMEDGE_PLUGIN_PATH into service containerd
shell: 'script -q -e -c "bash {0}"'
run: |
sudo SYSTEMD_EDITOR=tee systemctl edit containerd <<EOF
[Service]
Environment="WASMEDGE_PLUGIN_PATH=$WASMEDGE_PLUGIN_PATH"
EOF
sudo systemctl restart containerd
- name: Run WASI-NN PyTorch demo conatiner
run: |
wget --no-clobber https://github.com/bytecodealliance/wasi-nn/raw/main/rust/examples/images/1.jpg -O demo/wasinn/pytorch-mobilenet-image/input.jpg
sudo ctr run --rm \
--mount type=bind,src=$PWD/demo/wasinn/pytorch-mobilenet-image,dst=/resource,options=rbind:ro \
--runtime=io.containerd.wasmedge.v1 \
ghcr.io/containerd/runwasi/wasmedge-wasinn-example-mobilenet-image:latest \
testwasinn \
/app.wasm /resource/mobilenet.pt /resource/input.jpg