faultbox 0.1.2

Production black-box recorder: structured crash, corruption, and invariant-violation reports with a flight-recorder breadcrumb trail — debuggable from a report without reproduction or shipped symbols.
Documentation
# Reusable test workflow: fmt, clippy, docs, audit, and the full test suite.
#
# Called by:
#   - ci.yml              (PR checks)
#   - release-prepare.yml (tag gate)
#
# Cache strategy: the Linux jobs share one `target/` cache via
# `shared-key: workspace`. The `lint` job seeds it on a cold run; the Linux
# `test`, `features`, and `msrv` jobs then start warm. macOS and Windows keep
# their own caches — a different target triple cannot reuse those artifacts.
#
# Every feature is off by default and each pulls in its own dependency tree, so
# the feature matrix exists to catch the combination that only breaks when a
# feature is *absent* — a `cfg`-gated import, or a struct field that only some
# builds have.

name: Test

on:
  workflow_call:

permissions:
  contents: read

env:
  CARGO_TERM_COLOR: always
  RUST_BACKTRACE: 1

jobs:
  # ─────────────────────────────────────────────────────────────────────────
  lint:
    name: Lint, Docs & Audit
    # Free ARM64 runner for public repos: faster per-core than ubuntu-latest at
    # the same (zero) cost. Safe here because this job only compiles — the
    # crash/minidump tests that are most architecture-sensitive run in `test`.
    runs-on: ubuntu-24.04-arm
    steps:
      - uses: actions/checkout@v7

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

      - uses: Swatinem/rust-cache@v2
        with:
          shared-key: workspace

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

      - name: Run clippy
        run: cargo clippy --all-targets --all-features -- -D warnings

      - name: Build docs
        run: cargo doc --no-deps --all-features
        env:
          RUSTDOCFLAGS: -D warnings

      # nextest does not run doctests, and the examples document a crate whose
      # misuse fork-bombs the host, so they are kept compiling.
      - name: Run doctests
        run: cargo test --doc --all-features

      - name: Install cargo-deny
        uses: taiki-e/install-action@v2
        with:
          tool: cargo-deny

      - name: Dependency audit
        run: cargo deny check

  # ─────────────────────────────────────────────────────────────────────────
  # The suite spawns real child processes: a crash monitor that re-execs the
  # helper binary, several processes contending for a file lock, and several
  # writing one mmap'd ring. Those behave differently per OS, so all three run
  # the full suite rather than compile-checking the non-Linux ones.
  #
  # `--no-fail-fast` so one regression surfaces every failure in a single run.
  test:
    name: Test (${{ matrix.os }})
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
    steps:
      - uses: actions/checkout@v7

      - name: Install Rust
        uses: dtolnay/rust-toolchain@stable

      - uses: Swatinem/rust-cache@v2
        with:
          shared-key: test-${{ matrix.os }}

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

      # No retries by design — these tests assert counts, so a retry would hide
      # a concurrency bug rather than absorb a slow runner. See
      # .config/nextest.toml.
      - name: Run tests
        run: cargo nextest run --all-features --no-fail-fast

  # ─────────────────────────────────────────────────────────────────────────
  # `wasm32-unknown-unknown` has no clock: `SystemTime::now()` panics there
  # rather than returning an error. Since a breadcrumb is recorded on ordinary
  # success paths, a regression in that fallback would make merely linking this
  # crate into a wasm build fatal — hence a standing check.
  wasm:
    name: WASM / WASI check (${{ matrix.target }})
    runs-on: ubuntu-24.04-arm
    strategy:
      fail-fast: false
      matrix:
        target: [wasm32-unknown-unknown, wasm32-wasip1]
    steps:
      - uses: actions/checkout@v7

      - name: Install Rust + target
        uses: dtolnay/rust-toolchain@stable
        with:
          targets: ${{ matrix.target }}

      - uses: Swatinem/rust-cache@v2
        with:
          shared-key: wasm-${{ matrix.target }}

      # Default features only: `native-crash` and `shared-ring` are host-only.
      - name: cargo check --lib
        run: cargo check --target ${{ matrix.target }} --lib

  # ─────────────────────────────────────────────────────────────────────────
  features:
    name: Feature matrix (${{ matrix.flags || 'default' }})
    runs-on: ubuntu-24.04-arm
    strategy:
      fail-fast: false
      matrix:
        flags:
          - ""
          - "--features tracing"
          - "--features shared-ring"
          - "--features native-crash"
          - "--all-features"
    steps:
      - uses: actions/checkout@v7

      - name: Install Rust
        uses: dtolnay/rust-toolchain@stable

      - uses: Swatinem/rust-cache@v2
        with:
          shared-key: workspace

      - name: cargo check
        run: cargo check --lib --bins --tests ${{ matrix.flags }}

  # ─────────────────────────────────────────────────────────────────────────
  # The declared `rust-version` must actually build. 1.88 is required by this
  # crate's own let-chains as well as by the native-crash dependency tree.
  msrv:
    name: MSRV
    runs-on: ubuntu-24.04-arm
    steps:
      - uses: actions/checkout@v7

      - name: Install Rust
        uses: dtolnay/rust-toolchain@1.88.0

      - uses: Swatinem/rust-cache@v2
        with:
          shared-key: msrv

      - name: cargo check
        run: cargo check --all-features --all-targets

  # ─────────────────────────────────────────────────────────────────────────
  # Catches manifest problems that only surface at publish time: a missing
  # README, or an `exclude`d file that something still references.
  package:
    name: Package
    runs-on: ubuntu-24.04-arm
    steps:
      - uses: actions/checkout@v7

      - name: Install Rust
        uses: dtolnay/rust-toolchain@stable

      - uses: Swatinem/rust-cache@v2
        with:
          shared-key: workspace

      - name: cargo package
        run: cargo package --all-features