rust-tts-wrapper 1.6.2

Cross-platform TTS wrapper with C API — mirrors js-tts-wrapper / SwiftTTSWrapper
Documentation
name: Test Suite

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

jobs:
  test:
    name: Test Suite
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, windows-latest, macos-latest]
        rust: [stable]

    steps:
    - uses: actions/checkout@v4

    - name: Install Rust toolchain
      uses: actions-rust-lang/setup-rust-toolchain@v1
      with:
        toolchain: ${{ matrix.rust }}

    - name: Install Linux system dependencies
      if: matrix.os == 'ubuntu-latest'
      run: sudo apt-get update && sudo apt-get install -y libspeechd-dev libclang-dev

    - name: Select feature set per platform
      # `sapi` only builds on Windows; `avsynth` only on macOS; sherpa-onnx
      # has intermittent 504 download failures on the GitHub Actions runners
      # (see TODO.md). Use a per-platform feature set that gives us reliable
      # CI signal; sherpa-onnx is covered by a separate allow-failure job
      # below.
      shell: bash
      run: |
        case "${{ matrix.os }}" in
          ubuntu-latest)  echo "FEATURES=--no-default-features --features system,cloud" >> $GITHUB_ENV ;;
          windows-latest) echo "FEATURES=--no-default-features --features sapi,cloud,sherpaonnx" >> $GITHUB_ENV ;;
          macos-latest)   echo "FEATURES=--no-default-features --features avsynth,cloud,sherpaonnx" >> $GITHUB_ENV ;;
        esac

    - name: Run tests
      run: cargo test ${{ env.FEATURES }} --verbose

    - name: Run FFI safety tests
      run: cargo test ${{ env.FEATURES }} --test ffi_safety --verbose

  coverage:
    name: Code Coverage
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v4

    - name: Install Rust toolchain
      uses: actions-rust-lang/setup-rust-toolchain@v1
      with:
        toolchain: stable

    - name: Install Linux system dependencies
      run: sudo apt-get update && sudo apt-get install -y libspeechd-dev libclang-dev

    - name: Install tarpaulin
      run: cargo install cargo-tarpaulin

    - name: Generate coverage
      run: |
        cargo tarpaulin --out Xml --no-default-features --features system,cloud,sherpaonnx --verbose

    - name: Upload coverage
      uses: codecov/codecov-action@v4
      with:
        file: ./cobertura.xml
        fail_ci_if_error: false