From 29280b9821f65264c4a6f0c0c921c9a2d12b48aa Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Wed, 14 Jul 2021 22:19:40 +0100 Subject: [PATCH 1/3] CI: Add workflow that runs general lints --- .github/workflows/lints.yml | 43 +++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .github/workflows/lints.yml diff --git a/.github/workflows/lints.yml b/.github/workflows/lints.yml new file mode 100644 index 000000000..bfb99ebdb --- /dev/null +++ b/.github/workflows/lints.yml @@ -0,0 +1,43 @@ +name: Lints + +# We only run these lints on trial-merges of PRs to reduce noise. +on: pull_request + +jobs: + general-lints: + name: General + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Include guards + run: ./test/lint/lint-include-guards.sh + if: always() + + - name: Includes + run: ./test/lint/lint-includes.sh + if: always() + + - name: Locale dependence + run: ./test/lint/lint-locale-dependence.sh + if: always() + + - name: Python UTF-8 encoding + run: ./test/lint/lint-python-utf8-encoding.sh + if: always() + + - name: Shebang + run: ./test/lint/lint-shebang.sh + if: always() + + - name: Shell locale + run: ./test/lint/lint-shell-locale.sh + if: always() + + - name: Shellcheck + run: ./test/lint/lint-shell.sh + if: always() + + - name: Whitespace + run: ./test/lint/lint-whitespace.sh + if: always() From b54b416d68f223fab81f6f1739db8cfc91ad52af Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Wed, 14 Jul 2021 22:34:01 +0100 Subject: [PATCH 2/3] CI: Check scripted diffs --- .github/workflows/lints.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/lints.yml b/.github/workflows/lints.yml index bfb99ebdb..264b326a5 100644 --- a/.github/workflows/lints.yml +++ b/.github/workflows/lints.yml @@ -4,6 +4,17 @@ name: Lints on: pull_request jobs: + commit-script-check: + name: Scripted diffs + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + ref: ${{ github.event.pull_request.head.sha }} + - name: Check scripted diffs + run: ./test/lint/commit-script-check.sh ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} + general-lints: name: General runs-on: ubuntu-latest From 4026386cacf8ac11b9e482bc62303559e176c6ca Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Wed, 14 Jul 2021 23:06:44 +0100 Subject: [PATCH 3/3] CI: Add Rust lints --- .github/workflows/lints.yml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/.github/workflows/lints.yml b/.github/workflows/lints.yml index 264b326a5..d97c4722c 100644 --- a/.github/workflows/lints.yml +++ b/.github/workflows/lints.yml @@ -52,3 +52,35 @@ jobs: - name: Whitespace run: ./test/lint/lint-whitespace.sh if: always() + + rust-clippy: + name: Clippy (1.51.0) + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + toolchain: 1.51.0 + components: clippy + override: true + - name: Run clippy + uses: actions-rs/clippy-check@v1 + with: + name: Clippy (1.51.0) + token: ${{ secrets.GITHUB_TOKEN }} + args: --all-features --all-targets -- -D warnings + + rustfmt: + name: Rustfmt + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + toolchain: 1.51.0 + override: true + - run: rustup component add rustfmt + - uses: actions-rs/cargo@v1 + with: + command: fmt + args: -- --check