Skip to content

Commit

Permalink
Install system dependencies using remotes from GitHub
Browse files Browse the repository at this point in the history
* We need the development version of remotes to support Ubuntu 22.04 and for querying system requirements for multiple pkgs (r-lib/remotes<>665), which we apply to all packages locked in `renv.lock`.
* Note that we deactivate renv to have an renv-free `remotes::system_requirements()`, in particular to get a clean stdout. `r-lib/actions/setup-renv` will reactivate renv.
  • Loading branch information
riccardoporreca committed Jan 15, 2024
1 parent 2f8349e commit 4c86a38
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions .github/workflows/ci-cd-renv.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,17 @@ jobs:

- name: Install system dependencies
# This is not taken care of (yet) by r-lib/actions/setup-renv
# Package distro used to get the distro for the used ubuntu-latest
# We need the development version of remotes to support Ubuntu 22.04 and
# for querying system requirements for multiple pkgs (r-lib/remotes#665)
# Note: We deactivate renv explicitly (setup-renv below will reactivate)
# We could use pak-based installation for renv, which includes system
# requirements, but would have to handle the pak cache explicitly
# See https://github.com/r-lib/actions/issues/785
run: |
Rscript -e "install.packages(c('remotes', 'distro'))"
SYSTEM_REQUIREMENTS='with(distro::distro(), remotes::system_requirements(id, short_version))'
Rscript -e "if (Sys.getenv('RENV_PROJECT') != '') renv::deactivate()"
Rscript -e "install.packages(c('remotes', 'distro', 'jsonlite'))"
Rscript -e "remotes::install_github('r-lib/remotes')"
SYSTEM_REQUIREMENTS='with(distro::distro(), remotes::system_requirements(id, short_version, package = names(jsonlite::read_json("renv.lock")$Packages)))'
while read -r cmd; do echo sudo $cmd && eval sudo $cmd
done < <(Rscript -e "writeLines($SYSTEM_REQUIREMENTS)")
Expand Down

0 comments on commit 4c86a38

Please sign in to comment.