chore: improve code #9
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: Build | |
on: | |
push: | |
branches: | |
- dev | |
- main | |
- release-* | |
- feat-* | |
- ci-* | |
- refactor-* | |
- fix-* | |
- test-* | |
paths: | |
- '.github/workflows/build.yml' | |
- '**/Cargo.toml' | |
- '**/*.rs' | |
- '**/*.sh' | |
- '**/.cargo/config.toml' | |
pull_request: | |
branches: | |
- dev | |
- main | |
types: [opened, synchronize, reopened] | |
paths: | |
- '.github/workflows/**' | |
- '**/Cargo.toml' | |
- '**/*.rs' | |
- '**/*.sh' | |
jobs: | |
build-wasm: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-22.04, macos-13, macos-14] | |
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: Download wasi-sdk for x86_64-macos | |
if: matrix.os == 'macos-13' | |
run: | | |
curl -LO https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-24/wasi-sdk-24.0-x86_64-macos.tar.gz | |
tar -xzvf wasi-sdk-24.0-x86_64-macos.tar.gz | |
mv wasi-sdk-24.0-x86_64-macos wasi-sdk-24.0 | |
- name: Download wasi-sdk for arm64-macos | |
if: matrix.os == 'macos-14' | |
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: Run clippy | |
if: startsWith(matrix.os, 'ubuntu') | |
env: | |
RUSTFLAGS: "--cfg wasmedge --cfg tokio_unstable" | |
run: | | |
cargo +nightly clippy --target wasm32-wasip1 -- -D warnings | |
- name: Run fmt | |
if: startsWith(matrix.os, 'ubuntu') | |
env: | |
RUSTFLAGS: "--cfg wasmedge --cfg tokio_unstable" | |
run: | | |
cargo +nightly fmt --all -- --check | |
- name: Build on linux | |
if: startsWith(matrix.os, 'ubuntu') | |
env: | |
RUSTFLAGS: "--cfg wasmedge --cfg tokio_unstable" | |
run: | | |
cargo build --release | |
- name: Build on macos | |
if: startsWith(matrix.os, 'macos') | |
env: | |
WASI_SDK_PATH: /Users/runner/work/llama-gateway/llama-gateway/wasi-sdk-24.0 | |
CC: "/Users/runner/work/llama-gateway/llama-gateway/wasi-sdk-24.0/bin/clang --sysroot=/Users/runner/work/llama-gateway/llama-gateway/wasi-sdk-24.0/share/wasi-sysroot" | |
RUSTFLAGS: "--cfg wasmedge --cfg tokio_unstable" | |
run: | | |
cargo build --release |