diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 046430e..f9ab285 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -120,6 +120,47 @@ jobs: . "$HOME/.cargo/env" cargo clippy --all-targets -- -D warnings + fmt: + name: Rustfmt + runs-on: ubuntu-latest + container: + image: ubuntu:25.10 + steps: + - name: Install git + run: | + apt-get update + apt-get install -y git curl + + - uses: actions/checkout@v4 + + - name: Install build dependencies + run: ./scripts/shepherd deps install build + + - name: Add rustfmt component + run: | + . "$HOME/.cargo/env" + rustup component add rustfmt + + - name: Add Rust to PATH + run: echo "$HOME/.cargo/bin" >> $GITHUB_PATH + + - name: Cache cargo registry and build + uses: actions/cache@v4 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + target + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo- + + - name: Check formatting + run: | + . "$HOME/.cargo/env" + cargo fmt --all + git diff --exit-code + shellcheck: name: ShellCheck runs-on: ubuntu-latest diff --git a/AGENTS.md b/AGENTS.md index 54a6d78..8db49b6 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -2,7 +2,9 @@ Agents: please use the existing documentation for setup. describes environment setup and build, test, and lint, including helper scripts and exact commands. -Please ensure that your changes build and pass tests and lint. If you changed the example configuration at , make sure that it passes config validation. +Please ensure that your changes build and pass tests and lint, and run `cargo fmt --all` to match your changes to the rest of the code. + +If you changed the example configuration at , make sure that it passes config validation. Each of the Rust crates in contains a README.md that describes each at a high level.