Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
bevyengine
GitHub Repository: bevyengine/bevy
Path: blob/main/tools/ci/src/commands/integration_test_check.rs
6598 views
1
use std::path::Path;
2
3
use crate::{args::Args, Prepare, PreparedCommand};
4
use argh::FromArgs;
5
use xshell::cmd;
6
7
pub fn get_integration_tests(sh: &xshell::Shell) -> Vec<String> {
8
let integration_test_paths = sh.read_dir(Path::new("./tests-integration")).unwrap();
9
10
// Filter out non-directories
11
integration_test_paths
12
.into_iter()
13
.filter(|path| path.is_dir())
14
.map(|path| path.to_string_lossy().to_string())
15
.collect()
16
}
17
18
/// Checks that all integration tests compile.
19
#[derive(FromArgs, Default)]
20
#[argh(subcommand, name = "integration-test-check")]
21
pub struct IntegrationTestCheckCommand {}
22
23
impl Prepare for IntegrationTestCheckCommand {
24
fn prepare<'a>(&self, sh: &'a xshell::Shell, args: Args) -> Vec<PreparedCommand<'a>> {
25
let jobs = args.build_jobs();
26
let jobs_ref = jobs.as_ref();
27
28
get_integration_tests(sh)
29
.into_iter()
30
.map(|path| {
31
PreparedCommand::new::<Self>(
32
cmd!(
33
sh,
34
"cargo check --manifest-path {path}/Cargo.toml --tests {jobs_ref...}"
35
),
36
"Please fix compiler errors for tests in output above.",
37
)
38
})
39
.collect()
40
}
41
}
42
43