opticaldiscs 0.14.0

Format-agnostic optical disc image reading and filesystem browsing (ISO, BIN/CUE, CHD)
name: CI

# Build-integrity pipeline. Runs on every branch push and pull request, and is
# reusable (workflow_call) so the release pipeline can gate on the exact same
# checks before tagging/publishing.
on:
  push:
    branches: ['**']
  pull_request:
  workflow_call:

env:
  CARGO_TERM_COLOR: always

jobs:
  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@v5
      - uses: dtolnay/rust-toolchain@stable
      - name: Set default toolchain
        run: rustup default stable
      - uses: Swatinem/rust-cache@v2
        with:
          prefix-key: v1-rust-0.3
      - name: Build
        run: cargo build --all-features
      - name: Test
        run: cargo test --all-features
      - name: Test (default features)
        run: cargo test
      # The decoupled build: no libchdman-rs in the dependency graph at all, so
      # this leg is what proves targets that can't build/fetch MAME's C++ CHD
      # core (vintage/cross: i486, PPC, macOS 10.7) still get the rest of the
      # crate. `--no-default-features` drops `chd`, which is in `default`.
      - name: Test (no features — no CHD / no libchdman-rs)
        run: cargo test --no-default-features
      # `toc` without `chd` is a real consumer combination and gates
      # `build_chd_toc` on both features; keep it compiling.
      - name: Test (toc + drives, no CHD)
        run: cargo test --no-default-features --features toc,drives

  lint:
    name: Lint
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v5
      - uses: dtolnay/rust-toolchain@stable
        with:
          components: rustfmt, clippy
      - name: Set default toolchain
        run: rustup default stable
      - uses: Swatinem/rust-cache@v2
        with:
          prefix-key: v1-rust-0.3
      - name: Format check
        run: cargo fmt --check
      - name: Clippy
        run: cargo clippy --all-features -- -D warnings
      # Feature-gating mistakes (unused imports, dead code) only show up in the
      # build that omits the feature, so lint that configuration too.
      - name: Clippy (no features — no CHD)
        run: cargo clippy --no-default-features -- -D warnings

  docs:
    name: Docs
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v5
      - uses: dtolnay/rust-toolchain@stable
      - name: Set default toolchain
        run: rustup default stable
      - uses: Swatinem/rust-cache@v2
        with:
          prefix-key: v1-rust-0.3
      - name: Check docs
        run: cargo doc --all-features --no-deps