flac-io 0.1.1

Pure-Rust FLAC decoder and encoder for reading and writing lossless audio samples
Documentation
name: CI

on:
  push:
    branches: [main, master, dev]
  pull_request:

# Cancel any in-progress run on the same branch when a new push arrives.
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

env:
  CARGO_TERM_COLOR: always
  RUST_BACKTRACE: 1
  CARGO_INCREMENTAL: 0      # no incremental cache in CI — fresh builds only
  CARGO_NET_RETRY: 10       # retry on flaky network
  RUSTUP_MAX_RETRIES: 10

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@v4
      - uses: dtolnay/rust-toolchain@stable
      - uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 # v2.7.8
        with:
          cache-on-failure: true   # cache even failed builds so retries are fast
      - run: cargo test --locked --all-features
      - run: cargo run --locked --example smoke

  msrv:
    name: MSRV (1.74)
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      # Version ref selects the exact MSRV toolchain; not a moving branch.
      - uses: dtolnay/rust-toolchain@1.74.0
      - uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 # v2.7.8
        with:
          cache-on-failure: true
      - run: cargo check --locked --lib

  clippy:
    name: Clippy
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
        with:
          components: clippy
      - uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 # v2.7.8
        with:
          cache-on-failure: true
      - run: cargo clippy --locked --all-targets --all-features -- -D warnings

  fmt:
    name: Rustfmt
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
        with:
          components: rustfmt
      # No cache — rustfmt never compiles, so caching adds overhead with no gain.
      - run: cargo fmt --check

  doc:
    name: Docs
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
      - uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 # v2.7.8
        with:
          cache-on-failure: true
      - run: cargo doc --no-deps --document-private-items
        env:
          RUSTDOCFLAGS: -D warnings

  coverage:
    name: Coverage
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
        with:
          components: llvm-tools-preview
      - uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 # v2.7.8
        with:
          cache-on-failure: true
      # Built from source rather than a third-party install action, to keep
      # the supply-chain surface to first-party actions only.
      - run: cargo install cargo-llvm-cov --locked
      - run: cargo llvm-cov --locked --all-features --fail-under-lines 90