name: CI
on:
pull_request:
push:
env:
CARGO_TERM_COLOR: always
jobs:
test:
name: ${{ matrix.platform.os_name }}
strategy:
fail-fast: false
matrix:
platform:
- os_name: Web Assembly
slug: wasm-webgl2
os: macos-14
target: wasm32-unknown-unknown
run_tests: false
- os_name: Android ARMv8-A
slug: android-armv8
os: ubuntu-24.04
target: aarch64-linux-android
run_tests: true
- os_name: Android x86_64
slug: android-x86_64
os: ubuntu-24.04
target: x86_64-linux-android
run_tests: true
- os_name: iOS A7+
slug: ios-a7
os: macos-14
target: aarch64-apple-ios
run_tests: false
- os_name: macOS Apple Silicon
slug: macos-apple-silicon
os: macos-14
target: aarch64-apple-darwin
run_tests: true
- os_name: macOS Intel
slug: macos-intel
os: macos-13
target: x86_64-apple-darwin
run_tests: true
- os_name: Windows x86_64
slug: windows-x86_64
os: windows-2022
target: x86_64-pc-windows-msvc
run_tests: true
- os_name: Linux ARMv8-A
slug: linux-armv8
os: ubuntu-24.04
target: aarch64-unknown-linux-gnu
run_tests: true
- os_name: Linux ARMv7-A
slug: linux-armv7
os: ubuntu-24.04
target: thumbv7neon-unknown-linux-gnueabihf
run_tests: true
- os_name: Linux x86_64/amd64
slug: linux-x86_64
os: ubuntu-24.04
target: x86_64-unknown-linux-gnu
run_tests: true
runs-on: ${{ matrix.platform.os }}
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Cache
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ matrix.platform.slug }}-cargo-build-${{ hashFiles('**/Cargo.toml') }}
- name: Install toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable 1 month ago
components: rustfmt, clippy
targets: ${{ matrix.platform.target }}
- name: Install cross-rs
shell: bash
run: which cross && cross --version || cargo install cross --git https://github.com/cross-rs/cross --rev 221324fd39a857f7af954484b96296cbc8c6a65f --force
- name: Install wasm tools
if: ${{ matrix.platform.target == 'wasm32-unknown-unknown' }}
shell: bash
run: |
which wasm-bindgen && wasm-bindgen --version || cargo install wasm-bindgen-cli --version "0.2.92" --force
which wasm-pack && wasm-pack --version || cargo install wasm-pack --version "0.12.1" --force
- name: Build
shell: bash
run: RUSTFLAGS="${{ matrix.platform.rustflags }}" cross build --target ${{ matrix.platform.target }}
- name: Run native tests
if: ${{ matrix.platform.run_tests }}
shell: bash
run: RUSTFLAGS="${{ matrix.platform.rustflags }}" cross test --target ${{ matrix.platform.target }} --workspace --all-features
- name: Run web tests
if: ${{ matrix.platform.target == 'wasm32-unknown-unknown' }}
shell: bash
run: |
RUSTFLAGS="${{ matrix.platform.rustflags }}" wasm-pack test --node
RUSTFLAGS="${{ matrix.platform.rustflags }}" wasm-pack test --headless --chrome
RUSTFLAGS="${{ matrix.platform.rustflags }}" wasm-pack test --headless --firefox
RUSTFLAGS="${{ matrix.platform.rustflags }}" wasm-pack test --headless --safari
- name: Run clippy
shell: bash
run: RUSTFLAGS="${{ matrix.platform.rustflags }}" cross clippy --target ${{ matrix.platform.target }} --workspace --all-targets --all-features -- -D warnings
rustfmt:
name: Formatting
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ubuntu-24.04-cargo-build-${{ hashFiles('**/Cargo.toml') }}
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable 1 month ago
components: rustfmt
- name: Check format
shell: bash
run: cargo fmt --all -- --check