Skip to content

Commit

Permalink
WiP package cache
Browse files Browse the repository at this point in the history
  • Loading branch information
riccardoporreca committed Jan 10, 2024
1 parent 17442a1 commit 83a4b4f
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/ci-cd-renv.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,22 @@ jobs:
# No RStudio Package Manager to respect renv.lock
use-public-rspm: false

- name: Get R and OS version for pak package cache
id: get-version-pak-cache-pak-cache
run: |
# Package cache used by pak
cat("R_PKG_CACHE_DIR=${{ runner.temp }}/pkgcache"\n", file = Sys.getenv("GITHUB_ENV"), append = TRUE)
cat("os-version=", sessionInfo()$running, "\n", file = Sys.getenv("GITHUB_OUTPUT"), sep = "", append = TRUE)
cat("r-version=", R.Version()$version.string, "\n", file = Sys.getenv("GITHUB_OUTPUT"), sep = "", append = TRUE)
shell: Rscript {0}

- name: Restore pak package cache
uses: actions/cache@v3
with:
path: ${{ env.R_PKG_CACHE_DIR }}
key: ${{ steps.get-version-pak-cache.outputs.os-version }}-${{ steps.get-version-pak-cache.outputs.r-version }}-1-${{ hashFiles('renv.lock') }}
restore-keys: ${{ steps.get-version-pak-cache.outputs.os-version }}-${{ steps.get-version-pak-cache.outputs.r-version }}-1-

- name: Activate renv and restore packages with cache
uses: r-lib/actions/setup-renv@v2

Expand Down

0 comments on commit 83a4b4f

Please sign in to comment.