Skip to content

Commit

Permalink
WoP package cache
Browse files Browse the repository at this point in the history
  • Loading branch information
riccardoporreca committed Jan 10, 2024
1 parent fce5942 commit 2c24634
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/ci-cd-renv.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,23 @@ 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
- name: Configure pak package cache
id: pak-cache
run: |
# Package cache used by pak
cat("R_PKG_CACHE_DIR=${{ runner.temp }}/pkgcache\n", file = Sys.getenv("GITHUB_ENV"), append = TRUE)
cache_version = 0
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)
cat("cache-version=", cache_version, 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-
key: ${{ steps.pak-cache.outputs.os-version }}-${{ steps.pak-cache.outputs.r-version }}-${{ steps.pak-cache.outputs.cache-version }}-${{ hashFiles('renv.lock') }}
restore-keys: ${{ steps.pak-cache.outputs.os-version }}-${{ steps.pak-cache.outputs.r-version }}-${{ steps.pak-cache.outputs.cache-version }}-

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

0 comments on commit 2c24634

Please sign in to comment.