Skip to content

Commit

Permalink
update xshell to 0.2 (bevyengine#4789)
Browse files Browse the repository at this point in the history
# Objective

- Update xshell to 0.2 in ci tool
- Replace bevyengine#4205
  • Loading branch information
mockersf authored and james7132 committed Jun 7, 2022
1 parent d7cc5b1 commit ee8ca4d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 16 deletions.
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

0 comments on commit ee8ca4d

Please sign in to comment.