Pin files or directories that need to be available on both branches when running the touchstone_script. During benchmark_run() they will available via path_pinned_asset(). This is only possible for assets within the git repository.

pin_assets(
  ...,
  branch = branch_get_or_fail("GITHUB_HEAD_REF"),
  overwrite = TRUE
)

Arguments

...

Any number of directories or files, as strings, that you want to access in your touchstone_script.

branch

The branch the passed assets are copied from.

overwrite

Overwrite files if they exist. If this is FALSE and the file exists an error will be thrown.

Value

The asset directory invisibly.

Details

When passing nested directories or files within nested directories the path will be copied recursively. See examples.

Examples

if (FALSE) { # \dontrun{
# In the touchstone script within the repo "/home/user/pkg"

pin_assets(c("/home/user/pkg/bench", "inst/setup.R", "some/nested/dir"))

source(path_pinned_asset("inst/setup.R"))
load(path_pinned_asset("some/nested/dir/data.RData"))

touchstone::benchmark_run(
  expr_before_benchmark = {
    !!setup
    source(path_pinned_asset("bench/exprs.R"))
  },
  run_me = some_exprs(),
  n = 6
)
} # }