name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: full
CI: true
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
rust: [stable, nightly]
steps:
- name: Checkout code
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
- name: Set up Rust
uses: dtolnay/rust-toolchain@4360b52568e2003a75bf9bc1d59f33a8e3fc893c
with:
toolchain: ${{ matrix.rust }}
components: rustfmt, clippy
- name: Format check
run: cargo fmt --all -- --check
- name: Clippy check
run: cargo clippy --all-targets --all-features -- -D warnings
- name: Build all features
run: cargo build --verbose --all-features
- name: Check no_std core
run: cargo check --verbose --no-default-features
- name: Check no_std feature matrix
run: cargo check --verbose --no-default-features --features serde,bytes,simd
- name: Test all features
run: cargo test --verbose --all-features
- name: Test doctests
run: cargo test --doc --all-features
- name: Verify layout snapshot
run: cargo test --test layout_snapshot --all-features -- --nocapture
- name: Upload layout artifacts
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 with:
name: layout-${{ matrix.os }}-${{ matrix.rust }}
path: target/layout-artifacts
if-no-files-found: ignore
msrv:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
- name: Set up Rust 1.95
uses: dtolnay/rust-toolchain@4360b52568e2003a75bf9bc1d59f33a8e3fc893c
with:
toolchain: 1.95
- name: Check packaged consumer matrix
shell: bash
run: bash scripts/check-msrv-package.sh 1.95
documentation:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
- name: Set up stable Rust
uses: dtolnay/rust-toolchain@4360b52568e2003a75bf9bc1d59f33a8e3fc893c
with:
toolchain: stable
- name: Build default documentation
run: RUSTDOCFLAGS="-D warnings" cargo doc --lib --no-deps
- name: Build all-feature documentation
run: RUSTDOCFLAGS="-D warnings" cargo doc --lib --no-deps --all-features
repository-contracts:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
- name: Run repository contracts
run: python -m unittest discover -s scripts/tests -v
performance-contracts:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
- name: Set up stable Rust
uses: dtolnay/rust-toolchain@4360b52568e2003a75bf9bc1d59f33a8e3fc893c
with:
toolchain: stable
- name: Verify allocation contracts
run: cargo test --test allocation_contract --all-features -- --test-threads=1
- name: Capture shared-backing evidence
shell: bash
run: |
cargo bench --bench shared_backing -- __allocation_evidence_only__ --noplot 2>&1 |
tee target/allocation-evidence.log
- name: Verify shared-backing evidence
run: python scripts/verify-allocation-evidence.py target/allocation-evidence.log
layout-32-bit:
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
- name: Set up stable Rust with 32-bit target
uses: dtolnay/rust-toolchain@4360b52568e2003a75bf9bc1d59f33a8e3fc893c
with:
toolchain: stable
targets: i686-pc-windows-msvc
- name: Verify 32-bit compact layout
run: cargo test --target i686-pc-windows-msvc --test layout_snapshot --all-features -- --nocapture
dependency-audit:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
- name: Set up stable Rust
uses: dtolnay/rust-toolchain@4360b52568e2003a75bf9bc1d59f33a8e3fc893c
with:
toolchain: stable
- name: Install dependency auditor
run: cargo install cargo-audit --version 0.22.2 --locked
- name: Audit locked dependencies
run: cargo audit -D warnings