mirror of
https://github.com/bevyengine/bevy
synced 2025-02-17 06:28:34 +00:00
build jobs
This commit is contained in:
parent
2cf22b5654
commit
e2c30c3320
4 changed files with 25 additions and 6 deletions
|
@ -1,5 +1,5 @@
|
|||
#[derive(Copy, Clone, PartialEq, Eq)]
|
||||
pub struct Args {
|
||||
pub keep_going: bool,
|
||||
pub test_threads: u8,
|
||||
pub test_threads: Option<u8>,
|
||||
}
|
||||
|
|
|
@ -17,7 +17,11 @@ pub struct CI {
|
|||
|
||||
/// parallelism of `cargo test`
|
||||
#[argh(option)]
|
||||
test_threads: u8,
|
||||
test_threads: Option<u8>,
|
||||
|
||||
/// sets `RUST_BUILD_JOBS`
|
||||
#[argh(option)]
|
||||
build_jobs: Option<u8>,
|
||||
}
|
||||
|
||||
impl From<&CI> for Args {
|
||||
|
@ -36,7 +40,14 @@ impl CI {
|
|||
/// This is usually related to differing toolchains and configuration.
|
||||
pub fn run(self) {
|
||||
let sh = xshell::Shell::new().unwrap();
|
||||
let prepared_commands = self.prepare(&sh);
|
||||
let mut prepared_commands = self.prepare(&sh);
|
||||
|
||||
if let Some(build_jobs) = self.build_jobs {
|
||||
prepared_commands = prepared_commands
|
||||
.into_iter()
|
||||
.map(|pc| pc.with_env_var("RUST_BUILD_JOBS", build_jobs.to_string().leak()))
|
||||
.collect();
|
||||
}
|
||||
let mut failures = vec![];
|
||||
|
||||
for command in prepared_commands {
|
||||
|
|
|
@ -14,12 +14,15 @@ impl Prepare for DocTestCommand {
|
|||
.then_some("--no-fail-fast")
|
||||
.unwrap_or_default();
|
||||
|
||||
let test_threads = args.test_threads.to_string();
|
||||
let test_threads = args
|
||||
.test_threads
|
||||
.map(|test_threads| format!("--test-threads={test_threads}"))
|
||||
.unwrap_or_default();
|
||||
|
||||
vec![PreparedCommand::new::<Self>(
|
||||
cmd!(
|
||||
sh,
|
||||
"cargo test --workspace --doc {no_fail_fast} -- --test-threads={test_threads}"
|
||||
"cargo test --workspace --doc {no_fail_fast} -- {test_threads}"
|
||||
),
|
||||
"Please fix failing doc tests in output above.",
|
||||
)]
|
||||
|
|
|
@ -14,10 +14,15 @@ impl Prepare for TestCommand {
|
|||
.then_some("--no-fail-fast")
|
||||
.unwrap_or_default();
|
||||
|
||||
let test_threads = args
|
||||
.test_threads
|
||||
.map(|test_threads| format!("--test-threads={test_threads}"))
|
||||
.unwrap_or_default();
|
||||
|
||||
vec![PreparedCommand::new::<Self>(
|
||||
cmd!(
|
||||
sh,
|
||||
"cargo test --workspace --lib --bins --tests --benches {no_fail_fast}"
|
||||
"cargo test --workspace --lib --bins --tests --benches {no_fail_fast} -- {test_threads}"
|
||||
),
|
||||
"Please fix failing tests in output above.",
|
||||
)]
|
||||
|
|
Loading…
Add table
Reference in a new issue