name: Test
on:
push:
branches:
- main
pull_request:
jobs:
test:
name: cargo test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Cache dependencies installed with cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Check Spelling
uses: crate-ci/typos@v1.23.3
- run: cargo fmt -- --check
- run: cargo test --all-targets --all-features && cargo test --all-features --doc
- run: cargo clippy --all-targets --all-features -- -D warnings
auto-merge:
needs: test
runs-on: ubuntu-latest
if: github.actor == 'dependabot[bot]'
permissions:
pull-requests: write
contents: write
steps:
- name: Enable auto-merge for Dependabot PRs
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}