Skip to content

Commit

Permalink
Move new errors message to summary
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark-Simulacrum committed Feb 8, 2022
1 parent 0dd5562 commit 5e904f7
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions site/src/comparison.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ pub struct ComparisonSummary {
num_improvements: usize,
/// The cached number of comparisons that are regressions
num_regressions: usize,
/// Which benchmarks had errors
errors_in: Vec<String>,
}

impl ComparisonSummary {
Expand Down Expand Up @@ -208,10 +210,17 @@ impl ComparisonSummary {
};
comparisons.sort_by(cmp);

let errors_in = comparison
.new_errors
.keys()
.map(|k| k.as_str().to_owned())
.collect::<Vec<_>>();

Some(ComparisonSummary {
comparisons,
num_improvements,
num_regressions,
errors_in,
})
}

Expand Down Expand Up @@ -351,8 +360,6 @@ impl ComparisonSummary {
}

async fn write(&self, comparison: &Comparison) -> String {
use std::fmt::Write;

let mut result = if let Some(pr) = comparison.b.pr {
let title = github::pr_title(pr).await;
format!(
Expand All @@ -368,20 +375,6 @@ impl ComparisonSummary {

self.write_summary_lines(&mut result, Some(link));

if !comparison.new_errors.is_empty() {
write!(
result,
"- New errors in {}",
comparison
.new_errors
.keys()
.map(|k| k.as_str())
.collect::<Vec<_>>()
.join(", ")
)
.unwrap();
}

result
}

Expand All @@ -407,6 +400,15 @@ impl ComparisonSummary {
write!(result, "- ").unwrap();
change.summary_line(result, link)
}

if !self.errors_in.is_empty() {
write!(
result,
"- Benchmark(s) {} started failing to build",
self.errors_in.join(", ")
)
.unwrap();
}
}
}

Expand Down

0 comments on commit 5e904f7

Please sign in to comment.