From 13b602ee3f3bf602acd3ea871f8da3771600c4e7 Mon Sep 17 00:00:00 2001 From: Nathan Stocks Date: Mon, 22 Feb 2021 08:42:19 +0000 Subject: [PATCH] Xtask CI (#1387) This PR is easiest to review commit by commit. Followup on https://github.com/bevyengine/bevy/pull/1309#issuecomment-767310084 - [x] Switch from a bash script to an xtask rust workspace member. - Results in ~30s longer CI due to compilation of the xtask itself - Enables Bevy contributors on any platform to run `cargo ci` to run linting -- if the default available Rust is the same version as on CI, then the command should give an identical result. - [x] Use the xtask from official CI so there's only one place to update. - [x] Bonus: Run clippy on the _entire_ workspace (existing CI setup was missing the `--workspace` flag - [x] Clean up newly-exposed clippy errors ~#1388 builds on this to clean up newly discovered clippy errors -- I thought it might be nicer as a separate PR.~ Nope, merged it into this one so CI would pass. Co-authored-by: Carter Anderson --- .cargo/config_fast_builds | 2 +- .github/workflows/ci.yml | 9 ++------- Cargo.toml | 2 +- benches/benches/bevy_ecs/bench.rs | 4 ++-- crates/bevy_core/src/time/time.rs | 1 + crates/bevy_core/src/time/timer.rs | 1 + crates/bevy_ecs/src/core/serde.rs | 2 +- crates/bevy_ecs/src/core/world.rs | 3 +-- crates/bevy_ecs/src/resource/resources.rs | 14 ++++++------- crates/bevy_ecs/src/system/commands.rs | 3 ++- crates/bevy_reflect/src/lib.rs | 3 +++ crates/bevy_reflect/src/path.rs | 1 + .../render_resource_bindings.rs | 8 ++++---- crates/bevy_render/src/shader/shader.rs | 6 +++--- crates/bevy_tasks/src/task_pool.rs | 1 + tools/ci | 20 ------------------- tools/ci/Cargo.toml | 13 ++++++++++++ tools/ci/src/main.rs | 19 ++++++++++++++++++ 18 files changed, 63 insertions(+), 49 deletions(-) delete mode 100755 tools/ci create mode 100644 tools/ci/Cargo.toml create mode 100644 tools/ci/src/main.rs diff --git a/.cargo/config_fast_builds b/.cargo/config_fast_builds index d0d6eda4d8..f01e0a7c66 100644 --- a/.cargo/config_fast_builds +++ b/.cargo/config_fast_builds @@ -1,4 +1,4 @@ -# Rename this file to `config.toml` to enable "fast build" configuration. Please read the notes below. +# Add the contents of this file to `config.toml` to enable "fast build" configuration. Please read the notes below. # NOTE: For maximum performance, build using a nightly compiler # If you are using rust stable, remove the "-Zshare-generics=y" below (as well as "-Csplit-debuginfo=unpacked" when building on macOS). diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 87b3291952..b1ce43cf87 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,13 +34,8 @@ jobs: if: runner.os == 'linux' - name: Check the format - run: cargo fmt --all -- --check - if: runner.os == 'linux' && matrix.toolchain == 'stable' - - # -A clippy::type_complexity: type complexity must be ignored because we use huge templates for queries. - # -A clippy::manual-strip: strip_prefix support was added in 1.45. We want to support earlier rust versions. - - name: Clippy - run: cargo clippy --all-targets --all-features -- -D warnings -A clippy::type_complexity -A clippy::manual-strip + # See tools/ci/src/main.rs for the commands this runs + run: cargo run --package ci if: runner.os == 'linux' && matrix.toolchain == 'stable' - name: Build & run tests diff --git a/Cargo.toml b/Cargo.toml index 8b9df8c00f..719723e12d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,7 +17,7 @@ repository = "https://github.com/bevyengine/bevy" [workspace] exclude = ["benches"] -members = ["crates/*", "examples/ios"] +members = ["crates/*", "examples/ios", "tools/ci"] [features] default = [ diff --git a/benches/benches/bevy_ecs/bench.rs b/benches/benches/bevy_ecs/bench.rs index 4547af2a91..2af2f4a320 100644 --- a/benches/benches/bevy_ecs/bench.rs +++ b/benches/benches/bevy_ecs/bench.rs @@ -32,7 +32,7 @@ fn spawn_static(b: &mut Bencher) { struct Bundle { pos: Position, vel: Velocity, - }; + } let mut world = World::new(); b.iter(|| { @@ -48,7 +48,7 @@ fn spawn_batch(b: &mut Bencher) { struct Bundle { pos: Position, vel: Velocity, - }; + } let mut world = World::new(); b.iter(|| { diff --git a/crates/bevy_core/src/time/time.rs b/crates/bevy_core/src/time/time.rs index d2f32411bc..670c6d3029 100644 --- a/crates/bevy_core/src/time/time.rs +++ b/crates/bevy_core/src/time/time.rs @@ -89,6 +89,7 @@ pub(crate) fn time_system(mut time: ResMut