name: CI
on:
push:
pull_request:
jobs:
build:
runs-on: ubuntu-latest
env:
TOOLCHAIN: stable
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cache cargo registry 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: Set up Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.TOOLCHAIN }}
profile: minimal
components: clippy, rustfmt
override: true
- name: Verify rustc & cargo
run: |
rustc --version
cargo --version
- name: Build
run: cargo build --verbose
- name: Run clippy (optional)
run: cargo clippy -- -D warnings
continue-on-error: false
- name: Run tests
run: cargo test --verbose