ruststft 0.4.0

Short-time Fourier transform (STFT) and inverse STFT: streaming and batch spectrograms, a rich window library, mel spectrograms and MFCCs.
Documentation
name: CI

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

env:
  CARGO_TERM_COLOR: always
  RUSTFLAGS: "-D warnings"

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

  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 --all-features
      # The FFT processors (and thus examples/tests/benches) need `std`, so
      # lint only the library for the no_std subsets.
      - run: cargo clippy --lib --no-default-features
      - run: cargo clippy --lib --no-default-features --features mel,serde

  test:
    name: test (${{ matrix.rust }})
    runs-on: ubuntu-latest
    strategy:
      matrix:
        rust: [stable, "1.85"]
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@master
        with:
          toolchain: ${{ matrix.rust }}
      - uses: Swatinem/rust-cache@v2
      - run: cargo test --all-features
      - run: cargo test # default features

  no_std:
    name: no_std build
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
        with:
          targets: thumbv7em-none-eabihf
      - run: cargo build --no-default-features --features mel,serde --target thumbv7em-none-eabihf

  docs:
    name: doc
    runs-on: ubuntu-latest
    env:
      RUSTDOCFLAGS: "-D warnings --cfg docsrs"
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@nightly
      - run: cargo doc --all-features --no-deps

  deny:
    name: cargo-deny
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: EmbarkStudios/cargo-deny-action@v2

  coverage:
    name: coverage
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
        with:
          components: llvm-tools-preview
      - uses: taiki-e/install-action@cargo-llvm-cov
      - uses: Swatinem/rust-cache@v2
      - run: cargo llvm-cov --all-features --lcov --output-path lcov.info
      - uses: codecov/codecov-action@v4
        with:
          files: lcov.info
          fail_ci_if_error: false

  dependencies:
    name: Dependency Submission
    runs-on: ubuntu-latest
    if: github.event_name == 'push' && github.ref == 'refs/heads/main'
    permissions:
      contents: write
    steps:
      - name: Checkout
        uses: actions/checkout@v6

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

      - name: Cache Cargo artifacts
        uses: Swatinem/rust-cache@v2

      - name: Install cargo-sbom
        uses: psastras/sbom-rs/actions/install-cargo-sbom@cargo-sbom-v0.10.0

      - name: Generate SBOM
        run: cargo-sbom --output-format=spdx_json_2_3 > sbom.json

      - name: Upload SBOM as artifact
        uses: actions/upload-artifact@v4
        with:
          name: sbom
          path: sbom.json

      - name: Submit dependencies to GitHub
        uses: advanced-security/spdx-dependency-submission-action@v0.2.0
        with:
          filePath: sbom.json

  fuzz:
    name: fuzz smoke
    runs-on: ubuntu-latest
    # cargo-fuzz / libFuzzer require the nightly compiler (sanitizer flags).
    # Clear the global `-D warnings` so it does not interfere with the
    # instrumentation flags cargo-fuzz injects.
    env:
      RUSTFLAGS: ""
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@nightly
      - uses: taiki-e/install-action@v2
        with:
          tool: cargo-fuzz
      - uses: Swatinem/rust-cache@v2
        with:
          workspaces: fuzz
      # Pin the gnu target: the prebuilt cargo-fuzz is musl-static, whose
      # default target conflicts with the sanitizer (statically linked libc).
      - name: Build fuzz targets
        run: cargo fuzz build --target x86_64-unknown-linux-gnu
      - name: Smoke-run each target
        run: |
          for target in stft_roundtrip stft_config window; do
            cargo fuzz run "$target" --target x86_64-unknown-linux-gnu -- -max_total_time=60 -print_final_stats=1
          done