Rust CI #282
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: Rust CI | |
on: | |
push: | |
branches: ["**"] | |
pull_request: | |
branches: ["next", "main"] | |
schedule: | |
- cron: "0 0 * * 0" | |
jobs: | |
build-wasm: | |
name: Build wasm | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Install Rust toolchain | |
uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
toolchain: stable | |
target: wasm32-unknown-unknown | |
- name: Install Binaryen and WABT | |
run: sudo apt-get install -y binaryen wabt | |
- name: Build wasm | |
run: ./examples/rust/build.sh | |
- name: Save artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wasm | |
path: examples/rust/out | |
run-tests: | |
needs: build-wasm | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-latest | |
rust: stable | |
name: "Linux x86 (stable)" | |
- os: ubuntu-latest | |
rust: nightly | |
name: "Linux x86 (nightly)" | |
- os: ubuntu-latest | |
rust: stable | |
name: "Linux x86 (stable, no default features)" | |
args: "--no-default-features" | |
- os: ubuntu-latest | |
rust: nightly | |
name: "Linux x86 (nightly, no default features)" | |
args: "--no-default-features" | |
- os: macos-14 | |
rust: stable | |
name: "macOS arm64 (Apple M1)" | |
- os: ubuntu-latest | |
rust: stable | |
name: "Linux arm64" | |
target: aarch64-unknown-linux-gnu | |
- os: ubuntu-latest | |
rust: stable | |
name: "Linux armv7" | |
target: armv7-unknown-linux-gnueabihf | |
name: Run tests on ${{ matrix.name }} | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Install Rust toolchain | |
uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
toolchain: ${{ matrix.rust }} | |
rustflags: "" | |
components: rustfmt, clippy | |
if: matrix.target == '' | |
- name: Load wasm | |
uses: actions/download-artifact@v4 | |
with: | |
name: wasm | |
path: examples/rust/out | |
- name: Run tests | |
run: cargo test --workspace ${{ matrix.args }} && cargo test --workspace ${{ matrix.args }} --examples | |
if: matrix.target == '' | |
- name: Run clippy | |
run: cargo clippy --workspace ${{ matrix.args }} | |
if: matrix.target == '' | |
- name: Run tests (${{ matrix.target }}) | |
uses: houseabsolute/[email protected] | |
with: | |
command: test | |
target: ${{ matrix.target }} | |
toolchain: ${{ matrix.rust }} | |
if: matrix.target != '' |