ci: Split Rust lint checks into their own job

This commit is contained in:
TÖRÖK Attila 2024-02-06 04:18:23 +01:00 committed by Nathan Adams
parent 1651b7a5b0
commit 9646c86707
1 changed files with 41 additions and 20 deletions

View File

@ -68,26 +68,6 @@ jobs:
shared-key: "desktop"
save-if: ${{ github.ref == 'refs/heads/master' }}
- name: Check formatting
if: runner.os == 'Linux'
run: cargo fmt --all -- --check
- name: Check clippy
# not critical on other platforms, and slows down Windows
if: runner.os == 'Linux'
# Don't fail the build for clippy on nightly, since we get a lot of false-positives
run: cargo clippy --all --all-features --tests ${{ (matrix.rust_version != 'nightly' && '-- -D warnings') || '' }}
- name: Check licensing and duplicates in used crates
if: ${{ runner.os == 'Linux' && matrix.rust_version == 'stable' }}
uses: EmbarkStudios/cargo-deny-action@v1
- name: Check documentation
if: runner.os == 'Linux'
run: cargo doc --no-deps --all-features
env:
RUSTDOCFLAGS: -D warnings
- name: Install cargo nextest
uses: taiki-e/install-action@v2
with:
@ -116,6 +96,47 @@ jobs:
tests*/**/*.actual*.png
tests*/**/*.difference*.png
lints:
needs: changes
if: needs.changes.outputs.should_run== 'true'
name: Lints with Rust ${{ matrix.rust_version }}
runs-on: ubuntu-22.04
continue-on-error: ${{ matrix.rust_version == 'nightly' || matrix.rust_version == 'beta' }}
strategy:
fail-fast: false
matrix:
rust_version: [stable, beta, nightly]
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.rust_version }}
components: rustfmt, clippy
- name: Install Linux dependencies
run: |
sudo apt-get update
sudo apt install -y libasound2-dev libxcb-shape0-dev libxcb-xfixes0-dev libgtk-3-dev mesa-vulkan-drivers libpango1.0-dev
- name: Check formatting
run: cargo fmt --all -- --check
- name: Check clippy
# Don't fail the build for clippy on nightly, since we get a lot of false-positives
run: cargo clippy --all --all-features --tests ${{ (matrix.rust_version != 'nightly' && '-- -D warnings') || '' }}
- name: Check licensing and duplicates in used crates
if: ${{ matrix.rust_version == 'stable' }}
uses: EmbarkStudios/cargo-deny-action@v1
- name: Check documentation
run: cargo doc --no-deps --all-features
env:
RUSTDOCFLAGS: -D warnings
check-required:
needs: changes
if: needs.changes.outputs.should_run == 'false'