Skip to content

Commit

Permalink
workflow dependencies. Install alsa
Browse files Browse the repository at this point in the history
  • Loading branch information
subalterngames committed Aug 19, 2024
1 parent d234ef7 commit 562f9cd
Showing 1 changed file with 26 additions and 19 deletions.
45 changes: 26 additions & 19 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,24 @@ 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: Lint
name: cargo fmt && cargo clippy
runs-on: ubuntu-latest
needs: apt
steps:
- uses: actions/checkout@v4

Expand All @@ -33,10 +47,6 @@ jobs:
components: rustfmt
override: true

# Install the required dependencies
- name: Install test dependencies
run: sudo apt install clang cmake speech-dispatcher libspeechd-dev pkg-config libssl-dev alsa librust-alsa-sys-dev -y

# Cargo fmt
- uses: actions-rs/cargo@v1
with:
Expand All @@ -49,28 +59,21 @@ jobs:
command: clippy
args: --all-targets --features speech_dispatcher_0_11

# Run test check on Linux, macOS, and Windows
# Run test check on Linux, macOS, and Windows,
test:
name: 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:
# Checkout the branch being tested
- uses: actions/checkout@v4

# Install rust stable
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable

# Install the required dependencies on Ubuntu
- name: Install test dependencies
run: sudo apt install clang cmake speech-dispatcher libspeechd-dev pkg-config libssl-dev alsa librust-alsa-sys-dev -y
if: ${{ contains(matrix.os, 'ubuntu') }}

# Test for Ubuntu 20.04. Copy a valid speechd.conf file and then test.
- name: Test
run: |
Expand All @@ -83,17 +86,21 @@ jobs:
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 mac
# 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 xvfb -y
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
if: matrix.os == 'ubuntu-24.04'

0 comments on commit 562f9cd

Please sign in to comment.