bevy/tools/ci/src/main.rs
Nathan Stocks 13b602ee3f 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 <mcanders1@gmail.com>
2021-02-22 08:42:19 +00:00

19 lines
798 B
Rust

use xshell::cmd;
fn main() {
// When run locally, results may from actual CI runs triggered by .github/workflows/ci.yml
// - Official CI runs latest stable
// - Local runs use whatever the default Rust is locally
// See if any code needs to be formatted
cmd!("cargo fmt --all -- --check")
.run()
.expect("Please run 'cargo fmt --all' to format your code.");
// See if clippy has any complaints.
// - Type complexity must be ignored because we use huge templates for queries
// - `-A clippy::manual-strip` strip_prefix support was added in 1.45
cmd!("cargo clippy --workspace --all-targets --all-features -- -D warnings -A clippy::type_complexity -A clippy::manual-strip")
.run()
.expect("Please fix clippy errors in output above.");
}