name: Lint
on:
pull_request:
merge_group:
push:
branches: [main]
env:
CARGO_TERM_COLOR: always
permissions: {}
jobs:
clippy:
name: Run clippy on crates
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd with:
persist-credentials: false
- name: Set up Rust
run: |
rustup toolchain install 1.85.0 --profile minimal --component clippy
rustup default 1.85.0
- uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 with:
cache-on-failure: true
- run: cargo clippy --examples --tests --benches --all-features --all-targets --locked
env:
RUSTFLAGS: -D warnings
fmt:
name: Check code formatting
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd with:
persist-credentials: false
- name: Set up Rust
run: |
rustup toolchain install 1.85.0 --profile minimal --component rustfmt
rustup default 1.85.0
- run: cargo fmt --all --check
taplo:
name: Lint and check formatting of TOML files
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd with:
persist-credentials: false
- name: Install taplo
run: |
curl -fsSL https://github.com/tamasfe/taplo/releases/latest/download/taplo-full-linux-x86_64.gz \
| gzip -d - | install -m 755 /dev/stdin /usr/local/bin/taplo
- name: Run taplo lint
run: |
taplo lint
- name: Run taplo format check
run: |
taplo fmt --check
lint-success:
name: Check that lints passed
runs-on: ubuntu-latest
if: always()
needs:
- clippy
- fmt
- taplo
timeout-minutes: 30
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe with:
jobs: ${{ toJSON(needs) }}