This repository demonstrates how to set up GitHub Actions which will run R CMD check on packages.
- This Action works whether or not the package uses
renv
- It caches installed package dependencies for quicker runtime
- It is compatible with
monorepos
- allowing the developer to specify a subdirectory in which all packages live as a top levelpaths:
filter, and then specific subdirectories (using dorney/paths-filter) which will ensure the Action only runs when files in these specific subdirectories are modified
See the PRs of this repo for examples:
- Create a
.github/workflows
directory in the top level of your repo / monorepo - Copy the .github/workflows/R-CMD-check.yaml
file into this
.github/workflows
directory - Modify the
paths:
part of the YAML file to specify the subdirectory in which all your packages live (or delete it altogether if there is no specific subdirectory where they all live):
name: R-CMD-check
on:
pull_request:
branches:
- main
- master
paths:
- 'packages/**' # << the subdirectory where your packages live goes here
- Add the package directories to
matrix.pkgs
. Thelabel
will be used in a filename, so avoid spaces.
strategy:
fail-fast: false
matrix:
pkgs: # << list the individual directories where each package lives
- {label: app-one, dir: packages/app.one}
- {label: app-two, dir: packages/app.two}
config:
- {os: macOS-latest, r: 'release'}
- Make pull requests and stuff
Simply remove it from the matrix.path
:
strategy:
fail-fast: false
matrix:
pkgs: # << list the individual directories where each package lives
# - {label: app-one, dir: packages/app.one} (commented out so not checked)
- {label: app-two, dir: packages/app.two}
config:
- {os: macOS-latest, r: 'release'}
You can skip all checks (as long as the settings for your repo permit) for all
actions by adding [skip ci]
to the commit message before pushing. Read more
here.
An example of this can be seen on this PR in this repo.