timestretch 0.8.1

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]
        # "pinned" = the toolchain in rust-toolchain.toml (same compiler
        # as local builds); the MSRV row overrides it via the dtolnay
        # action's RUSTUP_TOOLCHAIN env var.
        rust: [pinned]
        include:
          - os: ubuntu-latest
            rust: "1.85.0"  # MSRV
    steps:
      - uses: actions/checkout@v4
      - if: matrix.rust == 'pinned'
        run: rustup toolchain install
      - if: matrix.rust != 'pinned'
        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
      # Installs the pinned toolchain + components from rust-toolchain.toml.
      - run: rustup toolchain install
      - uses: Swatinem/rust-cache@v2
      # The engine A/B matrix is the quality dashboard: absolute gates
      # re-derived from new-engine measurements at Stage 9 (the old
      # engine's quality_gates suite was deleted with the old engine).
      - run: cargo test --features qa-harnesses --release --test engine_ab_matrix -- --nocapture
        env:
          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
      - run: rustup toolchain install
      - 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
      # 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 --features qa-harnesses --release --test bpm_accuracy -- --nocapture
      # External-reference gate (ROADMAP Stage 7, REQUIRED): the pull
      # engine's keylock render vs a Rubber Band CLI render of the same
      # public-corpus track, gated on spectral similarity and level.
      - run: sudo apt-get update && sudo apt-get install -y rubberband-cli
      - run: cargo test --features qa-harnesses --release --test rubberband_reference_gate -- --nocapture
        env:
          TIMESTRETCH_REQUIRE_RUBBERBAND: "1"
      - 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
      - run: rustup toolchain install
      - uses: Swatinem/rust-cache@v2
      - run: cargo clippy --all-targets -- -D warnings

  desktop:
    name: Desktop
    # The desktop crate is excluded from the workspace, so the root jobs
    # never build it. macOS is the app's target platform (wgpu -> native
    # Metal) and the only runner that needs no extra system packages for
    # eframe/cpal/rfd.
    runs-on: macos-latest
    steps:
      - uses: actions/checkout@v4
      - run: rustup toolchain install
      - uses: Swatinem/rust-cache@v2
        with:
          workspaces: desktop
      - run: cargo test --all-targets
        working-directory: desktop
      - run: cargo clippy --all-targets -- -D warnings
        working-directory: desktop

  fmt:
    name: Format
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: rustup toolchain install
      - run: cargo fmt --all --check

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