name: Rust CI
on:
push:
branches: [main, master]
paths:
- 'src/**'
- 'tests/**'
- 'benches/**'
- 'Cargo.toml'
- 'Cargo.lock'
- 'deny.toml'
- '.github/workflows/rust.yml'
pull_request:
branches: [main, master]
paths:
- 'src/**'
- 'tests/**'
- 'benches/**'
- 'Cargo.toml'
- 'Cargo.lock'
- 'deny.toml'
- '.github/workflows/rust.yml'
env:
CARGO_TERM_COLOR: always
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@4be9e76fd7c4901c61fb841f559994984270fce7
- name: Cache cargo
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Compile (all targets, all features)
run: cargo test --all-targets --all-features --no-run
- name: Run unit tests
run: cargo test --lib
- name: Run unit tests (no default features)
run: cargo test --no-default-features --lib
- name: Compile (tests, no default features)
run: cargo test --no-default-features --tests --no-run
- name: Run property tests
run: cargo test --test proptests
env:
PROPTEST_CASES: 256
- name: Run integration tests
run: cargo test --test integration_export
- name: Check formatting
run: cargo fmt --check
- name: Run clippy
run: cargo clippy -- -D warnings
- name: Run clippy (no default features, lib)
run: cargo clippy --no-default-features --lib -- -D warnings
- name: Run clippy (all features, lib)
run: cargo clippy --all-features --lib -- -D warnings
- name: Build docs
run: cargo doc --no-deps
- name: Check dependencies (cargo-deny)
uses: EmbarkStudios/cargo-deny-action@34899fc7ba81ca6268d5947a7a16b4649013fea1 with:
command: check
continue-on-error: true
- name: Run benchmarks (non-blocking)
run: cargo bench -- --test
continue-on-error: true
- name: Summary
if: always()
run: |
echo "## Rust CI Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "This job runs the following checks (see step output for pass/fail):" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "- Compile (all targets, all features)" >> $GITHUB_STEP_SUMMARY
echo "- Unit tests (default features)" >> $GITHUB_STEP_SUMMARY
echo "- Unit tests (no default features)" >> $GITHUB_STEP_SUMMARY
echo "- Compile (tests, no default features)" >> $GITHUB_STEP_SUMMARY
echo "- Property tests (256 cases)" >> $GITHUB_STEP_SUMMARY
echo "- Integration tests" >> $GITHUB_STEP_SUMMARY
echo "- Formatting" >> $GITHUB_STEP_SUMMARY
echo "- Clippy (default features)" >> $GITHUB_STEP_SUMMARY
echo "- Clippy (no default features, lib)" >> $GITHUB_STEP_SUMMARY
echo "- Clippy (all features, lib)" >> $GITHUB_STEP_SUMMARY
echo "- Docs" >> $GITHUB_STEP_SUMMARY
msrv:
name: MSRV (Rust 1.85.0)
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
- name: Install Rust toolchain (MSRV)
uses: dtolnay/rust-toolchain@4be9e76fd7c4901c61fb841f559994984270fce7 with:
toolchain: 1.85.0
components: rustfmt, clippy
- name: Cache cargo
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-msrv-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-msrv-
- name: Compile (all targets, all features)
run: cargo test --all-targets --all-features --no-run
- name: Run unit tests (library)
run: cargo test --lib --all-features
- name: Run integration smoke tests
run: cargo test --test integration_export
- name: Check formatting
run: cargo fmt --check
- name: Run clippy
run: cargo clippy --lib --all-features -- -D warnings