nmfs-fish-tools / ghactions4r

Reusable github actions workflows for R packages
https://nmfs-fish-tools.github.io/ghactions4r/
12 stars 1 forks source link

feat, #20: add option to not cache pkgs #21

Closed k-doering-NOAA closed 2 years ago

k-doering-NOAA commented 2 years ago

Addresses #20.

This adds an option to not cache packages on ubuntu and mac when running the r cmd check workflow. By default, the functionality remains the same (pkgs are cached).

Note that although I thought this was needed for FIMS, it now seems that FIMS was able to install tmb just fine, so it may have been a temporary hiccup. Still, I could see this a useful feature, in case someone explicitly does not want to catch pkgs and in case we run into this issue in the future with FIMS. I think I have seen this issue in other pkgs that rely on TMB, e.g., VAST.

To test this, I tried it out on a branch of FIMS using the option to not cache pkgs, and it worked as expected. gh actions log. This PR runs call-r-cmd-check and shows the default, where R pkgs are cached.

Example of how to use this:

# Run r cmd check
name: call-r-cmd-check
# on specifies the build triggers. See more info at https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows
on:
  push:
jobs:
  call-workflow:
    uses: nmfs-fish-tools/ghactions4r/.github/workflows/r-cmd-check.yml@k-doering-NOAA-patch-2
    with:
      cache_pkgs: false
Bai-Li-NOAA commented 2 years ago

Agree that it could be an useful feature. Thanks for setting it up!