8000 Save a warmed R package cache for faster installs in failing Actions by schloerke · Pull Request #695 · r-lib/actions · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Save a warmed R package cache for faster installs in failing Actions #695

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion setup-r-dependencies/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ This action install dependencies for the current R environment based on the DESC
Inputs available

- `cache` - default `true`. Whether packages should be cached across runs or
not.
not. If `"always"` is provided, the package cache will be saved even if the
workflow fails.
- `cache-version` - default `1`. If you need to invalidate the existing
cache pass any other number and a new cache will be used. Ignored if
`cache: false`. Note that you can also [delete caches
Expand Down
10 changes: 6 additions & 4 deletions setup-r-dependencies/action.yaml
7A0D
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: 'Action to setup installation tools and install R dependencies'
author: 'Jim Hester'
inputs:
cache:
description: 'A boolean value indicating whether packages should be cached from one to the other'
description: 'Whether packages should be cached across runs or not. If `"always"` is provided, the package cache will be saved even if the workflow fails.'
required: true
default: true
cache-version:
Expand Down Expand Up @@ -127,15 +127,17 @@ runs:
shell: Rscript {0}
working-directory: ${{ inputs.working-directory }}

- name: Restore R package cache
if: inputs.cache == 'true'
- name: R package cache
if: inputs.cache != 'false'
uses: actions/cache@v4
with:
path: |
${{ env.R_LIBS_USER }}/*
!${{ env.R_LIBS_USER }}/pak
key: ${{ format('{0}-{1}-{2}-{3}', steps.install.outputs.os-version, steps.install.outputs.r-version, inputs.cache-version, hashFiles(format('{0}/.github/pkg.lock', inputs.working-directory ))) }}
restore-keys: ${{ steps.install.outputs.os-version }}-${{ steps.install.outputs.r-version }}-${{inputs.cache-version }}-
restore-keys: ${{ format('{0}-{1}-{2}-', steps.install.outputs.os-version, steps.install.outputs.r-version, inputs.cache-version) }}
# Used to save package installation on troublesome Actions
save-always: ${{ inputs.cache == 'always' }}

- name: Install dependencies
run: |
Expand Down
0