Skip to content

Commit

Permalink
ci: integrate Clippy with GitHub CodeQL, run it for every feat combo
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexTMjugador committed Jul 28, 2024
1 parent b55c307 commit 052d4b4
Showing 1 changed file with 32 additions and 4 deletions.
36 changes: 32 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,40 @@ jobs:
with:
tool: cargo-nono

- name: Install cargo-hack
if: matrix.conf == 'nightly'
uses: taiki-e/install-action@v2
with:
tool: cargo-hack

- name: Install clippy-sarif
if: matrix.conf == 'nightly'
uses: taiki-e/install-action@v2
with:
tool: clippy-sarif

- name: Install sarif-fmt
if: matrix.conf == 'nightly'
uses: taiki-e/install-action@v2
with:
tool: sarif-fmt

- name: Run rustfmt
if: matrix.conf == 'nightly'
run: cargo fmt --check --verbose -- --color=always

- name: Run linter
- name: Run linter for all feature combinations
if: matrix.conf == 'nightly'
run: cargo clippy
run: >
cargo hack clippy --no-deps --all-targets --feature-powerset --message-format=json -- -D warnings
| clippy-sarif
| tee clippy-results.sarif
| sarif-fmt
- name: Run tests
run: make zopfli && make test

- name: Run tests (no-std)
if: matrix.conf == 'nightly'
run: cargo test --release --no-default-features --features nightly

# The documentation generation command should match what's defined on
Expand All @@ -74,11 +95,18 @@ jobs:
run: cargo doc --all-features

- name: Check effective no_std compatibility
if: matrix.conf == 'nightly'
run: |
# Temporarily drop the binary crate so that cargo nono does not
# get confused about what crate to analyze: we are only interested
# in the library one
sed -i 's;^bin = ;#&;' Cargo.toml
rm src/main.rs
cargo nono check --no-default-features --features gzip,zlib
- name: Upload analysis results to GitHub
uses: github/codeql-action/upload-sarif@v3
if: always() && matrix.conf == 'nightly'
continue-on-error: true
with:
sarif_file: clippy-results.sarif
category: clippy

0 comments on commit 052d4b4

Please sign in to comment.