dig-store-cache 0.1.1

On-disk LRU (pluggable-policy), pin-aware, crash-safe cache of already-verified DIG `.dig` capsules for the DIG Node — the cache + reshare leg of the content-replication flywheel.
Documentation
name: CI

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

permissions:
  contents: read

concurrency:
  group: ci-${{ github.ref }}
  cancel-in-progress: true

env:
  CARGO_TERM_COLOR: always

jobs:
  test:
    name: Format / Clippy / Test / Docs
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Install Rust toolchain
        uses: dtolnay/rust-toolchain@stable
        with:
          toolchain: stable
          components: rustfmt, clippy

      - name: Cache dependencies
        uses: Swatinem/rust-cache@v2

      - name: Install cargo-nextest
        uses: taiki-e/install-action@nextest

      - name: Check formatting
        run: cargo fmt --all --check

      - name: Check clippy
        run: cargo clippy --locked --all-targets -- -D warnings

      # nextest retries a failing test up to 2x and reports failed-then-passed as flaky (surfaced in
      # the run summary) rather than hiding it (flaky-test management #489).
      - name: Run tests
        run: cargo nextest run --locked --all --retries 2

      - name: Build (release)
        run: cargo build --locked --release

      - name: Check documentation
        run: cargo doc --locked --no-deps

  coverage:
    name: Coverage (>=80% lines)
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Install Rust toolchain
        uses: dtolnay/rust-toolchain@stable
        with:
          toolchain: stable
          components: llvm-tools-preview

      - name: Cache dependencies
        uses: Swatinem/rust-cache@v2

      - name: Install cargo-llvm-cov
        uses: taiki-e/install-action@cargo-llvm-cov

      - name: Install cargo-nextest
        uses: taiki-e/install-action@nextest

      # Unit + integration (scenario) coverage, CI-gated at >=80% lines (ecosystem standard #157). The
      # whole orchestrator — range planning + scheduler, per-range + whole-resource verify, source
      # health/backoff, provider relocate, pause/resume + resume-state, and the .download.tmp staging +
      # GC — is exercised over the in-memory harness (mock DHT providers + mock range sources + in-memory
      # sink + temp-dir file sinks, NO real network). No file is excluded from the gate. Runs via
      # nextest (--retries 2) so a flaky test is retried + reported rather than silently failing CI
      # (flaky-test management #489).
      - name: Run tests with coverage (gate >=80% lines)
        run: >-
          cargo llvm-cov nextest --locked --all
          --retries 2
          --fail-under-lines 80
          --lcov --output-path lcov.info

      - name: Upload coverage report
        uses: actions/upload-artifact@v4
        with:
          name: lcov-coverage
          path: lcov.info
          if-no-files-found: error