Skip to content

Commit

Permalink
feat: add an option to choose between staged-dependencies and setup-r…
Browse files Browse the repository at this point in the history
…-dependencies
  • Loading branch information
walkowif committed Sep 9, 2024
1 parent 6a624d9 commit 1aad0ff
Show file tree
Hide file tree
Showing 6 changed files with 151 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/bioccheck.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,19 @@ on:
required: false
type: string
default: "."
deps-installation-method:
description: Which method for installing R package dependencies to use?
required: true
type: choice
default: staged-dependencies
options:
- staged-dependencies
- setup-r-dependencies
lookup-refs:
description: |
List of package references to be used by setup-r-dependencies action if deps-installation-method == 'setup-r-dependencies'.
required: false
default: ""

concurrency:
group: bioccheck-${{ github.event.pull_request.number || github.ref }}
Expand Down Expand Up @@ -122,12 +135,16 @@ jobs:
SKIP_INSTRUCTION: "[skip bioccheck]"

- name: Restore SD cache 💰
if: >-
inputs.deps-installation-method == 'staged-dependencies'
uses: actions/cache@v4
with:
key: sd-${{ runner.os }}-${{ github.event.repository.name }}
path: ~/.staged.dependencies

- name: Run Staged dependencies 🎦
if: >-
inputs.deps-installation-method == 'staged-dependencies'
uses: insightsengineering/staged-dependencies-action@v2
env:
GITHUB_PAT: ${{ steps.github-token.outputs.token }}
Expand All @@ -137,6 +154,14 @@ jobs:
run-system-dependencies: ${{ inputs.install-system-dependencies }}
direction: ${{ inputs.sd-direction }}

- name: Setup R dependencies 🎦
if: >-
inputs.deps-installation-method == 'setup-r-dependencies'
uses: insightsengineering/setup-r-dependencies@v1
with:
lookup-refs: ${{ inputs.lookup-refs }}
github-token: ${{ steps.github-token.outputs.token }}

- name: Run BiocCheck ☣️
uses: insightsengineering/bioc-check-action@v1
with:
Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/build-check-install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,23 @@ on:
description: |
Set this to a comma-separated named list of R packages repositories to use for installing dependencies.
Example: "R-universe=https://insightsengineering.r-universe.dev/,CRAN=https://cloud.r-project.org/"
If the value is non-empty, it takes precedence over deps-installation-method.
required: false
type: string
default: ""
deps-installation-method:
description: Which method for installing R package dependencies to use?
required: true
type: choice
default: staged-dependencies
options:
- staged-dependencies
- setup-r-dependencies
lookup-refs:
description: |
List of package references to be used by setup-r-dependencies action if deps-installation-method == 'setup-r-dependencies'.
required: false
default: ""
unit-test-report-brand:
description: Image URL to use in unit test report for branding. If empty, the default xunit-viewer brand will be used.
required: false
Expand Down Expand Up @@ -177,6 +191,8 @@ on:
enable-sd:
description: |
Whether the installation of package dependencies via staged.dependencies should be enabled.
Has no effect if deps-installation-method == 'setup-r-dependencies' or
install-deps-from-package-repositories is set to non-empty value.
required: false
type: boolean
default: true
Expand Down Expand Up @@ -373,6 +389,7 @@ jobs:
if: >-
env.enable_sd == 'true'
&& inputs.install-deps-from-package-repositories == ''
&& inputs.deps-installation-method == 'staged-dependencies'
uses: insightsengineering/staged-dependencies-action@v2
env:
GITHUB_PAT: ${{ steps.github-token.outputs.token }}
Expand All @@ -382,6 +399,15 @@ jobs:
run-system-dependencies: ${{ inputs.install-system-dependencies }}
direction: ${{ inputs.sd-direction }}

- name: Setup R dependencies 🎦
if: >-
inputs.deps-installation-method == 'setup-r-dependencies'
inputs.install-deps-from-package-repositories == ''
uses: insightsengineering/setup-r-dependencies@v1
with:
lookup-refs: ${{ inputs.lookup-refs }}
github-token: ${{ steps.github-token.outputs.token }}

- name: Install dependencies from package repositories 🗄️
if: inputs.install-deps-from-package-repositories != ''
run: |
Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,19 @@ on:
required: false
type: string
default: ""
deps-installation-method:
description: Which method for installing R package dependencies to use?
required: true
type: choice
default: staged-dependencies
options:
- staged-dependencies
- setup-r-dependencies
lookup-refs:
description: |
List of package references to be used by setup-r-dependencies action if deps-installation-method == 'setup-r-dependencies'.
required: false
default: ""

concurrency:
group: docs-${{ github.event.pull_request.number || github.ref }}
Expand Down Expand Up @@ -194,12 +207,16 @@ jobs:
SKIP_INSTRUCTION: "[skip docs]"

- name: Restore SD cache 💰
if: >-
inputs.deps-installation-method == 'staged-dependencies'
uses: actions/cache@v4
with:
key: sd-${{ runner.os }}-${{ github.event.repository.name }}
path: ~/.staged.dependencies

- name: Run Staged dependencies 🎦
if: >-
inputs.deps-installation-method == 'staged-dependencies'
uses: insightsengineering/staged-dependencies-action@v2
env:
GITHUB_PAT: ${{ steps.github-token.outputs.token }}
Expand All @@ -209,6 +226,14 @@ jobs:
run-system-dependencies: ${{ inputs.install-system-dependencies }}
direction: ${{ inputs.sd-direction }}

