Skip to content

insightsengineering/staged-dependencies-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Staged Dependencies Action

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:

Screenshot with example output

Table of Contents

Getting Started

To get started, follow these instructions:

  1. (Optional) Create staged_dependencies.yaml file with this guide.
  2. Create a new file in your repository called .github/workflows/r-check.yml.
  3. Copy the example workflow from below into that new file. Add additional configurations as needed.
  4. Commit and push the .github/workflows/r-check.yml file to a new branch.
  5. 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

Usage Options

The following options are available are available for this action:

Inputs

  • 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 repos

    Required: 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 dependencies

    Required: 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 exists

    Required: 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

Outputs

None