pin_assets: Pin asset directory

View source: R/utils.R

pin_assetsR Documentation

Pin asset directory

Description

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.

Usage

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.

Details

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

Value

The asset directory invisibly.

Examples

## Not run: 
# 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
)

## End(Not run)

lorenzwalthert/touchstone documentation built on April 20, 2024, 9:57 a.m.