Skip to content

Commit f63b797

Browse files
committed
Format try run and master run separately
1 parent 577c0fa commit f63b797

File tree

1 file changed

+65
-57
lines changed

1 file changed

+65
-57
lines changed

site/src/github.rs

Lines changed: 65 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -568,74 +568,82 @@ async fn post_comparison_comment(ctxt: &SiteCtxt, commit: QueuedCommit, is_maste
568568
)
569569
.await;
570570

571-
let mut label = String::new();
572-
if !is_master_commit {
573-
label.push_str("+S-waiting-on-review -S-waiting-on-perf ");
574-
};
575-
label.push_str(match direction {
571+
let body = format!(
572+
"Finished benchmarking commit ({sha}): [comparison url]({url}).
573+
574+
**Summary**: {summary}
575+
{rest}",
576+
sha = commit.sha,
577+
url = comparison_url,
578+
summary = summary,
579+
rest = if is_master_commit {
580+
master_run_body(direction)
581+
} else {
582+
try_run_body(direction)
583+
}
584+
);
585+
586+
post_comment(&ctxt.config, commit.pr, body).await;
587+
}
588+
589+
fn master_run_body(direction: Option<Direction>) -> String {
590+
let label = match direction {
576591
Some(Direction::Regression | Direction::Mixed) => "+perf-regression",
577592
Some(Direction::Improvement) | None => "-perf-regression",
578-
});
579-
580-
let rollup_msg = if is_master_commit {
581-
""
582-
} else {
583-
"Benchmarking this pull request likely means that it is \
584-
perf-sensitive, so we're automatically marking it as not fit \
585-
for rolling up. "
586593
};
587-
588-
let next_steps_msg = direction
589-
.map(|d| {
590-
format!(
591-
"{}{}",
592-
if is_master_commit {
593-
""
594-
} else {
595-
"While you can manually mark this PR as fit \
596-
for rollup, we strongly recommend not doing so since this PR led to changes in \
597-
compiler perf."
598-
},
599-
match d {
600-
Direction::Regression | Direction::Mixed =>
601-
"\n\n**Next Steps**: If you can justify the \
594+
let next_steps = match direction {
595+
Some(Direction::Regression | Direction::Mixed) => {
596+
"\n\n**Next Steps**: If you can justify the \
602597
regressions found in this perf run, please indicate this with \
603598
`@rustbot label: +perf-regression-triaged` along with \
604599
sufficient written justification. If you cannot justify the regressions \
605-
please fix the regressions (either in this PR if it's not yet merged or \
606-
in another PR), and then add the `perf-regression-triaged` label to this PR.",
607-
Direction::Improvement => "",
608-
}
609-
)
610-
})
611-
.unwrap_or(String::new());
612-
let bors_msg = if is_master_commit {
613-
""
614-
} else {
615-
"@bors rollup=never\n"
600+
please open an issue or create a new PR that fixes the regressions, \
601+
add a comment linking to the newly created issue or PR, \
602+
and then add the `perf-regression-triaged` label to this PR."
603+
}
604+
Some(Direction::Improvement) | None => "",
616605
};
617606

618-
post_comment(
619-
&ctxt.config,
620-
commit.pr,
621-
format!(
622-
"Finished benchmarking commit ({sha}): [comparison url]({url}).
623-
624-
**Summary**: {summary}
607+
format!(
608+
"
609+
{next_steps}
625610
626-
{rollup}{next_steps}
627-
{bors}
628611
@rustbot label: {label}",
629-
sha = commit.sha,
630-
url = comparison_url,
631-
summary = summary,
632-
rollup = rollup_msg,
633-
next_steps = next_steps_msg,
634-
bors = bors_msg,
635-
label = label
636-
),
612+
next_steps = next_steps,
613+
label = label
614+
)
615+
}
616+
617+
fn try_run_body(direction: Option<Direction>) -> String {
618+
let label = match direction {
619+
Some(Direction::Regression | Direction::Mixed) => "+perf-regression",
620+
Some(Direction::Improvement) | None => "-perf-regression",
621+
};
622+
let next_steps = match direction {
623+
Some(Direction::Regression | Direction::Mixed) => {
624+
"\n\n**Next Steps**: If you can justify the regressions found in \
625+
this try perf run, please indicate this with \
626+
`@rustbot label: +perf-regression-triaged` along with \
627+
sufficient written justification. If you cannot justify the regressions \
628+
please fix the regressions and do another perf run. If the next run \
629+
shows neutral or positive results, the label will be automatically removed."
630+
}
631+
Some(Direction::Improvement) | None => "",
632+
};
633+
634+
format!(
635+
"
636+
Benchmarking this pull request likely means that it is \
637+
perf-sensitive, so we're automatically marking it as not fit \
638+
for rolling up. While you can manually mark this PR as fit \
639+
for rollup, we strongly recommend not doing so since this PR led to changes in \
640+
compiler perf.{next_steps}
641+
642+
@bors rollup=never
643+
@rustbot label: +S-waiting-on-review -S-waiting-on-perf {label}",
644+
next_steps = next_steps,
645+
label = label
637646
)
638-
.await;
639647
}
640648

641649
async fn categorize_benchmark(

0 commit comments

Comments
 (0)