chore(CI): Add lint CI (#100)

* Add lint CI
* Clippy allow complex types, warn on some others
* bevy_gltf_blueprints use workspace lints
* Update toolchain for workspace wide lints
* Use workspace lints on the other crates as well
This commit is contained in:
GitGhillie 2024-01-19 22:23:47 +01:00 committed by GitHub
parent fd625ef2e0
commit 572a2b89a6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 52 additions and 1 deletions

30
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,30 @@
name: CI
on:
pull_request:
push:
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ubuntu-latest-cargo-lint-${{ hashFiles('**/Cargo.toml') }}
- uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.75.0
components: rustfmt, clippy
- name: Install alsa and udev
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev
- name: Run clippy
run: cargo clippy --workspace --all-targets --all-features -- -Dwarnings
- name: Check format
run: cargo fmt --all -- --check

View File

@ -19,6 +19,18 @@ members = [
]
resolver = "2"
[workspace.lints.clippy]
type_complexity = "allow"
doc_markdown = "warn"
manual_let_else = "warn"
undocumented_unsafe_blocks = "warn"
redundant_else = "warn"
match_same_arms = "warn"
semicolon_if_nothing_returned = "warn"
[lints]
workspace = true
#### --------------------Dev/ debug-------------------------------
# Enable high optimizations for dependencies (incl. Bevy), but not for our code:
[profile.dev.package."*"]

View File

@ -10,6 +10,9 @@ categories = ["game-development"]
edition = "2021"
license = "MIT OR Apache-2.0"
[lints]
workspace = true
[dev-dependencies]
bevy = { version = "0.12", default-features = false, features = ["bevy_asset", "bevy_scene", "bevy_gltf", "bevy_animation", "animation"] }

View File

@ -10,6 +10,9 @@ categories = ["game-development"]
edition = "2021"
license = "MIT OR Apache-2.0"
[lints]
workspace = true
[dev-dependencies]
bevy = { version = "0.12", default-features = false, features = ["bevy_asset", "bevy_scene", "bevy_gltf"] }

View File

@ -10,6 +10,9 @@ categories = ["game-development"]
edition = "2021"
license = "MIT OR Apache-2.0"
[lints]
workspace = true
[dev-dependencies]
bevy = { version = "0.12", default-features = false, features = ["bevy_asset", "bevy_scene", "bevy_gltf"] }

View File

@ -1,2 +1,2 @@
[toolchain]
channel = '1.72.0'
channel = '1.75.0'