Skip to content
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

[Merged by Bors] - update xshell to 0.2 #4789

Closed
wants to merge 1 commit into from
Closed
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
2 changes: 1 addition & 1 deletion tools/ci/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ publish = false
license = "MIT OR Apache-2.0"

[dependencies]
xshell = "0.1"
xshell = "0.2"
bitflags = "1.3"
34 changes: 19 additions & 15 deletions tools/ci/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use xshell::{cmd, pushd};
use xshell::{cmd, Shell};

use bitflags::bitflags;

Expand Down Expand Up @@ -39,71 +39,75 @@ fn main() {
_ => Check::all(),
};

let sh = Shell::new().unwrap();

if what_to_run.contains(Check::FORMAT) {
// See if any code needs to be formatted
cmd!("cargo fmt --all -- --check")
cmd!(sh, "cargo fmt --all -- --check")
.run()
.expect("Please run 'cargo fmt --all' to format your code.");
}

if what_to_run.contains(Check::CLIPPY) {
// See if clippy has any complaints.
// - Type complexity must be ignored because we use huge templates for queries
cmd!("cargo clippy --workspace --all-targets --all-features -- -A clippy::type_complexity -W clippy::doc_markdown -D warnings")
cmd!(sh, "cargo clippy --workspace --all-targets --all-features -- -A clippy::type_complexity -W clippy::doc_markdown -D warnings")
.run()
.expect("Please fix clippy errors in output above.");
}

if what_to_run.contains(Check::COMPILE_FAIL) {
// 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 --target-dir ../../target")
let _subdir = sh.push_dir("crates/bevy_ecs_compile_fail_tests");
cmd!(sh, "cargo test --target-dir ../../target")
.run()
.expect("Compiler errors of the ECS compile fail tests seem to be different than expected! Check locally and compare rust versions.");
}

if what_to_run.contains(Check::TEST) {
// Run tests (except doc tests and without building examples)
cmd!("cargo test --workspace --lib --bins --tests --benches")
cmd!(sh, "cargo test --workspace --lib --bins --tests --benches")
.run()
.expect("Please fix failing tests in output above.");
}

if what_to_run.contains(Check::DOC_TEST) {
// Run doc tests
cmd!("cargo test --workspace --doc")
cmd!(sh, "cargo test --workspace --doc")
.run()
.expect("Please fix failing doc-tests in output above.");
}

if what_to_run.contains(Check::DOC_CHECK) {
// Check that building docs work and does not emit warnings
std::env::set_var("RUSTDOCFLAGS", "-D warnings");
cmd!("cargo doc --workspace --all-features --no-deps --document-private-items")
.run()
.expect("Please fix doc warnings in output above.");
cmd!(
sh,
"cargo doc --workspace --all-features --no-deps --document-private-items"
)
.run()
.expect("Please fix doc warnings in output above.");
}

if what_to_run.contains(Check::COMPILE_FAIL) {
let _subdir = sh.push_dir("benches");
// Check that benches are building
let _benches = pushd("benches").expect("Failed to navigate to the 'benches' folder");
cmd!("cargo check --benches --target-dir ../target")
cmd!(sh, "cargo check --benches --target-dir ../target")
.run()
.expect("Failed to check the benches.");
}

if what_to_run.contains(Check::EXAMPLE_CHECK) {
// Build examples and check they compile
cmd!("cargo check --workspace --examples")
cmd!(sh, "cargo check --workspace --examples")
.run()
.expect("Please fix failing doc-tests in output above.");
}

if what_to_run.contains(Check::COMPILE_CHECK) {
// Build examples and check they compile
cmd!("cargo check --workspace")
cmd!(sh, "cargo check --workspace")
.run()
.expect("Please fix failing doc-tests in output above.");
}
Expand Down