main #72
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: main | |
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 libjpeg-dev libpng-dev cmake | |
- 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 Rust target for wasm | |
run: | | |
rustup target add wasm32-wasi | |
- name: Install WasmEdge | |
run: | | |
VERSION=0.13.4 | |
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 | |
- name: Install and init dapr | |
run: | | |
wget -q https://raw.githubusercontent.com/dapr/cli/master/install/install.sh -O - | /bin/bash | |
dapr init | |
- name: Start dapr sentry service | |
run: | | |
mkdir -p .dapr/certs | |
wget https://github.com/dapr/dapr/releases/download/v1.8.4/sentry_linux_amd64.tar.gz | |
tar -zxvf sentry_linux_amd64.tar.gz | |
nohup ./sentry --issuer-credentials .dapr/certs --trust-domain cluster.local & | |
- name: Run grayscale | |
run: | | |
cd image-api-grayscale | |
cargo build --target wasm32-wasi --release | |
wasmedgec target/wasm32-wasi/release/image-api-grayscale.wasm image-api-grayscale.wasm | |
nohup dapr run --app-id image-api-grayscale --app-protocol http --app-port 9005 --dapr-http-port 3503 --resources-path ../config --log-level debug wasmedge image-api-grayscale.wasm > server.log 2>&1 & | |
- name: Run classify | |
run: | | |
cd image-api-classify | |
cargo build --target wasm32-wasi --release | |
wasmedgec target/wasm32-wasi/release/wasmedge_hyper_server_tflite.wasm wasmedge_hyper_server_tflite.wasm | |
nohup dapr run --app-id image-api-classify --app-protocol http --app-port 9006 --dapr-http-port 3504 --resources-path ../config --log-level debug wasmedge wasmedge_hyper_server_tflite.wasm > server.log 2>&1 & | |
- name: Run events service | |
run: | | |
cd events-service | |
cargo build --target wasm32-wasi --release | |
wasmedgec target/wasm32-wasi/release/events_service.wasm events_service.wasm | |
nohup dapr run --app-id events-service --app-protocol http --app-port 9007 --dapr-http-port 3505 --resources-path ../config --log-level debug wasmedge events_service.wasm > server.log 2>&1 & | |
sleep 10 | |
- name: Run tests | |
continue-on-error: true | |
run: | | |
cat events-service/server.log | |
cd docs | |
curl http://localhost:9007/init | |
curl http://localhost:9007/events | |
curl http://localhost:9005/grayscale -X POST --data-binary '@food.jpg' | |
# curl -o /dev/null http://localhost:9005/grayscale -X POST --data-binary '@food.jpg' | |
curl http://localhost:9006/classify -X POST --data-binary '@food.jpg' | |
curl http://localhost:9007/events | |
- name: Dump the grayscale server log | |
run: | | |
cd image-api-grayscale | |
cat server.log | |
- name: Dump the classify server log | |
run: | | |
cd image-api-classify | |
cat server.log | |
- name: Dump the events server log | |
run: | | |
cd events-service | |
cat server.log | |