name: Rust
on:
push:
pull_request:
workflow_dispatch:
permissions:
contents: read
concurrency:
group: rust-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: "-C target-cpu=generic"
jobs:
test:
name: ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- windows-latest
- macos-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- name: Install Linux system dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y pkg-config libfontconfig1-dev
- name: Cache Cargo
uses: Swatinem/rust-cache@v2
with:
key: rust-${{ matrix.os }}
- name: Run Rust tests
run: cargo test --release --all-targets
- name: Run Rust doc tests
run: cargo test --release --doc