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.yaml
file 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.yml
file 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: bash
The following options are available are available for this action:
-
run-system-dependencies
:Description: Check for and install system dependencies
Required:
false
Default:
False
-
git-user-name
:Description: Git user.name configuration for fetching remote staged dependencies
Required:
false
Default:
github-actions[bot]
-
git-user-email
:Description: Git user.email configuration for fetching remote staged dependencies
Required:
false
Default:
27856297+dependabot-preview[bot]@users.noreply.github.com
-
path
:Description: Path to the R package
Required:
false
Default:
.
-
version
:Description: Version of {staged.dependencies} to use. This action is compatilble with
>=v0.2.2
Required:
false
Default:
v0.3.1
-
threads
:Description: Number of threads to use. Set to 'auto' to use max available threads
Required:
false
Default:
auto
-
cran-repos
:Description: Map of CRAN repositories delimited by comma
Required:
false
Default:
CRAN=https://cloud.r-project.org
-
enable-bioc-repos
:Description: Add
BiocManager::repositories()
to option reposRequired:
false
Default:
False
-
token-mapping
:Description: Token mapping that is used in
staged.dependencies.token_mapping
delimited by comma. Note that you will need to set these tokens with their respective values as environment variables while using this action.Required:
false
Default:
https://github.com=GITHUB_PAT,https://gitlab.com=GITLAB_PAT
-
enable-check
:Description: Run
check_yamls_consistent
before installation of dependenciesRequired:
false
Default:
False
-
git-ref
:Description: Git reference to use as a reference stage for installing dependencies
Required:
false
Default:
${{ github.ref }}
-
renv-restore
:Description: Restore dependencies from
renv.lock
, if it existsRequired:
false
Default:
True
-
quiet
:Description: If TRUE, suppress output
Required:
false
Default:
True
-
direction
:Description: The direction to use to install dependencies. Choose between 'upstream', 'downstream' and 'all'
Required:
false
Default:
all
None