Skip to content

Commit

Permalink
github/workflows: print clippy output in case of errors
Browse files Browse the repository at this point in the history
In the `unsafe-check` job, if `cargo clippy` fails, we don't have any
log since we are redirecting the stderr to a file to count the number
of undocumented unsafe blocks.

We don't expect it to fail, since other steps in `check` job should
check this case, but it has happened in some cases.

Print the file content in case of `cargo clippy` returns with error,
so we can debug better CI failures.

Reported-by: Oliver Steffen <osteffen@redhat.com>
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
  • Loading branch information
stefano-garzarella committed Feb 25, 2025
1 parent 035bb52 commit 8464f40
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ jobs:

- name: Clippy with undocumented_unsafe_blocks for PR branch
run: |
cargo clippy --workspace --all-features --exclude packit --exclude stage1 --exclude svsm-fuzz --exclude igvmbuilder --exclude igvmmeasure --quiet -- -W clippy::undocumented_unsafe_blocks 2> clippy_warnings_pr.txt
cargo clippy --workspace --all-features --exclude packit --exclude stage1 --exclude svsm-fuzz --exclude igvmbuilder --exclude igvmmeasure --quiet -- -W clippy::undocumented_unsafe_blocks 2> clippy_warnings_pr.txt || cat clippy_warnings_pr.txt
# Required because after the next checkout everything is removed.
- name: Upload PR warnings artifact
Expand All @@ -169,7 +169,7 @@ jobs:

- name: Clippy with undocumented_unsafe_blocks for base branch
run: |
cargo clippy --workspace --all-features --exclude packit --exclude stage1 --exclude svsm-fuzz --exclude igvmbuilder --exclude igvmmeasure --quiet -- -W clippy::undocumented_unsafe_blocks 2> clippy_warnings_base.txt
cargo clippy --workspace --all-features --exclude packit --exclude stage1 --exclude svsm-fuzz --exclude igvmbuilder --exclude igvmmeasure --quiet -- -W clippy::undocumented_unsafe_blocks 2> clippy_warnings_base.txt || cat clippy_warnings_base.txt
- name: Download PR warnings artifact
uses: actions/download-artifact@v4
Expand Down

0 comments on commit 8464f40

Please sign in to comment.