-
Notifications
You must be signed in to change notification settings - Fork 11
193 lines (171 loc) · 6.51 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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
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 and run MySQL
run: |
sudo apt-get update
sudo apt-get -y install mysql-server libmysqlclient-dev curl
sudo service mysql start
mysql -e "SET GLOBAL max_allowed_packet = 36700160;" -uroot -proot
mysql -e "SET @@GLOBAL.ENFORCE_GTID_CONSISTENCY = WARN;" -uroot -proot
mysql -e "SET @@GLOBAL.ENFORCE_GTID_CONSISTENCY = ON;" -uroot -proot
mysql -e "SET @@GLOBAL.GTID_MODE = OFF_PERMISSIVE;" -uroot -proot
mysql -e "SET @@GLOBAL.GTID_MODE = ON_PERMISSIVE;" -uroot -proot
mysql -e "SET @@GLOBAL.GTID_MODE = ON;" -uroot -proot
mysql -e "PURGE BINARY LOGS BEFORE now();" -uroot -proot
- name: Install and run Redis
run: |
sudo apt-get update
sudo apt install redis-server
sudo systemctl status redis-server
- name: Install and run PostgreSQL
run: |
sudo apt-get update
sudo apt install postgresql postgresql-contrib
# sudo pg_ctlcluster 12 main start
sudo systemctl start postgresql.service
sleep 10
sudo -u postgres createuser -w wasmedge
sudo -u postgres createdb -O wasmedge testdb
sudo -u postgres psql -c "ALTER USER wasmedge PASSWORD 'mysecret';"
sudo -u postgres psql -c 'SELECT datname FROM pg_catalog.pg_database'
- name: Install and run GreptimeDB
run: |
curl -L https://github.com/GreptimeTeam/greptimedb/raw/develop/scripts/install.sh | sh
./greptime standalone start &
- name: Install and run Qdrant in Docker
run: |
mkdir qdrant_storage
nohup docker run -d -p 6333:6333 -p 6334:6334 -v ${{ github.workspace }}/qdrant_storage:/qdrant/storage:z qdrant/qdrant
# - name: Install Anna KVS and run router
# run: |
# git clone https://github.com/essa-project/anna-rs.git
# cd anna-rs
# cp example-config.yml config.yml
# ANNA_PUBLIC_IP=127.0.0.1 ANNA_TCP_PORT_BASE=12340 nohup cargo run --bin routing -- config.yml &
# - name: Run Anna KVS
# run: |
# cd anna-rs
# ANNA_PUBLIC_IP=127.0.0.1 nohup cargo run --bin kvs -- config.yml &
- name: Install Rust target for wasm
run: |
rustup target add wasm32-wasi
- name: Install WasmEdge
run: |
VERSION=0.13.5
curl -sSf https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install.sh | sudo bash -s -- --plugins wasmedge_rustls --version=$VERSION -p /usr/local
- name: MySQL async examples
run: |
cd mysql_async
cargo build --target wasm32-wasi --release
wasmedge compile target/wasm32-wasi/release/crud.wasm crud.wasm
resp=$(wasmedge --env "DATABASE_URL=mysql://root:root@localhost:3306/mysql" crud.wasm 2>&1)
echo "$resp"
if [[ $resp == *"Bobcat"* ]]; then
echo -e "Execution Success!"
else
echo -e "Execution Fail!"
exit 1
fi
- name: GreptimeDB examples
run: |
cd greptimedb
cargo build --target wasm32-wasi --release
wasmedge compile target/wasm32-wasi/release/greptimedb.wasm greptimedb.wasm
resp=$(wasmedge --env "DATABASE_URL=mysql://localhost:4002/public" greptimedb.wasm 2>&1)
echo "$resp"
- name: MySQL simple examples
run: |
cd mysql
cargo build --target wasm32-wasi --release
wasmedge compile target/wasm32-wasi/release/query.wasm query.wasm
wasmedge compile target/wasm32-wasi/release/insert.wasm insert.wasm
resp=$(wasmedge --env "DATABASE_URL=mysql://root:root@127.0.0.1:3306/mysql" query.wasm 2>&1)
echo "$resp"
if [[ $resp == *"localhost"* ]]; then
echo -e "Execution Success!"
else
echo -e "Execution Fail!"
exit 1
fi
resp=$(wasmedge --env "DATABASE_URL=mysql://root:root@localhost:3306/mysql" insert.wasm 2>&1)
echo "$resp"
if [[ $resp == *"foo"* ]]; then
echo -e "Execution Success!"
else
echo -e "Execution Fail!"
exit 1
fi
- name: Redis examples
run: |
cd redis
cargo build --target wasm32-wasi --release
wasmedge compile target/wasm32-wasi/release/wasmedge-redis-client-examples.wasm wasmedge-redis-client-examples.wasm
resp=$(wasmedge --env "REDIS_URL=redis://localhost/" wasmedge-redis-client-examples.wasm 2>&1)
echo "$resp"
if [[ $resp == *"UTC"* ]]; then
echo -e "Execution Success!"
else
echo -e "Execution Fail!"
exit 1
fi
- name: PostgresSQL examples
run: |
cd postgres
cargo build --target wasm32-wasi --release
wasmedge compile target/wasm32-wasi/release/crud.wasm crud.wasm
resp=$(wasmedge --env "DATABASE_URL=postgres://wasmedge:mysecret@localhost/testdb" crud.wasm 2>&1)
echo "$resp"
- name: Qdrant examples
run: |
cd qdrant
cargo build --target wasm32-wasi --release
wasmedge compile target/wasm32-wasi/release/qdrant_examples.wasm qdrant_examples.wasm
resp=$(wasmedge qdrant_examples.wasm 2>&1)
echo "$resp"
# - name: Anna KVS examples
# run: |
# cd anna
# cargo build --target wasm32-wasi --release
# wasmedgec target/wasm32-wasi/release/putget.wasm putget.wasm
# resp=$(wasmedge putget.wasm 2>&1)
# echo "$resp"
# if [[ $resp == *"UTC"* ]]; then
# echo -e "Execution Success!"
# else
# echo -e "Execution Fail!"
# exit 1
# fi
- name: MySQL tls async examples w TiDB serverless
env:
DB_URL: ${{ secrets.DB_URL }}
run: |
cd mysql_async
resp=$(wasmedge --env "DATABASE_SSL=1" --env "DATABASE_URL=${DB_URL}" crud.wasm 2>&1)
echo "$resp"
if [[ $resp == *"Bobcat"* ]]; then
echo -e "Execution Success!"
else
echo -e "Execution Fail!"
exit 1
fi