Skip to content

ci: simplify clippy #331

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,9 @@ jobs:
run: |
RUSTDOCFLAGS=-Dwarnings cargo +stable doc --no-deps -p spirv-std
RUSTDOCFLAGS=-Dwarnings cargo +stable doc --no-deps -p spirv-builder --no-default-features
- name: Clippy & custom lints
- name: cargo clippy
run: cargo clippy --all-targets -- -D warnings
- name: custom lints
run: .github/workflows/lint.sh

cargo-deny:
Expand Down
56 changes: 5 additions & 51 deletions .github/workflows/lint.sh
Original file line number Diff line number Diff line change
@@ -1,57 +1,6 @@
#!/usr/bin/env bash
set -e

if [[ -z "${CI}" ]]; then
FEAT="use-compiled-tools"
else
FEAT="use-installed-tools"
fi

function clippy() {
echo ::group::"$1"
cargo clippy \
--manifest-path "$1/Cargo.toml" \
--no-default-features \
--features "$FEAT" \
--all-targets \
-- -D warnings
echo ::endgroup::
}

function clippy_no_features() {
echo ::group::"$1"
cargo clippy \
--manifest-path "$1/Cargo.toml" \
--all-targets \
-- -D warnings
echo ::endgroup::
}

# Core crates
clippy_no_features crates/rustc_codegen_spirv-target-specs
clippy_no_features crates/rustc_codegen_spirv-types
clippy crates/rustc_codegen_spirv
clippy crates/spirv-builder
clippy_no_features crates/spirv-std

# Examples
clippy examples/multibuilder
clippy examples/runners/ash
clippy_no_features examples/runners/cpu
clippy examples/runners/wgpu

# shaders
clippy_no_features examples/shaders/sky-shader
clippy_no_features examples/shaders/simplest-shader
clippy_no_features examples/shaders/compute-shader
clippy_no_features examples/shaders/mouse-shader
clippy_no_features examples/shaders/reduce

# tests
clippy tests/compiletests
clippy tests/difftests/bin
clippy tests/difftests/lib

# Custom lints

# 1. Disallow `std::env` (mis)use from `rustc_codegen_spirv`
Expand Down Expand Up @@ -111,6 +60,11 @@ version_test crates/spirv-std
# HACK(eddyb) see `crates/rustc_codegen_spirv/build.rs` for more on `pqp_cg_ssa`
# (a patched copy of `rustc_codegen_ssa`).
echo ::group::rustc_codegen_spirv_disable_pqp_cg_ssa
if [[ -z "${CI}" ]]; then
FEAT="use-compiled-tools"
else
FEAT="use-installed-tools"
fi
cargo clippy \
--manifest-path "crates/rustc_codegen_spirv/Cargo.toml" \
--no-default-features \
Expand Down
6 changes: 2 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,6 @@ codegen-units = 256
#
# rustflags = ["-Zshare-generics=off"]
codegen-units = 1

[patch.crates-io]
spirv-tools = { git = "https://github.com/Rust-GPU/spirv-tools-rs", rev = "a77b217f48d852a8d87183b3fa89396bf4db58bc" }