diff --git a/.github/workflows/ci-cd-renv.yml b/.github/workflows/ci-cd-renv.yml index 5e90efd..6ae481b 100644 --- a/.github/workflows/ci-cd-renv.yml +++ b/.github/workflows/ci-cd-renv.yml @@ -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