ci(test_api_server): update workflow #10
Workflow file for this run
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: Test API Server | |
on: | |
push: | |
branches: | |
- dev | |
- main | |
- release-* | |
- feat-* | |
- ci-* | |
- refactor-* | |
- fix-* | |
- test-* | |
paths: | |
- '.github/workflows/test_api_server.yml' | |
- '**/Cargo.toml' | |
- '**/*.rs' | |
- '**/*.sh' | |
- '**/.cargo/config.toml' | |
- "tests/*.hurl" | |
pull_request: | |
branches: | |
- dev | |
- main | |
types: [opened, synchronize, reopened] | |
paths: | |
- '.github/workflows/**' | |
- '**/Cargo.toml' | |
- '**/*.rs' | |
- '**/*.sh' | |
- 'tests/*.hurl' | |
jobs: | |
test-api-server-ubuntu: | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
strategy: | |
matrix: | |
wasmedge_version: [0.14.1-rc.4] | |
steps: | |
- name: Clone project | |
id: checkout | |
uses: actions/checkout@v3 | |
- name: Install Rust-nightly | |
uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
toolchain: nightly | |
target: wasm32-wasip1 | |
components: rustfmt, clippy | |
- name: Install Rust-stable | |
uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
target: wasm32-wasip1 | |
- name: Install dependencies | |
run: | | |
sudo apt update | |
sudo apt install libomp5 | |
- name: Install WasmEdge | |
run: | | |
curl -sSf https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install_v2.sh | bash -s -- -v ${{ matrix.wasmedge_version }} | |
ls -al $HOME/.wasmedge/plugin | |
- name: Deploy wasmedge_stablediffusion plugin | |
run: | | |
curl -LO https://github.com/WasmEdge/WasmEdge/releases/download/0.14.1-rc.4/WasmEdge-plugin-wasmedge_stablediffusion-0.14.1-rc.4-ubuntu20.04_x86_64.tar.gz | |
tar -xzf WasmEdge-plugin-wasmedge_stablediffusion-0.14.1-rc.4-ubuntu20.04_x86_64.tar.gz -C $HOME/.wasmedge/plugin | |
rm $HOME/.wasmedge/plugin/libwasmedgePluginWasiNN.so | |
ls -al $HOME/.wasmedge/plugin | |
- name: Install Hurl | |
run: | | |
curl --location --remote-name https://github.com/Orange-OpenSource/hurl/releases/download/5.0.1/hurl_5.0.1_amd64.deb | |
sudo apt update && sudo apt install ./hurl_5.0.1_amd64.deb | |
- name: Build sd-api-server on linux | |
env: | |
RUSTFLAGS: "--cfg wasmedge --cfg tokio_unstable" | |
run: | | |
cargo build --release | |
cp target/wasm32-wasip1/release/sd-api-server.wasm ./sd-api-server.wasm | |
- name: Download model | |
run: | | |
curl -LO https://huggingface.co/second-state/stable-diffusion-v-1-4-GGUF/resolve/main/stable-diffusion-v1-4-Q8_0.gguf | |
- name: Start sd-api-server | |
run: | | |
nohup $HOME/.wasmedge/bin/wasmedge --dir .:. sd-api-server.wasm --model-name sd-v1.4 --model stable-diffusion-v1-4-Q8_0.gguf --socket-addr 0.0.0.0:8080 > ./start-llamaedge.log 2>&1 & | |
sleep 5 | |
cat start-llamaedge.log | |
- name: Run test | |
run: | | |
hurl --test --jobs 1 ./tests/sd_1.4.hurl | |
- name: Stop llama-api-server | |
run: | | |
pkill -f wasmedge | |
test-api-server-mac: | |
runs-on: macos-14 | |
timeout-minutes: 10 | |
strategy: | |
matrix: | |
wasmedge_version: [0.14.1-rc.4] | |
steps: | |
- name: Clone project | |
id: checkout | |
uses: actions/checkout@v3 | |
- name: Install Rust-nightly | |
uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
toolchain: nightly | |
target: wasm32-wasip1 | |
components: rustfmt, clippy | |
- name: Install Rust-stable | |
uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
target: wasm32-wasip1 | |
- name: Install WasmEdge | |
run: | | |
curl -sSf https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install_v2.sh | bash -s -- -v ${{ matrix.wasmedge_version }} | |
ls -al $HOME/.wasmedge/plugin | |
- name: Deploy wasmedge_stablediffusion plugin | |
run: | | |
curl -LO https://github.com/WasmEdge/WasmEdge/releases/download/0.14.1-rc.4/WasmEdge-plugin-wasmedge_stablediffusion-0.14.1-rc.4-darwin_arm64.tar.gz | |
tar -xzf WasmEdge-plugin-wasmedge_stablediffusion-0.14.1-rc.4-darwin_arm64.tar.gz -C $HOME/.wasmedge/plugin | |
rm $HOME/.wasmedge/plugin/libwasmedgePluginWasiNN.dylib | |
ls -al $HOME/.wasmedge/plugin | |
- name: Download wasi-sdk for arm64-macos | |
run: | | |
curl -LO https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-24/wasi-sdk-24.0-arm64-macos.tar.gz | |
tar -xzvf wasi-sdk-24.0-arm64-macos.tar.gz | |
mv wasi-sdk-24.0-arm64-macos wasi-sdk-24.0 | |
- name: Install Hurl | |
run: | | |
brew install hurl | |
- name: Build sd-api-server on macos-14 | |
env: | |
WASI_SDK_PATH: /Users/runner/work/sd-api-server/sd-api-server/wasi-sdk-24.0 | |
CC: "/Users/runner/work/sd-api-server/sd-api-server/wasi-sdk-24.0/bin/clang --sysroot=/Users/runner/work/sd-api-server/sd-api-server/wasi-sdk-24.0/share/wasi-sysroot" | |
RUSTFLAGS: "--cfg wasmedge --cfg tokio_unstable" | |
run: | | |
cargo build --release | |
cp target/wasm32-wasip1/release/sd-api-server.wasm ./sd-api-server.wasm | |
- name: Download model | |
run: | | |
curl -LO https://huggingface.co/second-state/stable-diffusion-v-1-4-GGUF/resolve/main/stable-diffusion-v1-4-Q8_0.gguf | |
- name: Start sd-api-server | |
run: | | |
nohup $HOME/.wasmedge/bin/wasmedge --dir .:. sd-api-server.wasm --model-name sd-v1.4 --model stable-diffusion-v1-4-Q8_0.gguf --socket-addr 0.0.0.0:8080 > ./start-llamaedge.log 2>&1 & | |
sleep 5 | |
cat start-llamaedge.log | |
- name: Run test | |
run: | | |
hurl --test --jobs 1 ./tests/sd_1.4.hurl | |
- name: Stop llama-api-server | |
run: | | |
pkill -f wasmedge |