webrtc-audio-processing 2.0.1

A wrapper for WebRTC's AudioProcessing module.
name: Rust

on:
  push:
    branches:
      - main
  pull_request:

jobs:
  test:
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os:
          - ubuntu-latest
          - macos-latest
        features:
          - bundled
          - bundled,serde,strum
          # experimental-aec3-config implicitly activates bundled (build would fail if it doesn't)
          - experimental-aec3-config,schemars,serde,strum

    steps:
      - uses: actions/checkout@v6
        with:
          submodules: recursive
      - uses: dtolnay/rust-toolchain@stable
        with:
          components: clippy
      - name: Install Dependencies (if Ubuntu)
        run: sudo apt-get -y update && sudo apt-get install -f && sudo apt-get -y install pkg-config meson ninja-build
        if: contains(runner.os, 'Linux')
      - name: Install Dependencies (if macos)
        run: brew update && brew install pkg-config meson ninja
        if: contains(runner.os, 'macOS')
      - uses: Swatinem/rust-cache@v2
      - name: Clippy
        run: cargo clippy --features "${{ matrix.features }}" --all-targets -- -D warnings
      - name: Build
        run: cargo build --verbose --features "${{ matrix.features }}"
      - name: Test
        # we have tests even in examples, --all-targets ensures they are run
        run: cargo test --verbose --features "${{ matrix.features }}" --all-targets

  test-non-bundled:
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        features:
          - ""
          - schemars,serde

    steps:
      - uses: actions/checkout@v6
        # No need for submodules here
      - uses: dtolnay/rust-toolchain@stable
      - name: Install System Dependencies
        run: sudo apt-get -y update && sudo apt-get install -f && sudo apt-get -y install pkg-config meson ninja-build
      - name: Compile webrtc-audio-processing 2.1 library manually
        run: |
          git clone --branch v2.1 https://gitlab.freedesktop.org/pulseaudio/webrtc-audio-processing.git
          cd webrtc-audio-processing
          meson setup build
          ninja -C build
          sudo ninja -C build install
          sudo ldconfig
      - uses: Swatinem/rust-cache@v2
      - name: Clippy
        run: cargo clippy --features "${{ matrix.features }}" --all-targets -- -D warnings
      - name: Build
        run: cargo build --verbose --features "${{ matrix.features }}"
      - name: Test
        run: cargo test --verbose --features "${{ matrix.features }}"

  fmt:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
        with:
          submodules: recursive
      - uses: dtolnay/rust-toolchain@nightly
        with:
          components: rustfmt
      - name: Rustfmt
        run: cargo fmt --all -- --check
      - name: clang-format
        uses: jidicula/clang-format-action@v4.16.0
        with:
          clang-format-version: 13
          check-path: webrtc-audio-processing-sys/src
          fallback-style: Chromium

  doc:
    name: Documentation
    runs-on: ubuntu-latest
    env:
      RUSTDOCFLAGS: -Dwarnings
    steps:
      - uses: actions/checkout@v6
        with:
          submodules: recursive
      - uses: dtolnay/rust-toolchain@nightly
      - uses: dtolnay/install@cargo-docs-rs
      - name: Install System Dependencies
        run: sudo apt-get -y update && sudo apt-get install -f && sudo apt-get -y install pkg-config meson ninja-build
      - run: cargo docs-rs