timestretch 0.7.0

Pure Rust audio time stretching library optimized for EDM
Documentation
name: CI

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

env:
  CARGO_TERM_COLOR: always

jobs:
  test:
    name: Test
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
        rust: [stable]
        include:
          - os: ubuntu-latest
            rust: "1.82.0"  # MSRV
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@master
        with:
          toolchain: ${{ matrix.rust }}
      - uses: Swatinem/rust-cache@v2
      # Regression tests read fixtures from test_audio/ (gitignored, *.wav).
      # The generator is deterministic, so regenerate them before testing.
      - run: cargo run --example generate_test_audio
      - run: cargo test --all-targets

  quality-gates:
    name: Quality Gates
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
      - uses: Swatinem/rust-cache@v2
      - run: cargo test --features qa-harnesses --release --test quality_gates -- --nocapture
        env:
          TIMESTRETCH_STRICT_CALLBACK_BUDGET: "1"
          # Shared GitHub runners are a much slower CPU than dev machines, so
          # the pitch path's p99 per-callback ratio sits near 1.0x realtime
          # here vs ~0.5x locally (avg still ~0.07, ~14x headroom). Give the
          # gate hardware headroom on CI; the strict 0.92 default still applies
          # for local runs. A real regression blows past this (avg jumps ~10x).
          TIMESTRETCH_CALLBACK_BUDGET_MULTIPLIER: "2.0"
          TIMESTRETCH_QUALITY_DASHBOARD_DIR: target/quality_dashboard
      # New-engine WCET gate (ROADMAP Stage 6): p99.9 per-callback ratio
      # bounded per profile and callback size, priming and threshold-riding
      # included. Same hardware-headroom multiplier as above (local
      # measurements sit at p99.9 <= 0.21 vs the 0.5 strict bound).
      - run: cargo test --features qa-harnesses --release --test engine_wcet -- --nocapture
        env:
          TIMESTRETCH_STRICT_CALLBACK_BUDGET: "1"
          TIMESTRETCH_CALLBACK_BUDGET_MULTIPLIER: "2.0"
      - uses: actions/upload-artifact@v4
        with:
          name: quality-dashboard-${{ github.run_id }}
          path: target/quality_dashboard/
          if-no-files-found: error

  public-corpus:
    name: Public Corpus (BPM accuracy)
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
      - uses: Swatinem/rust-cache@v2
      # The corpus is CC-licensed netlabel audio fetched from the Internet
      # Archive with pinned SHA-256 (ROADMAP Stage 7). Cached on the fetch
      # script's hash so CI only downloads when the corpus changes.
      - uses: actions/cache@v4
        with:
          path: benchmarks/audio/public-corpus
          key: public-corpus-${{ hashFiles('scripts/fetch_public_corpus.sh') }}
      - run: bash scripts/fetch_public_corpus.sh
      - run: cargo test --features qa-harnesses --release --test bpm_accuracy -- --nocapture
      - uses: actions/upload-artifact@v4
        with:
          name: bpm-accuracy-report-${{ github.run_id }}
          path: target/bpm_accuracy_report.json
          if-no-files-found: error

  clippy:
    name: Clippy
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
        with:
          components: clippy
      - uses: Swatinem/rust-cache@v2
      - run: cargo clippy --all-targets -- -D warnings

  fmt:
    name: Format
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
        with:
          components: rustfmt
      - run: cargo fmt --all --check

  doc:
    name: Documentation
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
      - uses: Swatinem/rust-cache@v2
      - run: cargo doc --no-deps
        env:
          RUSTDOCFLAGS: -D warnings