From dd6ea90890619a5b81b6aa0f007ca2f41443b65c Mon Sep 17 00:00:00 2001 From: cynecx Date: Mon, 7 Dec 2020 22:16:20 +0100 Subject: [PATCH] github-actions: add rustfmt job --- .github/workflows/workspace.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.github/workflows/workspace.yml b/.github/workflows/workspace.yml index b7c73285..0d48de82 100644 --- a/.github/workflows/workspace.yml +++ b/.github/workflows/workspace.yml @@ -9,6 +9,24 @@ on: # - "**.md" jobs: + fmt: + name: fmt + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install Rust toolchain + run: cargo + - name: Install rustfmt + run: rustup component add rustfmt + # Check fmt + - name: "rustfmt --check" + # Workaround for rust-lang/cargo#7732 + run: | + if ! rustfmt --check --edition 2018 $(find ./src -name '*.rs' -print); then + printf "Please run \`rustfmt --edition 2018 \$(find . -name '*.rs' -print)\` to fix rustfmt errors.\n" >&2 + exit 1 + fi + build: name: Build strategy: