Skip to content

Commit

Permalink
Avoid duplicate caching
Browse files Browse the repository at this point in the history
`r-lib/actions/setup-r-dependencies` already takes care of caching
See also carpentries#591
  • Loading branch information
milanmlft committed Jun 4, 2024
1 parent 87920a1 commit 36917a5
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 48 deletions.
31 changes: 1 addition & 30 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,12 @@ jobs:
matrix:
config:
## Run CI only on ubuntu-latest as this is the os used to build lessons
- {os: ubuntu-latest, cache: '~/.local/share/renv', r: 'release', cov: 'true'}
- {os: ubuntu-latest, r: 'release', cov: 'true'}

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
RENV_PATHS_ROOT: ${{ matrix.config.cache }}

steps:
- name: Record Linux Version
Expand Down Expand Up @@ -76,25 +75,6 @@ jobs:
extra-packages: any::rcmdcheck
needs: check

- name: "Restore {renv} cache"
if: runner.os != 'Windows'
uses: actions/cache@v3
with:
path: ${{ env.RENV_PATHS_ROOT }}
key: ${{ runner.os }}-${{ env.OS_VERSION }}-renv-${{ runner.r }}-${{ hashFiles('.github/workflows/R-CMD-check.yaml') }}
restore-keys: |
${{ runner.os }}-${{ env.OS_VERSION }}-renv-${{ runner.r }}-
- name: "Prime {renv} Cache"
if: runner.os != 'Windows'
run: |
renv::settings$snapshot.type("explicit")
renv::init(bioconductor = TRUE)
system('sudo rm -rf renv.lock renv .Rprofile')
system('git clean -fd -e .github')
system('git restore .')
shell: Rscript {0}

- name: "Session info"
run: |
options(width = 100)
Expand All @@ -104,14 +84,5 @@ jobs:

- name: "Check"
uses: r-lib/actions/check-r-package@v2
if: runner.os != 'Windows'
with:
upload-snapshots: true

- name: "Check"
uses: r-lib/actions/check-r-package@v2
if: runner.os == 'Windows'
env:
RENV_PATHS_ROOT: ~
with:
upload-snapshots: true
18 changes: 0 additions & 18 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ jobs:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
RENV_PATHS_ROOT: ~/.local/share/renv
OS_VERSION: 1

steps:
Expand Down Expand Up @@ -60,23 +59,6 @@ jobs:
extra-packages: any::covr
needs: coverage

- name: Restore {renv} cache
uses: actions/cache@v3
with:
path: ${{ env.RENV_PATHS_ROOT }}
key: ${{ runner.os }}-${{ env.OS_VERSION }}-renv-${{ runner.r }}-${{ hashFiles('.github/workflows/R-CMD-check.yaml') }}
restore-keys: |
${{ runner.os }}-${{ env.OS_VERSION }}-renv-${{ runner.r }}-
- name: Prime {renv} Cache
run: |
renv::settings$snapshot.type("explicit")
renv::init(bioconductor = TRUE)
system('rm -rf renv .Rprofile')
system('git clean -fd -e .github')
system('git restore .')
shell: Rscript {0}

- name: Test coverage
run: |
covr::codecov(
Expand Down

0 comments on commit 36917a5

Please sign in to comment.