name: Rust CI
on:
push:
branches: [ "master", "main" ]
pull_request:
branches: [ "master", "main" ]
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
format-and-lint:
name: Format & Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Setup Rust cache
uses: Swatinem/rust-cache@v2
- name: Check formatting
run: cargo fmt --all -- --check
- name: Run clippy
run: cargo clippy --workspace --lib --bins --all-features -- -D warnings
test:
name: Test Suite
runs-on: ubuntu-latest
needs: [format-and-lint]
steps:
- uses: actions/checkout@v6
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Setup Rust cache
uses: Swatinem/rust-cache@v2
- name: Build workspace
run: cargo build --workspace --all-features --verbose --lib --bins
- name: Run tests
run: cargo test --workspace --all-features --verbose --lib --bins
- name: Run doc tests
run: cargo test --workspace --doc --all-features
coverage:
name: Code Coverage
runs-on: ubuntu-latest
needs: [format-and-lint]
steps:
- uses: actions/checkout@v6
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools-preview
- name: Setup Rust cache
uses: Swatinem/rust-cache@v2
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Generate code coverage
run: cargo llvm-cov --lib -p ash-flare --all-features --lcov --output-path lcov.info
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
files: lcov.info
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}
flags: core
name: ash-flare
verbose: true
env:
CODECOV_COMMENT: ${{ github.event_name == 'pull_request' }}
check-features:
name: Feature Combinations
runs-on: ubuntu-latest
needs: [format-and-lint]
strategy:
fail-fast: false
matrix:
features:
- no-default
- all-features
steps:
- uses: actions/checkout@v6
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Setup Rust cache
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.features }}
- name: Check feature - no-default
if: matrix.features == 'no-default'
run: cargo check -p ash-flare --no-default-features
- name: Check feature - all-features
if: matrix.features == 'all-features'
run: cargo check -p ash-flare --all-features
documentation:
name: Documentation
runs-on: ubuntu-latest
needs: [test, check-features]
steps:
- uses: actions/checkout@v6
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Setup Rust cache
uses: Swatinem/rust-cache@v2
- name: Check documentation
run: cargo doc --workspace --all-features --no-deps
env:
RUSTDOCFLAGS: -D warnings
security-audit:
name: Security Audit
runs-on: ubuntu-latest
needs: [test, check-features]
steps:
- uses: actions/checkout@v6
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Setup Rust cache
uses: Swatinem/rust-cache@v2
- name: Install cargo-audit
uses: taiki-e/install-action@cargo-audit
- name: Run security audit
run: cargo audit
msrv:
name: MSRV Check (1.88)
runs-on: ubuntu-latest
needs: [format-and-lint]
steps:
- uses: actions/checkout@v6
- name: Install MSRV toolchain
uses: dtolnay/rust-toolchain@1.88
- name: Setup Rust cache
uses: Swatinem/rust-cache@v2
- name: Check MSRV compatibility
run: cargo check -p ash-flare --all-features