Tooling: criterion benchmarks + fuzz targets, audit job, and CI additions #97
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [main, master] | |
| tags: | |
| - "v*" | |
| - "copc-core-v*" | |
| - "copc-reader-v*" | |
| - "copc-writer-v*" | |
| pull_request: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ci-${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| CARGO_TERM_COLOR: always | |
| RUSTFLAGS: -D warnings | |
| jobs: | |
| checks: | |
| name: Checks | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install Rust | |
| run: rustup toolchain install 1.91.0 --profile minimal --component rustfmt,clippy --no-self-update | |
| - name: Cache Rust artifacts | |
| uses: Swatinem/rust-cache@v2 | |
| - name: Check formatting | |
| run: cargo fmt --all -- --check | |
| - name: Run Clippy | |
| run: cargo clippy --workspace --all-targets --all-features --locked -- -D warnings | |
| - name: Run tests (default features) | |
| run: cargo test --workspace --locked | |
| - name: Run tests (all features) | |
| run: cargo test --workspace --all-features --locked | |
| - name: Compile benchmarks | |
| run: cargo bench --workspace --no-run --locked | |
| docs: | |
| name: Documentation | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install Rust | |
| run: rustup toolchain install 1.91.0 --profile minimal --component rustfmt,clippy --no-self-update | |
| - name: Cache Rust artifacts | |
| uses: Swatinem/rust-cache@v2 | |
| - name: Build documentation | |
| run: cargo doc --workspace --no-deps --locked | |
| env: | |
| RUSTDOCFLAGS: -D warnings | |
| msrv: | |
| name: MSRV | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install Rust | |
| run: rustup toolchain install 1.77.0 --profile minimal --no-self-update | |
| - name: Cache Rust artifacts | |
| uses: Swatinem/rust-cache@v2 | |
| - name: Check workspace | |
| run: rustup run 1.77.0 cargo check --workspace --all-targets --locked | |
| package: | |
| name: Packaging | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install Rust | |
| run: rustup toolchain install 1.91.0 --profile minimal --component rustfmt,clippy --no-self-update | |
| - name: Cache Rust artifacts | |
| uses: Swatinem/rust-cache@v2 | |
| - name: Fetch dependencies | |
| run: cargo fetch --locked | |
| - name: Verify crate packages | |
| run: cargo package --workspace --locked | |
| - name: Verify publish dry run | |
| run: cargo publish --workspace --dry-run --locked | |
| audit: | |
| name: Dependency audit | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install cargo-audit | |
| uses: taiki-e/install-action@v2 | |
| with: | |
| tool: cargo-audit | |
| - name: Audit dependencies | |
| run: cargo audit | |
| fuzz: | |
| name: Fuzz smoke | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install Rust nightly | |
| run: | | |
| rustup toolchain install nightly --profile minimal --no-self-update | |
| rustup target add x86_64-unknown-linux-gnu --toolchain nightly | |
| - name: Install cargo-fuzz | |
| uses: taiki-e/install-action@v2 | |
| with: | |
| tool: cargo-fuzz | |
| - name: Cache Rust artifacts | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| workspaces: fuzz | |
| # Pin the gnu target: cargo-fuzz otherwise defaults to statically linked | |
| # musl, which is incompatible with the address sanitizer. | |
| - name: Fuzz COPC open | |
| run: cargo +nightly fuzz run copc_open --target x86_64-unknown-linux-gnu -- -max_total_time=60 | |
| env: | |
| RUSTFLAGS: "" | |
| - name: Fuzz COPC point reads | |
| run: cargo +nightly fuzz run copc_points --target x86_64-unknown-linux-gnu -- -max_total_time=60 | |
| env: | |
| RUSTFLAGS: "" |