Skip to content

Commit

Permalink
build: run clippy for powerset of features
Browse files Browse the repository at this point in the history
This will catch compiler & clippy warnings in all feature combinations.

We should probably use cargo hack for build and test as well, but,
that's quite expensive and would add to overall CI wait times.

obsoletes #4073
refs #4070
  • Loading branch information
problame committed Apr 25, 2023
1 parent 7f80230 commit 567efd4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
14 changes: 12 additions & 2 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,18 @@ jobs:
- name: Get postgres headers
run: make postgres-headers -j$(nproc)

- name: Run cargo clippy
run: ./run_clippy.sh
- uses: taiki-e/install-action@cargo-hack

# cargo hack runs the given cargo subcommand (clippy in this case) for all feature combinations.
# This will catch compiler & clippy warnings in all feature combinations.
# TODO: use cargo hack for build and test as well, but, that's quite expensive.
# NB: keep clippy args in sync with ./run_clippy.sh
- run: |
echo "CLIPPY_COMMON_ARGS=--locked --workspace --all-targets -- -A unknown_lints -D warning" >> $GITHUB_ENV
- name: Run cargo clippy (debug)
run: cargo hack --feature-powerset clippy $CLIPPY_COMMON_ARGS
- name: Run cargo clippy (release)
run: cargo hack --feature-powerset clippy $CLIPPY_COMMON_ARGS --release

# Use `${{ !cancelled() }}` to run quck tests after the longer clippy run
- name: Check formatting
Expand Down
5 changes: 5 additions & 0 deletions run_clippy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,9 @@
# * `-A unknown_lints` – do not warn about unknown lint suppressions
# that people with newer toolchains might use
# * `-D warnings` - fail on any warnings (`cargo` returns non-zero exit status)

# NB: the CI runs the full feature powerset, so, it catches slightly more errors
# at the expense of longer runtime. This script is used by developers, so, don't
# do that here.
# NB: keep the args after the `--` in sync with the CI YAMLs.
cargo clippy --locked --all --all-targets --all-features -- -A unknown_lints -D warnings

0 comments on commit 567efd4

Please sign in to comment.