on:
pull_request:
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: install dependencies
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: valgrind libudev-dev libc6-dbg
version: 1.0
- name: install rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
- name: install cargo commands
uses: taiki-e/install-action@v2
with:
tool: cargo-nextest,cargo-machete,taplo
- name: checkout
uses: actions/checkout@v5
with:
ref: ${{ github.head_ref }}
fetch-depth: ${{ github.event.pull_request.commits }}
- name: check formatting
if: ${{github.event_name == 'pull_request'}}
run: |
commits=$(git log --format=%H -n ${{ github.event.pull_request.commits }})
for commit in $commits; do
git checkout --force $commit
cargo fmt --check
taplo fmt --check
done
git checkout --force ${{ github.head_ref }}
- name: check for unused dependencies
run: cargo machete
- name: run clippy
run: cargo clippy
- name: run tests
run: cargo nextest run --release
- name: run doctests
run: cargo test --doc --release