name: fmt
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: "Install Rust"
uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- name: Codegen
run: |
source $HOME/.cargo/env
cd codegen ; cargo run
- name: Check formatting in codegen
run: |
source $HOME/.cargo/env
cd codegen ; cargo +nightly fmt --all -- --check
- name: Check formatting at top
run: |
source $HOME/.cargo/env
cargo +nightly fmt --all -- --check || true
# If there are any differences in the working copy, then
# they must be uncommitted code/formatting changes
git diff-index HEAD