-
Notifications
You must be signed in to change notification settings - Fork 217
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,21 +29,54 @@ inputs: | |
runs: | ||
using: "composite" | ||
steps: | ||
- name: Installing pak querying dependencies | ||
- name: Set site library path | ||
run: | | ||
# Set site library path | ||
cat("::group::Set site library path\n") | ||
lib <- Sys.getenv("R_LIBS_SITE") | ||
if (lib == "") { | ||
lib <- file.path(dirname(.Library), "site-library") | ||
cat(sprintf("R_LIBS_SITE=%s\n", lib), file = Sys.getenv("GITHUB_ENV"), append = TRUE) | ||
message("Setting R_LIBS_SITE to ", lib) | ||
} else { | ||
message("R_LIBS_SITE is already set to ", lib) | ||
} | ||
cat("::endgroup::\n") | ||
shell: Rscript {0} | ||
|
||
- name: Install pak (Windows) | ||
if: runner.os == 'Windows' | ||
run: | | ||
# Install pak | ||
cat("::group::Install pak\n") | ||
dir.create(Sys.getenv("R_LIBS_SITE"), showWarnings = FALSE, recursive = TRUE) | ||
install.packages("pak", repos = "https://r-lib.github.io/p/pak/${{ inputs.pak-version }}/", lib = Sys.getenv("R_LIBS_SITE")) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
krlmlr
Member
|
||
cat("::endgroup::\n") | ||
shell: Rscript {0} | ||
|
||
- name: Install pak (Unix) | ||
if: runner.os != 'Windows' | ||
run: | | ||
# Install pak | ||
echo "::group::Install pak" | ||
sudo -E R -q -e 'dir.create(Sys.getenv("R_LIBS_SITE"), recursive = TRUE, showWarnings = FALSE)' | ||
sudo -E R -q -e 'install.packages("pak", repos = "https://r-lib.github.io/p/pak/${{ inputs.pak-version }}/", lib = Sys.getenv("R_LIBS_SITE"))' | ||
This comment has been minimized.
Sorry, something went wrong.
krlmlr
Member
|
||
echo "::endgroup::" | ||
shell: bash | ||
|
||
- name: Query dependencies | ||
id: install | ||
run: | | ||
## Installing pak | ||
cat("::group::Installing pak\n") | ||
# Dependency resolution | ||
cat("::group::Dependency resolution\n") | ||
cat("os-version=", sessionInfo()$running, "\n", file = Sys.getenv("GITHUB_OUTPUT"), sep = "", append = TRUE) | ||
cat("r-version=", if (grepl("development", rv <- R.Version()$version.string)) as.character(getRversion()) else rv, "\n", file = Sys.getenv("GITHUB_OUTPUT"), sep = "", append = TRUE) | ||
install.packages("pak", repos = "https://r-lib.github.io/p/pak/${{ inputs.pak-version }}/") | ||
cat("::endgroup::\n") | ||
cat("::group::Dependency resolution\n") | ||
needs <- sprintf("Config/Needs/%s", strsplit("${{ inputs.needs }}", "[[:space:],]+")[[1]]) | ||
deps <- strsplit("${{ inputs.packages }}", "[[:space:],]+")[[1]] | ||
extra_deps <- strsplit("${{ inputs.extra-packages }}", "[[:space:],]+")[[1]] | ||
dir.create(".github", showWarnings=FALSE) | ||
Sys.setenv("PKGCACHE_HTTP_VERSION" = "2") | ||
library(pak, lib.loc = .Library.site) | ||
pak::lockfile_create( | ||
c(deps, extra_deps), | ||
lockfile = ".github/pkg.lock", | ||
|
@@ -68,11 +101,20 @@ runs: | |
|
||
- name: Install dependencies | ||
run: | | ||
## Installing/Updating packages | ||
cat("::group::Installing/updating packages\n") | ||
# Install/Update packages | ||
cat("::group::Install/update packages\n") | ||
Sys.setenv("PKGCACHE_HTTP_VERSION" = "2") | ||
library(pak, lib.loc = .Library.site) | ||
pak::lockfile_install(".github/pkg.lock") | ||
## Clean up lock file | ||
unlink(".github/pkg.lock") | ||
cat("::endgroup::\n") | ||
shell: Rscript {0} | ||
working-directory: ${{ inputs.working-directory }} | ||
|
||
- name: Session info | ||
run: | | ||
# Session info | ||
cat("::group::Session info\n") | ||
if (requireNamespace("sessioninfo", quietly = TRUE)) { | ||
if (packageVersion("sessioninfo") >= "1.2.1") { | ||
|
@@ -84,8 +126,6 @@ runs: | |
} else { | ||
sessionInfo() | ||
} | ||
## Clean up lock file | ||
unlink(".github/pkg.lock") | ||
cat("::endgroup::\n") | ||
shell: Rscript {0} | ||
working-directory: ${{ inputs.working-directory }} | ||
|
In our runs, we have:
I believe creating the directory should be the responsibility of the previous step, and this step should install into
.Library.site
?This is with
install-r: false
, for performance reasons.Example: https://github.com/cynkra/dm/actions/runs/3331327794/jobs/5510934525#step:6:351