Skip to content

Commit

Permalink
ci: Split Rust lint checks into their own job
Browse files Browse the repository at this point in the history
  • Loading branch information
torokati44 authored and Dinnerbone committed Feb 16, 2024
1 parent 1651b7a commit 9646c86
Showing 1 changed file with 41 additions and 20 deletions.
61 changes: 41 additions & 20 deletions .github/workflows/test_rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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'
Expand Down

0 comments on commit 9646c86

Please sign in to comment.