persistent-queue 0.1.1

A durable, at-least-once MPSC queue backed by in-memory and durable backends (sled, redb).
Documentation
name: CI

on:
  push:
    branches: [main]
  pull_request:

env:
  CARGO_TERM_COLOR: always
  RUST_BACKTRACE: 1

jobs:
  # Gate the Rust jobs on Rust changes, so docs-only changes skip lint and test.
  changes:
    name: Detect changes
    runs-on: ubuntu-latest
    outputs:
      rust: ${{ steps.filter.outputs.rust }}
    steps:
      - uses: actions/checkout@v7
      - uses: dorny/paths-filter@v4
        id: filter
        with:
          filters: |
            rust:
              - '**/*.rs'
              - '**/Cargo.toml'
              - 'Cargo.lock'
              - 'deny.toml'
              - '.github/workflows/ci.yml'

  lint:
    name: Lint
    needs: changes
    if: needs.changes.outputs.rust == 'true'
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
      - uses: dtolnay/rust-toolchain@stable
        with:
          components: clippy, rustfmt
      - uses: Swatinem/rust-cache@v2
      - name: Check formatting
        run: cargo fmt --all --check
      - name: Run clippy
        run: cargo clippy --all-targets --all-features --locked -- -D warnings

  test:
    name: Test and coverage
    needs: changes
    if: needs.changes.outputs.rust == 'true'
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
      - uses: dtolnay/rust-toolchain@stable
        with:
          components: llvm-tools-preview
      - uses: Swatinem/rust-cache@v2
      - uses: taiki-e/install-action@v2
        with:
          tool: cargo-llvm-cov
      - name: Test and collect coverage
        run: |
          cargo llvm-cov --all-features --locked --lcov --output-path lcov.info
          cargo llvm-cov report --summary-only --fail-under-lines 80
      - name: Upload coverage to Codecov
        uses: codecov/codecov-action@v7
        with:
          files: lcov.info
          token: ${{ secrets.CODECOV_TOKEN }}

  # Model-check the queue's lock and condvar handoff for lost wakeups and deadlock.
  loom:
    name: Loom
    needs: changes
    if: needs.changes.outputs.rust == 'true'
    runs-on: ubuntu-latest
    env:
      RUSTFLAGS: "--cfg loom"
      LOOM_MAX_PREEMPTIONS: "3"
    steps:
      - uses: actions/checkout@v7
      - uses: dtolnay/rust-toolchain@stable
      - uses: Swatinem/rust-cache@v2
      - name: Run loom model checks
        run: cargo test --test loom --release

  # Check the in-memory path for undefined behavior and data races.
  miri:
    name: Miri
    needs: changes
    if: needs.changes.outputs.rust == 'true'
    runs-on: ubuntu-latest
    env:
      MIRIFLAGS: "-Zmiri-disable-isolation"
    steps:
      - uses: actions/checkout@v7
      - uses: dtolnay/rust-toolchain@nightly
        with:
          components: miri
      - uses: Swatinem/rust-cache@v2
      - name: Run tests under Miri
        run: cargo miri test

  # Scan the dependency tree for security advisories, disallowed licenses, and
  # non-crates.io sources (config in deny.toml).
  deny:
    name: Dependencies
    needs: changes
    if: needs.changes.outputs.rust == 'true'
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
      - uses: taiki-e/install-action@v2
        with:
          tool: cargo-deny
      - name: Check dependencies
        run: cargo deny check

  # Spelling runs on everything, including docs.
  typos:
    name: Typos
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
      - uses: crate-ci/typos@v1

  # Conventional Commits check for pull requests (advisory; direct pushes to main are
  # covered by a local commit-msg hook - see CONTRIBUTING.md).
  commits:
    name: Commit messages
    if: github.event_name == 'pull_request'
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
        with:
          fetch-depth: 0
      # Dependabot commit messages are auto-generated and can exceed the length
      # rules; exempt them (keyed on PR author so maintainer re-runs stay stable).
      - if: github.event.pull_request.user.login != 'dependabot[bot]'
        uses: crate-ci/committed@v1.1.11