update xshell to 0.2 (#4789)

# Objective

- Update xshell to 0.2 in ci tool
- Replace #4205
This commit is contained in:
François 2022-05-30 16:21:03 +00:00
parent deeaf64897
commit a764d44f17
2 changed files with 20 additions and 16 deletions

View file

@ -7,5 +7,5 @@ publish = false
license = "MIT OR Apache-2.0"
[dependencies]
xshell = "0.1"
xshell = "0.2"
bitflags = "1.3"

View file

@ -1,4 +1,4 @@
use xshell::{cmd, pushd};
use xshell::{cmd, Shell};
use bitflags::bitflags;
@ -39,9 +39,11 @@ 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.");
}
@ -49,7 +51,7 @@ fn main() {
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.");
}
@ -57,23 +59,22 @@ fn main() {
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.");
}
@ -81,29 +82,32 @@ fn main() {
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")
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.");
}