- name: Setup R dependencies 🎦
if: >-
inputs.deps-installation-method == 'setup-r-dependencies'
uses: insightsengineering/setup-r-dependencies@v1
with:
lookup-refs: ${{ inputs.lookup-refs }}
github-token: ${{ steps.github-token.outputs.token }}

- name: Install R package 🚧
run: |
if (file.exists("renv.lock")) renv::restore()
Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/roxygen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,19 @@ on:
required: false
type: string
default: "."
deps-installation-method:
description: Which method for installing R package dependencies to use?
required: true
type: choice
default: staged-dependencies
options:
- staged-dependencies
- setup-r-dependencies
lookup-refs:
description: |
List of package references to be used by setup-r-dependencies action if deps-installation-method == 'setup-r-dependencies'.
required: false
default: ""
secrets:
REPO_GITHUB_TOKEN:
description: |
Expand Down Expand Up @@ -109,12 +122,16 @@ jobs:
SKIP_INSTRUCTION: "[skip roxygen]"

- name: Restore SD cache 💰
if: >-
inputs.deps-installation-method == 'staged-dependencies'
uses: actions/cache@v4
with:
key: sd-${{ runner.os }}-${{ github.event.repository.name }}
path: ~/.staged.dependencies

- name: Run Staged dependencies 🎦
if: >-
inputs.deps-installation-method == 'staged-dependencies'
uses: insightsengineering/staged-dependencies-action@v2
env:
GITHUB_PAT: ${{ steps.github-token.outputs.token }}
Expand All @@ -124,6 +141,14 @@ jobs:
run-system-dependencies: ${{ inputs.install-system-dependencies }}
direction: ${{ inputs.sd-direction }}

- name: Setup R dependencies 🎦
if: >-
inputs.deps-installation-method == 'setup-r-dependencies'
uses: insightsengineering/setup-r-dependencies@v1
with:
lookup-refs: ${{ inputs.lookup-refs }}
github-token: ${{ steps.github-token.outputs.token }}

- name: Generate man pages 📄
run: |
logfile <- "roxygen_${{ github.event.repository.name }}.log"
Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,19 @@ on:
required: false
type: string
default: ""
deps-installation-method:
description: Which method for installing R package dependencies to use?
required: true
type: choice
default: staged-dependencies
options:
- staged-dependencies
- setup-r-dependencies
lookup-refs:
description: |
List of package references to be used by setup-r-dependencies action if deps-installation-method == 'setup-r-dependencies'.
required: false
default: ""
secrets:
REPO_GITHUB_TOKEN:
description: |
Expand Down Expand Up @@ -207,12 +220,16 @@ jobs:
fi
- name: Restore SD cache 💰
if: >-
inputs.deps-installation-method == 'staged-dependencies'
uses: actions/cache@v4
with:
key: sd-${{ runner.os }}-${{ github.event.repository.name }}
path: ~/.staged.dependencies

- name: Run Staged dependencies 🎦
if: >-
inputs.deps-installation-method == 'staged-dependencies'
uses: insightsengineering/staged-dependencies-action@v2
env:
GITHUB_PAT: ${{ secrets.REPO_GITHUB_TOKEN }}
Expand All @@ -222,6 +239,14 @@ jobs:
run-system-dependencies: ${{ inputs.install-system-dependencies }}
direction: ${{ inputs.sd-direction }}

- name: Setup R dependencies 🎦
if: >-
inputs.deps-installation-method == 'setup-r-dependencies'
uses: insightsengineering/setup-r-dependencies@v1
with:
lookup-refs: ${{ inputs.lookup-refs }}
github-token: ${{ steps.github-token.outputs.token }}

- name: Install R package 🚧
run: |
if (file.exists("renv.lock")) renv::restore()
Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/validation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,19 @@ on:
required: false
type: string
default: "."
deps-installation-method:
description: Which method for installing R package dependencies to use?
required: true
type: choice
default: staged-dependencies
options:
- staged-dependencies
- setup-r-dependencies
lookup-refs:
description: |
List of package references to be used by setup-r-dependencies action if deps-installation-method == 'setup-r-dependencies'.
required: false
default: ""
secrets:
REPO_GITHUB_TOKEN:
description: |
Expand Down Expand Up @@ -111,12 +124,16 @@ jobs:
shell: bash

- name: Restore SD cache 💰
if: >-
inputs.deps-installation-method == 'staged-dependencies'
uses: actions/cache@v4
with:
key: sd-${{ runner.os }}-${{ github.event.repository.name }}
path: ~/.staged.dependencies

- name: Run Staged dependencies 🎦
if: >-
inputs.deps-installation-method == 'staged-dependencies'
uses: insightsengineering/staged-dependencies-action@v2
env:
GITHUB_PAT: ${{ steps.github-token.outputs.token }}
Expand All @@ -126,6 +143,14 @@ jobs:
run-system-dependencies: ${{ inputs.install-system-dependencies }}
direction: ${{ inputs.sd-direction }}

- name: Setup R dependencies 🎦
if: >-
inputs.deps-installation-method == 'setup-r-dependencies'
uses: insightsengineering/setup-r-dependencies@v1
with:
lookup-refs: ${{ inputs.lookup-refs }}
github-token: ${{ steps.github-token.outputs.token }}

- name: Build report 🏗
uses: insightsengineering/thevalidatoR@v2
env:
Expand Down

0 comments on commit 1aad0ff

Please sign in to comment.