name: Build and Test
on:
pull_request:
push:
branches:
- main
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
test:
name: test (${{ matrix.os }})
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
toolchain: [stable]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Install ALSA dev headers
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y libasound2-dev
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.toolchain }}
- name: Cache Cargo
uses: Swatinem/rust-cache@v2
- name: Configure virtual ALSA output
if: runner.os == 'Linux'
run: |
cat > "$RUNNER_TEMP/asound.conf" <<'EOF'
pcm.!default {
type null
}
EOF
echo "ALSA_CONFIG_PATH=$RUNNER_TEMP/asound.conf" >> "$GITHUB_ENV"
- name: Run tests
run: cargo test --workspace --all-features -- --skip test_audio_output_creation --skip test_audio_output_write
- name: Run audio output tests
if: runner.os == 'Linux'
run: cargo test --test audio_output --all-features