name: CI
on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
jobs:
fmt-clippy-test:
name: fmt • clippy • test (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install system dependencies
run: |
if [ -x "$(command -v apt-get)" ]; then
sudo apt-get update
sudo apt-get install -y liblo-dev pkg-config
elif [ -x "$(command -v brew)" ]; then
brew update
brew install liblo
fi
- name: Install stable Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- name: Install nightly Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
profile: minimal
override: false
- name: Add nightly rustfmt component
run: rustup component add --toolchain nightly rustfmt
- name: Cache cargo registry
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-registry-
- name: Cache cargo build
uses: actions/cache@v3
with:
path: target
key: ${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-build-
- name: cargo fmt check (nightly)
run: cargo +nightly fmt --all -- --check
- name: cargo clippy (stable)
run: cargo clippy --all-targets --all-features
- name: Run tests (stable)
run: cargo test --all