name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
format:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Run cargo fmt
run: |
cargo fmt --all -- --check
check:
runs-on: ubuntu-22.04
needs:
- format
strategy:
matrix:
toolchain:
- stable
- 1.61.0 target:
- x86_64-unknown-linux-gnu
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ matrix.target }}-${{ matrix.toolchain }}-${{ hashFiles('**/Cargo.toml') }}
- name: Install toolchain
run: |
rustup toolchain install ${{ matrix.toolchain }} --target ${{ matrix.target }} --component clippy
- name: Install cargo-check-all
run: |
cargo install --force cargo-all-features
- name: Run cargo check
run: |
cargo check-all-features --target ${{ matrix.target }} ${{ matrix.features }}
test:
runs-on: ubuntu-22.04
needs:
- check
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ matrix.target }}-${{ matrix.toolchain }}-${{ hashFiles('**/Cargo.toml') }}
- name: Run cargo test
run: |
cargo test