name: Tests
on:
push:
branches:
- main
pull_request:
branches:
- main
defaults:
run:
shell: bash
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
fail-fast: false
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust
run: bash .github/workflows/scripts/install-rust.sh stable ${{ matrix.target }}
- name: Cache cargo dependencies and build
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Install dependencies (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y dbus-x11
- name: Build
run: cargo build --all-features
- name: Run tests (Linux)
if: matrix.os == 'ubuntu-latest'
run: dbus-launch cargo test --all-features
- name: Run tests (Windows & macOS)
if: matrix.os != 'ubuntu-latest'
run: cargo test --all-features