2021-11-13 22:43:19 +00:00
|
|
|
use xshell::{cmd, pushd};
|
2021-02-22 08:42:19 +00:00
|
|
|
|
|
|
|
fn main() {
|
2021-03-11 00:27:30 +00:00
|
|
|
// When run locally, results may differ from actual CI runs triggered by
|
|
|
|
// .github/workflows/ci.yml
|
2021-02-22 08:42:19 +00:00
|
|
|
// - 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
|
2022-01-09 23:20:13 +00:00
|
|
|
cmd!("cargo clippy --workspace --all-targets --all-features -- -D warnings -A clippy::type_complexity -W clippy::doc_markdown")
|
2021-11-13 22:43:19 +00:00
|
|
|
.run()
|
|
|
|
.expect("Please fix clippy errors in output above.");
|
|
|
|
|
|
|
|
// Run UI tests (they do not get executed with the workspace tests)
|
|
|
|
// - See crates/bevy_ecs_compile_fail_tests/README.md
|
|
|
|
{
|
|
|
|
let _bevy_ecs_compile_fail_tests = pushd("crates/bevy_ecs_compile_fail_tests")
|
|
|
|
.expect("Failed to navigate to the 'bevy_ecs_compile_fail_tests' crate");
|
|
|
|
cmd!("cargo test")
|
|
|
|
.run()
|
|
|
|
.expect("Compiler errors of the ECS compile fail tests seem to be different than expected! Check locally and compare rust versions.");
|
|
|
|
}
|
2022-02-03 04:25:45 +00:00
|
|
|
|
|
|
|
// These tests are already run on the CI
|
|
|
|
// Using a double-negative here allows end-users to have a nicer experience
|
|
|
|
// as we can pass in the extra argument to the CI script
|
|
|
|
let args: Vec<String> = std::env::args().collect();
|
|
|
|
if args.get(1) != Some(&"nonlocal".to_string()) {
|
|
|
|
// Run tests
|
|
|
|
cmd!("cargo test --workspace")
|
|
|
|
.run()
|
|
|
|
.expect("Please fix failing tests in output above.");
|
|
|
|
|
|
|
|
// Run doc tests: these are ignored by `cargo test`
|
|
|
|
cmd!("cargo test --doc --workspace")
|
|
|
|
.run()
|
|
|
|
.expect("Please fix failing doc-tests in output above.");
|
|
|
|
}
|
2021-02-22 08:42:19 +00:00
|
|
|
}
|