From 6c20c622f3db4717053e3735fbe686e53fbe9051 Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Mon, 25 Oct 2021 09:40:51 +0200 Subject: [PATCH] ci: check code formats Use a job to check the format of the sourcecode with `cargo fmt` command. The new step does not change any code, but returns an error when `check` does not pass with 0 issues. --- .github/workflows/build.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4f6592f..fe464f0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -274,3 +274,28 @@ jobs: # with: # name: 'ouch-x86_64-pc-windows-gnu' # path: target\x86_64-pc-windows-gnu\release\ouch.exe + + fmt: + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + runs-on: ${{ matrix.os }} + + steps: + - name: Checkout sources + uses: actions/checkout@v2 + + - name: Install toolchain + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: nightly + target: x86_64-unknown-linux-musl + components: rustfmt + override: true + + - name: Check format with cargo fmt + uses: actions-rs/cargo@v1 + with: + command: fmt + args: --all -- --check