name: Format Check
on:
push:
branches:
- '**'
pull_request:
branches:
- main
- 'release/**'
permissions:
contents: read
concurrency:
group: format-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
jobs:
format_check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- name: Install Rust
uses: dtolnay/rust-toolchain@6c977a6ca4077a0ceb28ffbe03f59d46e9ac8772
id: toolchain
with:
toolchain: stable
components: rustfmt, clippy
- name: Cache Rust dependencies
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-fmt-${{ steps.toolchain.outputs.cachekey }}-${{ hashFiles('**/Cargo.toml') }}
restore-keys: |
${{ runner.os }}-fmt-${{ steps.toolchain.outputs.cachekey }}-
- name: Install make
run: sudo apt-get install make
- name: Format check
run: make fmt-check