workflow dependencies. Install alsa #131
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: test | |
on: | |
push: | |
branches-ignore: | |
- main | |
paths-ignore: | |
- "doc/**" | |
- ".vscode/**" | |
- "html/**" | |
- "data/**" | |
- "promo/**" | |
- "py/**" | |
- "**.md" | |
# Make sure CI fails on all warnings, including Clippy lints | |
env: | |
RUSTFLAGS: "-Dwarnings" | |
jobs: | |
apt: | |
name: ubuntu-latest apt install | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: true | |
matrix: | |
os: [ubuntu-24.04, ubuntu-22.04, ubuntu-20.04] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: awalsh128/cache-apt-pkgs-action@latest | |
with: | |
packages: clang cmake speech-dispatcher libspeechd-dev pkg-config libssl-dev alsa librust-alsa-sys-dev | |
version: 1.0 | |
# Check for formatting and clippy | |
lint: | |
name: cargo fmt && cargo clippy | |
runs-on: ubuntu-latest | |
needs: apt | |
steps: | |
- uses: actions/checkout@v4 | |
# Setup Rust toolchain | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
components: rustfmt | |
override: true | |
# Cargo fmt | |
- uses: actions-rs/cargo@v1 | |
with: | |
command: fmt | |
args: --all -- --check | |
# Cargo clippy | |
- uses: actions-rs/cargo@v1 | |
with: | |
command: clippy | |
args: --all-targets --features speech_dispatcher_0_11 | |
# Run test check on Linux, macOS, and Windows, | |
test: | |
name: cargo test | |
needs: lint | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: true | |
matrix: | |
os: [ubuntu-24.04, ubuntu-22.04, ubuntu-20.04, macOS-14, macOS-13, macOS-12, windows-latest] | |
steps: | |
# Install rust stable | |
- uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: stable | |
# Test for Ubuntu 20.04. Copy a valid speechd.conf file and then test. | |
- name: Test | |
run: | | |
sudo cp test_files/ubuntu20.04/speechd.conf /etc/speech-dispatcher/speechd.conf | |
cargo test --all --features speech_dispatcher_0_9 -- --nocapture | |
if: matrix.os == 'ubuntu-20.04' | |
# Test for Ubuntu 22.04 | |
- name: Test | |
run: cargo test --all --features speech_dispatcher_0_11 -- --nocapture | |
if: matrix.os == 'ubuntu-22.04' || matrix.os == 'ubuntu-24.04' | |
# Test for Windows and MacOS. | |
- name: Test | |
run: cargo test --all -- --nocapture | |
if: ${{ !contains(matrix.os, 'ubuntu') }} | |
# Run windowed tests. | |
windowed_test: | |
needs: test | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
steps: | |
- name: Test events | |
env: | |
SOUNDFONTS_DIRECTORY: $HOME/Documents/cacophony/soundfonts | |
run: | | |
mkdir -p ${{ env.SOUNDFONTS_DIRECTORY }} | |
cp -r test_files/soundfonts/* ${{ env.SOUNDFONTS_DIRECTORY }} | |
sudo apt install alsa-utils xvfb -y | |
for f in test_files/events/*.txt ; do echo "Quit\nQuitPanelYes" >> $f && xvfb-run cargo run -- --events $f ; done |