name: Cargo Build & Test
permissions:
contents: read
on:
pull_request:
types:
- opened
- reopened
- synchronize
- ready_for_review
jobs:
pre_ci:
name: Pre-CI tests runs-on: ubuntu-latest
if: ${{ !github.event.pull_request.draft }}
steps:
- uses: actions/checkout@v6
- uses: taiki-e/install-action@cargo-hack
- run: rustup update stable && rustup update nightly
- run: cargo hack check --rust-version --workspace --all-targets --ignore-private
- run: cargo clippy -- -D warnings
- run: RUSTDOCFLAGS="-D warnings" cargo doc
- run: rustup component add rustfmt --toolchain nightly
- run: cargo +nightly fmt --all -- --check
build_and_test:
name: Rust project - latest
runs-on: ubuntu-latest
if: ${{ !github.event.pull_request.draft }}
strategy:
matrix:
toolchain:
- stable
- beta
- nightly
steps:
- uses: actions/checkout@v6
- run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
- run: cargo build --verbose
- run: cargo test --verbose