Skip to content
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

Remove save-always usage #934

Open
wants to merge 1 commit into
base: v2-branch
Choose a base branch
from
Open
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
18 changes: 14 additions & 4 deletions setup-r-dependencies/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,10 @@ runs:
shell: Rscript {0}
working-directory: ${{ inputs.working-directory }}

- name: R package cache
- name: R package cache restore
id: cache-packages-restore
if: inputs.cache != 'false'
uses: actions/cache@v4
uses: actions/cache/restore@v4
with:
path: |
${{ env.R_LIBS_USER }}/*
Expand All @@ -158,8 +159,6 @@ runs:
!${{ env.R_LIBS_USER }}/_cache
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: ${{ 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 Expand Up @@ -267,3 +266,14 @@ runs:
if command -v /c/Rtools/bin/tar && /c/Rtools/bin/tar --version | grep -q 'tar (GNU tar) 1.30'
then echo 'C:/Program Files/Git/usr/bin' >> $GITHUB_PATH
fi

- name: R package cache save
if: ${{ steps.cache-packages-restore.outputs.cache-hit != 'true' && ((always() && inputs.cache == 'always') || inputs.cache == 'true') }}
uses: actions/cache/save@v4
with:
path: |
${{ env.R_LIBS_USER }}/*
renv/library
!${{ env.R_LIBS_USER }}/pak
!${{ env.R_LIBS_USER }}/_cache
key: ${{ steps.cache-packages-restore.outputs.cache-primary-key }}
13 changes: 11 additions & 2 deletions setup-renv/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ runs:
shell: Rscript {0}

- name: Restore Renv package cache
id: cache-packages-restore
if: ${{ inputs.bypass-cache != 'true' }}
uses: actions/cache@v4
uses: actions/cache/restore@v4
with:
path: |
${{ env.RENV_PATHS_ROOT }}
renv/library
key: ${{ steps.get-version.outputs.os-version }}-${{ steps.get-version.outputs.r-version }}-${{inputs.cache-version }}-${{ hashFiles(format('{0}/renv.lock', inputs.working-directory)) }}
restore-keys: ${{ steps.get-version.outputs.os-version }}-${{ steps.get-version.outputs.r-version }}-${{inputs.cache-version }}-
save-always: ${{ inputs.bypass-cache == 'never' }}

- name: Install renv dependencies
run: renv::restore()
Expand All @@ -58,3 +58,12 @@ runs:
if command -v /c/Rtools/bin/tar && /c/Rtools/bin/tar --version | grep -q 'tar (GNU tar) 1.30'
then echo 'C:/Program Files/Git/usr/bin' >> $GITHUB_PATH
fi

- name: Save Renv package cache
if: ${{ steps.cache-packages-restore.outputs.cache-hit != 'true' && ((always() && inputs.bypass-cache == 'never') || inputs.bypass-cache == 'false') }}
uses: actions/cache/save@v4
with:
path: |
${{ env.RENV_PATHS_ROOT }}
renv/library
key: ${{ steps.cache-packages-restore.outputs.cache-primary-key }}
Loading