From affdff273b408cce2ad3df6542f222e3c0263db9 Mon Sep 17 00:00:00 2001 From: Alice Cecile Date: Wed, 2 Feb 2022 18:00:52 -0500 Subject: [PATCH 1/5] Add more steps to CI rust file --- tools/ci/src/main.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tools/ci/src/main.rs b/tools/ci/src/main.rs index 336db74da7db3..996c5f901c176 100644 --- a/tools/ci/src/main.rs +++ b/tools/ci/src/main.rs @@ -17,6 +17,16 @@ fn main() { .run() .expect("Please fix clippy errors in output above."); + // Run tests + cmd!("cargo test") + .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."); + // Run UI tests (they do not get executed with the workspace tests) // - See crates/bevy_ecs_compile_fail_tests/README.md { From ae49150466e19ba7b70eb5788d65e2f4021ebe9e Mon Sep 17 00:00:00 2001 From: Alice Cecile Date: Wed, 2 Feb 2022 18:21:40 -0500 Subject: [PATCH 2/5] Test the whole workspace MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: François --- tools/ci/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/ci/src/main.rs b/tools/ci/src/main.rs index 996c5f901c176..8f55929010028 100644 --- a/tools/ci/src/main.rs +++ b/tools/ci/src/main.rs @@ -18,7 +18,7 @@ fn main() { .expect("Please fix clippy errors in output above."); // Run tests - cmd!("cargo test") + cmd!("cargo test --workspace") .run() .expect("Please fix failing tests in output above."); From 43c2bc78f10da8b3786392f7bb31aa821ac4e0ae Mon Sep 17 00:00:00 2001 From: Alice Cecile Date: Wed, 2 Feb 2022 19:09:45 -0500 Subject: [PATCH 3/5] Skip running tests if the nonlocal CLI flag is set --- .github/workflows/ci.yml | 2 +- tools/ci/src/main.rs | 26 ++++++++++++++++---------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0ca71c2f32ead..3bff69cc33257 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -68,7 +68,7 @@ jobs: run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev libwayland-dev libxkbcommon-dev - name: CI job # See tools/ci/src/main.rs for the commands this runs - run: cargo run -p ci + run: cargo run -p ci nonlocal check-benches: runs-on: ubuntu-latest diff --git a/tools/ci/src/main.rs b/tools/ci/src/main.rs index 8f55929010028..d7a5c472ed090 100644 --- a/tools/ci/src/main.rs +++ b/tools/ci/src/main.rs @@ -17,16 +17,6 @@ fn main() { .run() .expect("Please fix clippy errors in output above."); - // 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."); - // Run UI tests (they do not get executed with the workspace tests) // - See crates/bevy_ecs_compile_fail_tests/README.md { @@ -36,4 +26,20 @@ fn main() { .run() .expect("Compiler errors of the ECS compile fail tests seem to be different than expected! Check locally and compare rust versions."); } + + // 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 = std::env::args().collect(); + if args.get(0) != 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."); + } } From 271c4d0aa6b5bb925ae04979e0f87370995cfd0c Mon Sep 17 00:00:00 2001 From: Alice Cecile Date: Wed, 2 Feb 2022 19:13:57 -0500 Subject: [PATCH 4/5] Fix flag passed in MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: François --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3bff69cc33257..5b7e1949a5bc2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -68,7 +68,7 @@ jobs: run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev libwayland-dev libxkbcommon-dev - name: CI job # See tools/ci/src/main.rs for the commands this runs - run: cargo run -p ci nonlocal + run: cargo run -p ci -- nonlocal check-benches: runs-on: ubuntu-latest From fe1a875a72ba9620f3d0fb2cace02456d71cb0a7 Mon Sep 17 00:00:00 2001 From: Alice Cecile Date: Wed, 2 Feb 2022 19:34:42 -0500 Subject: [PATCH 5/5] Use the right argument MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: François --- tools/ci/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/ci/src/main.rs b/tools/ci/src/main.rs index d7a5c472ed090..8264db7b44c30 100644 --- a/tools/ci/src/main.rs +++ b/tools/ci/src/main.rs @@ -31,7 +31,7 @@ fn main() { // 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 = std::env::args().collect(); - if args.get(0) != Some(&"nonlocal".to_string()) { + if args.get(1) != Some(&"nonlocal".to_string()) { // Run tests cmd!("cargo test --workspace") .run()