-
Notifications
You must be signed in to change notification settings - Fork 230
Description
STOP
If you are debugging a failed build or have a question about GitHub Actions in
general do NOT open an issue here. Either post on the Actions sections of
the GitHub Community or the RStudio Community forums.
Open an issue here only if you have a bug in one of the
custom R specific actions themselves.
Describe the bug
setup-r-dependencies uses pak::lockfile_create() with no lib-parameter. Therefor it defaults to .Library which means only installed base packages are being detected and all (pre-)installed site-packages (.Library.site) are being ignored and will be reinstalled.
See:
actions/setup-r-dependencies/action.yaml
Line 112 in 7171bbd
| pak::lockfile_create( |
To Reproduce
We're using nightly built base images for Github actions with most used R packages already included so we can speed up the install dependencies step in our workflows. As caching is being stored on the runner and not on the base image itself, it's not being used unless you rerun the same workflow/branch. Initial runs don't have cache but the installed site-packages should be checked, this does not happen because of the mentioned finding (.Library only contains R base packages).
Continuous-Integration:
runs-on: ubuntu-latest
container:
image: ***.dkr.ecr.eu-central-1.amazonaws.com/base-images/builder-r-latest:latest
Expected behavior
Installed site-packages should be checked, this does not happen because of the mentioned finding (.Library only contains R base packages). Therefor all site-packages will be downloaded from remote repositories like CRAN or RSPM
Additional context
Possible workaround is to install the extra packages in the base images in the .Library folder (in our case it's /usr/local/lib/R/library) instead of the .Library.site folder (/usr/local/lib/R/site-library).
A nicer solution is to specify .Library.site for the lib-parameter of the pak::lockfile_create() call here, like so:
pak::lockfile_create(
c(deps, extra_deps),
lockfile = ".github/pkg.lock",
lib = .Library.site,
upgrade = (${{ inputs.upgrade }}),
dependencies = c(needs, (${{ inputs.dependencies }}))
)
relevant (tried) env-variables:
R_LIBS_USER="/usr/local/lib/R/site-library"
R_LIBS_SITE="/usr/local/lib/R/site-library"
R_LIB_FOR_PAK="/usr/local/lib/R/site-library"