audio-engine-core 0.1.0

Reusable decoder, DSP, loudness, resampling, and streaming pipeline primitives
Documentation
name: CI

# Continuous integration for the standalone `audio-engine-core` crate.
# Runs format/lint/doc checks plus a cross-platform test matrix that exercises
# the native libsoxr dependency on each OS.

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

env:
  CARGO_TERM_COLOR: always
  RUST_BACKTRACE: 1

jobs:
  # Fast feedback: formatting, lints, and documentation on a single platform.
  lint:
    name: fmt + clippy + doc
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Install libsoxr
        run: sudo apt-get update && sudo apt-get install -y libsoxr-dev

      - name: Install Rust toolchain
        uses: dtolnay/rust-toolchain@stable
        with:
          components: rustfmt, clippy

      - uses: Swatinem/rust-cache@v2

      - name: rustfmt
        run: cargo fmt --all -- --check

      - name: clippy (all features)
        run: cargo clippy --all-targets --all-features -- -D warnings

      - name: clippy (no default features)
        run: cargo clippy --all-targets --no-default-features -- -D warnings

      # Mirror the docs.rs build. libsoxr-sys skips its pkg-config probe when
      # DOCS_RS is set and ships pregenerated FFI bindings, so doc builds need
      # no system libsoxr -- we set DOCS_RS here to verify that path stays green.
      - name: doc (docs.rs parity)
        env:
          DOCS_RS: "1"
          RUSTDOCFLAGS: "-D warnings"
        run: cargo doc --no-deps --all-features

  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

      - name: Install libsoxr (Linux)
        if: runner.os == 'Linux'
        run: sudo apt-get update && sudo apt-get install -y libsoxr-dev

      - name: Install libsoxr (macOS)
        if: runner.os == 'macOS'
        run: brew install libsoxr

      # libsoxr-sys probes the native library with pkg-config only (no vcpkg
      # support), so on Windows we provide soxr + pkgconf via MSYS2/MinGW. The
      # crate stays on the default MSVC toolchain; build.rs turns the MinGW DLL
      # into an MSVC import library with gendef + lib.exe (hence the tools pkg).
      - name: Set up MSYS2 with soxr + pkg-config (Windows)
        if: runner.os == 'Windows'
        uses: msys2/setup-msys2@v2
        id: msys2
        with:
          msystem: MINGW64
          update: false
          install: >-
            mingw-w64-x86_64-libsoxr
            mingw-w64-x86_64-pkgconf
            mingw-w64-x86_64-tools

      - name: Expose MSYS2 soxr to the MSVC build (Windows)
        if: runner.os == 'Windows'
        shell: pwsh
        run: |
          $mingw = "${{ steps.msys2.outputs.msys2-location }}\mingw64"
          "$mingw\bin" | Out-File -FilePath $env:GITHUB_PATH -Append -Encoding utf8
          "PKG_CONFIG_PATH=$mingw\lib\pkgconfig" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8

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

      - uses: Swatinem/rust-cache@v2

      - name: Build
        run: cargo build --all-features

      - name: Test (all features)
        run: cargo test --all-features

      - name: Test (no default features)
        run: cargo test --no-default-features

  # Verify the crate packages cleanly the same way `cargo publish` would.
  package:
    name: package (publish dry-run)
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Install libsoxr
        run: sudo apt-get update && sudo apt-get install -y libsoxr-dev

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

      - uses: Swatinem/rust-cache@v2

      - name: cargo package
        run: cargo package --all-features