-
Notifications
You must be signed in to change notification settings - Fork 8
101 lines (87 loc) · 2.96 KB
/
test.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
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:
# Check for formatting and clippy
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Setup Rust toolchain
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
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:
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: Test
runs-on: ${{ matrix.os }}
timeout-minutes: 10
strategy:
fail-fast: true
matrix:
os: [ubuntu-24.04, ubuntu-22.04, ubuntu-20.04, macOS-14, macOS-13, macOS-12, windows-latest]
steps:
- 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: |
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') }}
# Windowed application tests.
- 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
sudo modprobe snd-dummy
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'