name: Rust CI
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
jobs:
build-test:
name: Build & test (${{ matrix.toolchain }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
toolchain: [stable, beta, nightly]
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Install Rust (${{ matrix.toolchain }})
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.toolchain }}
override: true
profile: minimal
components: clippy, rustfmt
- name: Cache cargo registry + build
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ matrix.toolchain }}-${{ hashFiles('**/Cargo.lock') }}
- name: Check formatting
run: cargo fmt --all -- --check
- name: Clippy (deny warnings)
run: cargo clippy --all-features -- -D warnings
- name: Run tests (default features)
run: cargo test --all
- name: Run tests (no default features)
run: cargo test --no-default-features
- name: Run examples
run: |
timeout 30s cargo run --example simple
timeout 45s cargo run --example dynamic_add
timeout 30s cargo run --example restart_supervisor
timeout 30s cargo run --example runtime_context
timeout 30s cargo run --example axum