Skip to content

Commit

Permalink
version.colors
Browse files Browse the repository at this point in the history
  • Loading branch information
tdhock committed Dec 8, 2023
1 parent 1842d76 commit c4465f3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
8 changes: 5 additions & 3 deletions R/versions.R
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,6 @@ atime_pkg <- function(pkg.path="."){
width.in <- 4
height.in <- 8
expand.prop <- 0.5
color.vec <- structure(
c("red","black","deepskyblue","violet"),
names=c(HEAD.name, base.name, "merge-base", CRAN.name))
if(git2r::is_commit(base.commit)){
add_if_new <- function(name, commit.obj){
sha <- git2r::sha(commit.obj)
Expand All @@ -218,6 +215,11 @@ atime_pkg <- function(pkg.path="."){
test.env <- new.env()
tests.parsed <- parse(tests.R)
eval(tests.parsed, test.env)
color.vec <- if(is.null(test.env$version.colors)){
structure(c(#RColorBrewer::brewer.pal(7, "Dark2")
"#1B9E77", "#D95F02", "#7570B3", "#E7298A", "#66A61E", "#E6AB02", "#A6761D"),
names=c(HEAD.name, base.name, "merge-base", CRAN.name, "Before", "Regression", "Fixed"))
}else test.env$version.colors
pkg.results <- list()
blank.dt.list <- list()
bench.dt.list <- list()
Expand Down
13 changes: 8 additions & 5 deletions man/atime_pkg.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,28 @@
\alias{atime_pkg}
\title{Asymptotic timing package tests}
\description{Computation time and memory for several R expressions of
several different data sizes, for up to four different package
versions (base, HEAD, CRAN, merge-base).}
several different data sizes, for several package
versions (base, HEAD, CRAN, merge-base, others specified by user).}
\usage{atime_pkg(pkg.path)}
\arguments{
\item{pkg.path}{path to git repository containing R package.}
}
\details{
There should be a file named pkg.path/inst/atime/tests.R which
defines \code{test.list}, a list with names corresponding to different
tests. Each
element should be a list with at least three named elements: \code{N},
tests.
Each element should be a list with at least three named elements: \code{N},
\code{setup}, \code{expr}, (possibly others such as
\code{pkg.edit.fun} and \code{version_name="1234567890abcdef"})
to be passed as named arguments to \code{atime_versions}, along with
the following versions which are passed using the \code{sha.vec} argument:
base ref comes from GITHUB_BASE_REF environment variable (default master),
HEAD ref is the branch that you want to merge into base,
CRAN is current published version (sha value \code{""}),
merge-base is most recent common ancestor commit between base and HEAD.
merge-base is most recent common ancestor commit between base and
HEAD.
The tests.R file can define \code{version.colors} which should be
a character vector (names for versions, values for colors).
}
\value{Named list, names come from names of \code{test.list}, and values
come from results of \code{atime_versions}. Side effect is that
Expand Down

0 comments on commit c4465f3

Please sign in to comment.