Merge pull request #21 from second-state/chore/update_dependencies #104
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: 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 |