Skip to content

setup-renv isn't caching R packages when RENV_CONFIG_PAK_ENABLED: true #900

@gadenbuie

Description

@gadenbuie

Describe the bug

I'm using the setup-renv action with RENV_CONFIG_PAK_ENABLED set to true. Unless I'm missing something, the package library isn't included in the cache and packages are always installed fresh with each run.

- name: 📦 Install dependencies with renv
  uses: r-lib/actions/setup-renv@v2
  env:
    RENV_CONFIG_PAK_ENABLED: true
  with:
    cache-version: 2

To Reproduce

Here are two subsequent runs of the same workflow, both spend ~10 minutes installing packages despite the cache hit.

  1. https://github.com/posit-conf-2024/level-up-shiny/actions/runs/10239407197/job/28324954289 (13m 49s)
  2. https://github.com/posit-conf-2024/level-up-shiny/actions/runs/10239778904/job/28325757466 (14m 46s)

Expected behavior

I was expecting the package library to be included in the cache.

Additional context

Here are a few relevant log lines:

echo "RENV_PATHS_ROOT=/home/runner/work/_temp/renv" >> $GITHUB_ENV
  shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
  env:
    GITHUB_TOKEN: ***
    GH_TOKEN: ***
    GITHUB_PAT: ***
    BUNDLE_EXT: linux-amd64.deb
    R_LIBS_USER: /home/runner/work/_temp/Library
    TZ: UTC
    _R_CHECK_SYSTEM_CLOCK_: FALSE
    NOT_CRAN: true
    RENV_CONFIG_PAK_ENABLED: true
# ... snip ...
Cache Size: ~15 MB (15681114 B)
/usr/bin/tar -xf /home/runner/work/_temp/3beeaa8e-c7bd-4e38-a6f4-337568925cab/cache.tzst -P -C /home/runner/work/level-up-shiny/level-up-shiny --use-compress-program unzstd
Cache restored successfully
Cache restored from key: Ubuntu 22.04.4 LTS-R version 4.4.1 (2024-06-14)-2-fdd42af88e931ce1a46f09[91](https://github.com/posit-conf-2024/level-up-shiny/actions/runs/10239778904/job/28325757466#step:5:96)e3efb3f513b4abae58b410ca640958cac33f917e
# ... snip ....
- One or more packages recorded in the lockfile are not installed.
- Use `renv::status()` for more details.
i Loaded project root .Rprofile.
The following package(s) will be installed:
- pak [0.7.2]
These packages will be installed into "~/work/level-up-shiny/level-up-shiny/renv/library/linux-ubuntu-jammy/R-4.4/x86_64-pc-linux-gnu".

# Installing packages --------------------------------------------------------
- Installing pak ...                            OK [linked from cache]
Successfully installed 1 package in 8.3 milliseconds.

✔ Updated metadata database: 2.95 MB in 9 files.

ℹ Updating metadata database
✔ Updating metadata database ... done

 
→ Will install 124 packages.
→ Will download [118](https://github.com/posit-conf-2024/level-up-shiny/actions/runs/10239778904/job/28325757466#step:5:124) CRAN packages (83.69 MB).
→ Will download 6 packages with unknown size.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions