Run benchmarks after building stuff. (#6685)

As discussed in https://discord.com/channels/401396655599124480/1106814204175978516
This commit is contained in:
Michał Wawrzyniec Urbańczyk 2023-06-13 23:06:14 +02:00 committed by GitHub
parent 067ed0cb21
commit 70cdb15d02
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 4 deletions

View File

@ -322,10 +322,14 @@ impl RunContext {
]);
}
tasks.extend(self.config.execute_benchmarks.iter().flat_map(|b| b.sbt_task()));
if !tasks.is_empty() {
let build_stuff = Sbt::concurrent_tasks(tasks);
sbt.call_arg(build_stuff).await?;
// We want benchmarks to run only after the other build tasks are done, as they are
// really CPU-heavy.
let build_command = (!tasks.is_empty()).then_some(Sbt::concurrent_tasks(tasks));
let benchmark_tasks = self.config.execute_benchmarks.iter().flat_map(|b| b.sbt_task());
let command_sequence = build_command.as_deref().into_iter().chain(benchmark_tasks);
let final_command = Sbt::sequential_tasks(command_sequence);
if !final_command.is_empty() {
sbt.call_arg(final_command).await?;
} else {
debug!("No SBT tasks to run.");
}

View File

@ -41,6 +41,11 @@ impl Sbt {
}
ret
}
/// Format a string with a command that will execute all the given tasks sequentially.
pub fn sequential_tasks<'a>(tasks: impl IntoIterator<Item = &'a str>) -> String {
tasks.into_iter().collect::<Vec<_>>().join("; ")
}
}
#[derive(Clone, Debug)]