Build & Test #123
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: Build & Test | |
on: | |
push: | |
branches: [master] | |
paths: ['**.rs', '**.toml', '**.yml'] | |
pull_request: | |
branches: [master, next] | |
paths: ['**.rs', '**.toml', '**.yml'] | |
schedule: | |
- cron: '0 0 1 * *' # Run at the start of the 1st day of every month | |
jobs: | |
# NOTE: I'm leaving this with no descriptive name so it is not too long in the list of jobs. | |
# Previously I assigned a name of "Check building & testing" which resulted in entries like: | |
# "Check building & testing (ubuntu-20.04, stable, false)" and "stable" was barely visible. | |
test: | |
runs-on: ${{ matrix.os }} | |
continue-on-error: ${{ matrix.experimental }} | |
strategy: | |
fail-fast: false | |
matrix: | |
# Use the Ubuntu Focal (20.04) environment, which uses PA v13.99.1 | |
os: [ubuntu-22.04] | |
rustc: | |
- 1.70.0 # Overall MSRV (Minimum supported rust version), including glib's requirement | |
- stable | |
- beta | |
# Allow failure? | |
experimental: [false] | |
# Skip running unit tests? | |
skip-unit-tests: [false] | |
# Skip compiling the glib-related crate? (Used when it has higher MSRV than us) | |
skip-glib-crate: [false] | |
include: | |
# Nightly test - must be allowed to fail | |
- os: ubuntu-22.04 | |
rustc: nightly | |
experimental: true | |
skip-unit-tests: false | |
skip-glib-crate: false | |
# Minimal MSRV test - Our actual MSRV, excluding glib crate (often needs newer version) | |
- os: ubuntu-22.04 | |
rustc: 1.56.0 | |
experimental: false | |
skip-unit-tests: true | |
skip-glib-crate: true | |
env: | |
# Version feature flags to test with `cargo check` | |
# | |
PA_BUILD_VERSIONS: "pa_v15 pa_v14 pa_v13 pa_v12 pa_v8 pa_v6" | |
# Single feature flag to use for `cargo test` steps | |
PA_TEST_VERSION: pa_v15 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Install toolchain | |
run: | | |
rustup toolchain install ${{ matrix.rustc }} --profile minimal --no-self-update | |
rustup default ${{ matrix.rustc }} | |
echo CARGO_TERM_COLOR=always >> $GITHUB_ENV | |
echo RUST_BACKTRACE=1 >> $GITHUB_ENV | |
rustc -V | |
cargo -V | |
- name: Install PulseAudio and `libpulse-dev` | |
run: | | |
sudo apt-get update | |
sudo apt-get install pulseaudio libpulse-mainloop-glib0 libpulse-dev | |
- name: Start PulseAudio | |
run: | | |
systemctl --user start pulseaudio | |
systemctl --user status pulseaudio | |
- name: Check building main binding (cargo check) | |
working-directory: ./pulse-binding | |
run: | | |
for PA_VERSION in $PA_BUILD_VERSIONS; do | |
echo "::group::${PA_VERSION}" | |
echo "Building with version feature flag '${PA_VERSION}'" | |
cargo check --verbose --no-default-features --features $PA_VERSION | |
echo "::endgroup::" | |
done | |
echo "::group::no-features" | |
echo "Building with no version feature flag and no-default-features" | |
cargo check --verbose --no-default-features | |
echo "::endgroup::" | |
- name: Check building simple binding (cargo check) | |
working-directory: ./pulse-binding-simple | |
run: | | |
for PA_VERSION in $PA_BUILD_VERSIONS; do | |
echo "::group::${PA_VERSION}" | |
echo "Building with version feature flag '${PA_VERSION}'" | |
cargo check --verbose --no-default-features --features $PA_VERSION | |
echo "::endgroup::" | |
done | |
echo "::group::no-features" | |
echo "Building with no version feature flag and no-default-features" | |
cargo check --verbose --no-default-features | |
echo "::endgroup::" | |
- name: Check building glib binding (cargo check) | |
if: ${{ matrix.skip-glib-crate == false }} | |
working-directory: ./pulse-binding-mainloop-glib | |
run: | | |
for PA_VERSION in $PA_BUILD_VERSIONS; do | |
echo "::group::${PA_VERSION}" | |
echo "Building with version feature flag '${PA_VERSION}'" | |
cargo check --verbose --no-default-features --features $PA_VERSION | |
echo "::endgroup::" | |
done | |
echo "::group::no-features" | |
echo "Building with no version feature flag and no-default-features" | |
cargo check --verbose --no-default-features | |
echo "::endgroup::" | |
- name: Test main binding | |
if: ${{ matrix.skip-unit-tests == false }} | |
working-directory: ./pulse-binding | |
run: | | |
echo "Testing with version feature flag '${PA_TEST_VERSION}'" | |
cargo test --verbose --features $PA_TEST_VERSION | |
- name: Test simple binding | |
if: ${{ matrix.skip-unit-tests == false }} | |
working-directory: ./pulse-binding-simple | |
run: | | |
echo "Testing with version feature flag '${PA_TEST_VERSION}'" | |
cargo test --verbose --features $PA_TEST_VERSION | |
- name: Test glib binding | |
if: ${{ matrix.skip-unit-tests == false && matrix.skip-glib-crate == false }} | |
working-directory: ./pulse-binding-mainloop-glib | |
run: | | |
echo "Testing with version feature flag '${PA_TEST_VERSION}'" | |
cargo test --verbose --features $PA_TEST_VERSION |