Skip to content

Commit e5b15f0

Browse files
committed
CI allow nightly clippy warnings
1 parent ad62cd1 commit e5b15f0

File tree

1 file changed

+23
-34
lines changed

1 file changed

+23
-34
lines changed

.github/workflows/ci.yml

Lines changed: 23 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -89,35 +89,32 @@ jobs:
8989
- name: Install dependencies
9090
if: matrix.os == 'ubuntu-latest'
9191
run: sudo bash ./.github/workflows/install-deps.sh
92-
- name: Install Rust nightly (latest and stable date version)
93-
id: install-rust
92+
- name: Install Rust nightly
9493
run: |
95-
STABLE_DATE=$(cargo clippy --version | perl -ne 'print $& if /\b\d{4}-\d{2}-\d{2}\b/')
96-
echo "stable_date=$STABLE_DATE" >> $GITHUB_OUTPUT
97-
9894
rustup toolchain install nightly
9995
rustup component add clippy --toolchain nightly
100-
rustup toolchain install nightly-$STABLE_DATE
101-
rustup component add clippy --toolchain nightly-$STABLE_DATE
102-
103-
echo "Stable version: $(cargo clippy --version)"
104-
echo "Nightly version: $(cargo +nightly clippy --version)"
105-
echo "Near stable nightly version: $(cargo +nightly-$STABLE_DATE clippy --version)"
10696
- name: Restore cargo caches
10797
uses: Swatinem/rust-cache@v2
10898
- name: Run clippy
10999
run: cargo clippy --all-features --tests --examples -- -D warnings
110-
- name: Run clippy nightly-${{ steps.install-rust.outputs.stable_date }} for benches
111-
run: cargo +nightly-${{ steps.install-rust.outputs.stable_date }} clippy --all-features --benches -- -D warnings -A clippy::incompatible_msrv
112-
- name: Run clippy nightly-latest without denying warnings
100+
- name: Run clippy nightly
113101
run: |
114102
cargo +nightly clippy --all-features --tests --examples
115103
116-
echo "## clippy nightly output" >> $GITHUB_STEP_SUMMARY
117-
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
118-
# Run it again so there is no noise like "Compiling xxx" and "Checking xxx" in the output.
119-
CARGO_TERM_COLOR=never cargo +nightly clippy --all-features --tests --examples 2>> $GITHUB_STEP_SUMMARY
120-
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
104+
WARNS=$(cargo +nightly clippy --all-features --tests --examples --message-format=json | jq -s '[.[] | select(.reason == "compiler-message")] | length')
105+
echo "test $WARNS"
106+
if [[ $WARNS -ne 0 ]]; then
107+
echo "::warning title=nightly clippy::Detected $WARNS warnings"
108+
fi
109+
- name: Run clippy nightly for benches
110+
run: |
111+
cargo +nightly clippy --all-features --benches -- -A clippy::incompatible_msrv
112+
113+
WARNS=$(cargo +nightly clippy --all-features --benches --message-format=json -- -A clippy::incompatible_msrv | jq -s '[.[] | select(.reason == "compiler-message")] | length')
114+
echo "test $WARNS"
115+
if [[ $WARNS -ne 0 ]]; then
116+
echo "::warning title=nightly clippy::Detected $WARNS warnings"
117+
fi
121118
122119
check:
123120
strategy:
@@ -158,26 +155,18 @@ jobs:
158155
run: ./.github/workflows/disable-bench-deps.sh
159156
- name: Install dependencies
160157
run: sudo bash ./.github/workflows/install-deps.sh
161-
- name: Install Rust nightly (stable date version)
162-
id: install-rust
163-
run: |
164-
STABLE_DATE=$(rustdoc --version | perl -ne 'print $& if /\b\d{4}-\d{2}-\d{2}\b/')
165-
echo "stable_date=$STABLE_DATE" >> $GITHUB_OUTPUT
166-
167-
rustup toolchain install nightly-$STABLE_DATE
168-
169-
echo "Stable version: $(rustdoc --version)"
170-
echo "Near stable nightly version: $(rustdoc +nightly-$STABLE_DATE --version)"
158+
- name: Install Rust nightly
159+
run: rustup toolchain install nightly
171160
- name: Restore cargo caches
172161
uses: Swatinem/rust-cache@v2
173-
- name: Run rustdoc nightly-${{ steps.install-rust.outputs.stable_date }}
162+
- name: Run rustdoc nightly
174163
run: |
175164
cd spdlog
176-
cargo +nightly-${{ steps.install-rust.outputs.stable_date }} rustdoc --verbose -- -D warnings -A rustdoc::broken-intra-doc-links
177-
cargo +nightly-${{ steps.install-rust.outputs.stable_date }} rustdoc --all-features --verbose -- -D warnings
165+
cargo +nightly rustdoc --verbose -- -D warnings -A rustdoc::broken-intra-doc-links
166+
cargo +nightly rustdoc --all-features --verbose -- -D warnings
178167
cd ../spdlog-macros
179-
cargo +nightly-${{ steps.install-rust.outputs.stable_date }} rustdoc --verbose -- -D warnings -A rustdoc::broken-intra-doc-links
180-
cargo +nightly-${{ steps.install-rust.outputs.stable_date }} rustdoc --all-features --verbose -- -D warnings
168+
cargo +nightly rustdoc --verbose -- -D warnings -A rustdoc::broken-intra-doc-links
169+
cargo +nightly rustdoc --all-features --verbose -- -D warnings
181170
182171
check-msrv:
183172
strategy:

0 commit comments

Comments
 (0)