@@ -7,23 +7,24 @@ plot_against_base <- function(new_bm,
7
7
new_bm_label = deparse(substitute(new_bm )),
8
8
file = paste0(" plots/" , new_bm_label , " .pdf" )) {
9
9
new_bm <- bench :: as_bench_mark(new_bm )
10
+ new_bm $ expression <- bench ::: new_bench_expr(Sys.getenv(" GITHUB_HEAD_REF" ))
10
11
name <- unique(new_bm $ name )
11
12
stopifnot(length(name ) == 1 )
12
13
branches <- gert :: git_branch_list()
13
14
last_commit_base_branch <- branches [branches $ name == Sys.getenv(" GITHUB_BASE_REF" ), " commit" , drop = TRUE ]
14
15
bm <- bench :: cb_read()
15
- print(" bm is" )
16
- print(bm )
17
16
commit_is_reference <- bm $ commit_hash == last_commit_base_branch
18
- if (any(commit_is_reference ) && Sys.getenv(" GITHUB_BASE_REF" ) != " " && ! is.null( bm ) && nrow( bm ) > 0 ) {
17
+ if (any(commit_is_reference ) && Sys.getenv(" GITHUB_BASE_REF" ) != " " ) {
19
18
# if a pull request
20
- reference <- bm [commit_is_reference , " benchmarks" ][[1 ]][[1 ]] %> %
21
- dplyr :: filter(.data $ name %in% !! name )
22
- reference $ expression <- bench ::: new_bench_expr(Sys.getenv(" GITHUB_BASE_REF" ))
23
- new_bm $ expression <- bench ::: new_bench_expr(Sys.getenv(" GITHUB_HEAD_REF" ))
24
- new_bm <- dplyr :: bind_rows(reference , new_bm )
25
- new_bm $ branch <- factor (new_bm $ expression )
19
+ reference <- bm [commit_is_reference , " benchmarks" ][[1 ]][[1 ]]
20
+ if (nrow(reference ) > 0 && " name" %in% names(reference )) {
21
+ reference <- reference %> %
22
+ dplyr :: filter(.data $ name %in% !! name )
23
+ reference $ expression <- bench ::: new_bench_expr(Sys.getenv(" GITHUB_BASE_REF" ))
24
+ new_bm <- dplyr :: bind_rows(reference , new_bm )
25
+ }
26
26
}
27
+ new_bm $ branch <- factor (new_bm $ expression )
27
28
plot <- ggplot2 :: ggplot(new_bm ) +
28
29
ggplot2 :: geom_boxplot(ggplot2 :: aes(
29
30
x = branch , ymin = p0 ,
0 commit comments