feat: trigger #5
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] | |
| pull_request: | |
| branches: [main] | |
| types: [opened, synchronize, reopened, ready_for_review] | |
| merge_group: | |
| env: | |
| CARGO_TERM_COLOR: always | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| # ---------------------------------------------------------------------------- | |
| # Format (nightly rustfmt) | |
| # ---------------------------------------------------------------------------- | |
| fmt: | |
| name: Format | |
| runs-on: ubuntu-latest | |
| if: ${{ github.event_name != 'pull_request' || github.event.pull_request.draft == false }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: rustfmt | |
| - name: Install nightly rustfmt | |
| run: | | |
| rustup toolchain install nightly --profile=minimal | |
| rustup component add --toolchain nightly rustfmt | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: fmt-check | |
| run: cargo +nightly fmt --all --check | |
| # ---------------------------------------------------------------------------- | |
| # Sort (cargo-sort) | |
| # ---------------------------------------------------------------------------- | |
| sort: | |
| name: Sort | |
| runs-on: ubuntu-latest | |
| if: ${{ github.event_name != 'pull_request' || github.event.pull_request.draft == false }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: Install cargo-sort | |
| uses: taiki-e/install-action@v2 | |
| with: | |
| tool: cargo-sort | |
| - name: sort-check | |
| run: cargo sort --workspace --check | |
| # ---------------------------------------------------------------------------- | |
| # Clippy | |
| # ---------------------------------------------------------------------------- | |
| clippy: | |
| name: Clippy | |
| runs-on: ubuntu-latest | |
| if: ${{ github.event_name != 'pull_request' || github.event.pull_request.draft == false }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: clippy | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: Install system dependencies | |
| run: sudo apt-get update && sudo apt-get install -y --no-install-recommends libclang-dev pkg-config | |
| - name: clippy | |
| run: cargo clippy --all-targets --all-features | |
| # ---------------------------------------------------------------------------- | |
| # Tests (runs only if linting passed) | |
| # ---------------------------------------------------------------------------- | |
| test: | |
| name: Tests | |
| runs-on: ubuntu-latest | |
| needs: [fmt, sort, clippy] | |
| if: ${{ github.event_name != 'pull_request' || github.event.pull_request.draft == false }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: Install system dependencies | |
| run: sudo apt-get update && sudo apt-get install -y --no-install-recommends libclang-dev pkg-config | |
| - name: test | |
| run: cargo test --tests | |
| # ---------------------------------------------------------------------------- | |
| # Docs (build with warnings as errors) | |
| # ---------------------------------------------------------------------------- | |
| docs: | |
| name: Docs | |
| runs-on: ubuntu-latest | |
| if: ${{ github.event_name != 'pull_request' || github.event.pull_request.draft == false }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: Install system dependencies | |
| run: sudo apt-get update && sudo apt-get install -y --no-install-recommends libclang-dev pkg-config | |
| - name: Build docs | |
| run: cargo doc --all --no-deps --document-private-items | |
| env: | |
| RUSTDOCFLAGS: "-D warnings" | |
| # ---------------------------------------------------------------------------- | |
| # Security: cargo-deny | |
| # ---------------------------------------------------------------------------- | |
| deny: | |
| name: Deny | |
| runs-on: ubuntu-latest | |
| if: ${{ github.event_name != 'pull_request' || github.event.pull_request.draft == false }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Install cargo-deny | |
| uses: taiki-e/install-action@v2 | |
| with: | |
| tool: cargo-deny | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: cargo deny | |
| run: cargo deny check | |
| # ---------------------------------------------------------------------------- | |
| # Security: cargo-audit | |
| # ---------------------------------------------------------------------------- | |
| audit: | |
| name: Audit | |
| runs-on: ubuntu-latest | |
| if: ${{ github.event_name != 'pull_request' || github.event.pull_request.draft == false }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Install cargo-audit | |
| uses: taiki-e/install-action@v2 | |
| with: | |
| tool: cargo-audit | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: cargo audit | |
| run: cargo audit --deny warnings --ignore RUSTSEC-2025-0055 --ignore RUSTSEC-2024-0388 --ignore RUSTSEC-2024-0436 |