Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: run clippy for powerset of features #4077

Merged
merged 6 commits into from
Apr 27, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
problame marked this conversation as resolved.
Show resolved Hide resolved

# 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
problame marked this conversation as resolved.
Show resolved Hide resolved
- 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
koivunej marked this conversation as resolved.
Show resolved Hide resolved

# 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