Please consider using insightsengineering/setup-r-dependencies instead.
Github Action to install R package and system dependencies, based on the {staged.dependencies} R package.
NOTE: For the time being, this action only supports installation of system dependencies for Ubuntu OS. Other OSes will be supported upon request.
The staged.dependencies package simplifies the development process for developing a set of
interdependent R packages. In each repository of the set of R packages you are co-developing you should
specify a staged_dependencies.yaml file containing upstream (i.e. those packages your current repo depends on) and
downstream (i.e. those packages which depend on your current repo's package)
dependency packages within your development set of packages.
An example of the output of the action can be seen below:
To get started, follow these instructions:
- (Optional) Create
staged_dependencies.yamlfile with this guide. - Create a new file in your repository called
.github/workflows/r-check.yml. - Copy the example workflow from below into that new file. Add additional configurations as needed.
- Commit and push the
.github/workflows/r-check.ymlfile to a new branch. - Open up a pull request and witness dependencies being installed during the workflow run.
---
name: Check R package
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
check:
runs-on: ubuntu-latest
name: Check
container:
image: rocker/verse:4.1.0
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Run Staged dependencies
uses: insightsengineering/staged-dependencies-action@v1
with:
run-system-dependencies: true
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
- name: Build R package
run: |
R CMD build ${{ github.event.repository.name }}
echo "PKGBUILD=$(echo *.tar.gz)" >> $GITHUB_ENV
shell: bash
- name: Check R package
run: R CMD check --no-manual ${{ env.PKGBUILD }}
shell: bash
- name: Install R package
run: R CMD INSTALL ${{ env.PKGBUILD }}
shell: bashThe following options are available are available for this action:
-
run-system-dependencies:Description: Check for and install system dependencies
Required:
falseDefault:
False -
git-user-name:Description: Git user.name configuration for fetching remote staged dependencies
Required:
falseDefault:
github-actions[bot] -
git-user-email:Description: Git user.email configuration for fetching remote staged dependencies
Required:
falseDefault:
27856297+dependabot-preview[bot]@users.noreply.github.com -
path:Description: Path to the R package
Required:
falseDefault:
. -
version:Description: Version of {staged.dependencies} to use. This action is compatilble with
>=v0.2.2Required:
falseDefault:
v0.3.1 -
threads:Description: Number of threads to use. Set to 'auto' to use max available threads
Required:
falseDefault:
auto -
cran-repos:Description: Map of CRAN repositories delimited by comma
Required:
falseDefault:
CRAN=https://cloud.r-project.org -
enable-bioc-repos:Description: Add
BiocManager::repositories()to option reposRequired:
falseDefault:
False -
token-mapping:Description: Token mapping that is used in
staged.dependencies.token_mappingdelimited by comma. Note that you will need to set these tokens with their respective values as environment variables while using this action.Required:
falseDefault:
https://github.com=GITHUB_PAT,https://gitlab.com=GITLAB_PAT -
enable-check:Description: Run
check_yamls_consistentbefore installation of dependenciesRequired:
falseDefault:
False -
git-ref:Description: Git reference to use as a reference stage for installing dependencies
Required:
falseDefault:
${{ github.ref }} -
renv-restore:Description: Restore dependencies from
renv.lock, if it existsRequired:
falseDefault:
True -
quiet:Description: If TRUE, suppress output
Required:
falseDefault:
True -
direction:Description: The direction to use to install dependencies. Choose between 'upstream', 'downstream' and 'all'
Required:
falseDefault:
all
None
