name: CI
on:
workflow_dispatch:
push:
pull_request:
schedule:
- cron: "20 4 * * *"
jobs:
build:
name: Build and Test (${{ matrix.mode }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
mode: [debug, release]
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache Cargo registry
uses: actions/cache@v4
with:
path: ~/.cargo/registry/index
key: cargo-registry-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
cargo-registry-${{ runner.os }}-
- name: Cache Cargo dependencies
uses: actions/cache@v4
with:
path: ~/.cargo/registry/cache
key: cargo-deps-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
cargo-deps-${{ runner.os }}-
- name: Cache Cargo git dependencies
uses: actions/cache@v4
with:
path: ~/.cargo/git
key: cargo-git-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
cargo-git-${{ runner.os }}-
- name: Cache build artifacts
uses: actions/cache@v4
with:
path: target
key: cargo-target-${{ matrix.mode }}-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
cargo-target-${{ matrix.mode }}-${{ runner.os }}-
- name: Cache cargo tools
uses: actions/cache@v4
with:
path: ~/.cargo/bin
key: cargo-tools-${{ runner.os }}-binstall-outdated
restore-keys: |
cargo-tools-${{ runner.os }}-
- name: Check dependencies (${{ matrix.mode }})
run: make check-deps MODE=${{ matrix.mode }}
- name: Lint (${{ matrix.mode }})
run: make lint MODE=${{ matrix.mode }}
- name: Build (${{ matrix.mode }})
run: make build MODE=${{ matrix.mode }}
- name: Run unit tests (${{ matrix.mode }})
run: cargo test --all-features ${{ matrix.mode == 'release' && '--release' || '' }}
- name: Build docs
run: make docs