name: rust
concurrency:
cancel-in-progress: false
group: ${{ github.workflow }}-${{ github.ref }}
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
on:
pull_request:
branches: [ main, master ]
types: [ opened, synchronize, reopened ]
push:
branches: [ main, master ]
tags: [ latest, v*, "*-nightly" ]
repository_dispatch:
types: [ rust ]
workflow_dispatch:
permissions:
contents: read
deployments: read
jobs:
build:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Setup Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
cache-key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
cache-workspaces: true
-
name: Build
run: cargo build --locked --release --workspace --all-features
test:
needs: build
strategy:
fail-fast: false
matrix:
toolchain: [ stable, nightly ]
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Setup Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
cache-key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
cache-workspaces: true
toolchain: ${{ matrix.toolchain }}
override: true
-
name: Test (all-features)
run: cargo test --locked --release --workspace --all-features
benchmark:
needs: build
if: github.event_name == 'push' && github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags')
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Setup Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
cache-key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
cache-workspaces: true
-
name: Benchmark
run: cargo bench --verbose --workspace --features full