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 (#252)
  • Loading branch information
walkowif authored Sep 27, 2024
1 parent 037472a commit b7c75cf
Show file tree
Hide file tree
Showing 7 changed files with 177 additions and 1 deletion.
27 changes: 27 additions & 0 deletions .github/workflows/bioccheck.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,20 @@ on:
required: false
type: string
default: "."
deps-installation-method:
description: |
Which method for installing R package dependencies to use? Supported values are:
staged-dependencies
setup-r-dependencies
required: false
type: string
default: staged-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
type: string
default: ""

concurrency:
group: bioccheck-${{ github.event.pull_request.number || github.ref }}
Expand Down Expand Up @@ -122,12 +136,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 +155,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'
uses: insightsengineering/setup-r-dependencies@v1
with:
lookup-refs: ${{ inputs.lookup-refs }}
github-token: ${{ steps.github-token.outputs.token }}
repository-path: ${{ github.event.repository.name }}

- name: Run BiocCheck ☣️
uses: insightsengineering/bioc-check-action@v1
with:
Expand Down
34 changes: 33 additions & 1 deletion .github/workflows/build-check-install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,21 @@ 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? Supported values are:
staged-dependencies
setup-r-dependencies
required: false
type: string
default: staged-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
type: string
default: ""
Expand Down Expand Up @@ -177,6 +192,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 @@ -319,12 +336,14 @@ jobs:
junit_xml_positive_threshold="${{ inputs.junit-xml-positive-threshold }}"
junit_xml_negative_threshold="${{ inputs.junit-xml-negative-threshold }}"
enable_sd="${{ inputs.enable-sd }}"
deps_installation_method="${{ inputs.deps-installation-method }}"
echo "junit_xml_storage=${junit_xml_storage_input:-_junit_xml_reports}" >> $GITHUB_ENV
echo "junit_xml_diff_branch=${junit_xml_diff_branch_input:-main}" >> $GITHUB_ENV
echo "junit_xml_comparison=${junit_xml_comparison_input:-true}" >> $GITHUB_ENV
echo "junit_xml_positive_threshold=${junit_xml_positive_threshold:-1.0}" >> $GITHUB_ENV
echo "junit_xml_negative_threshold=${junit_xml_negative_threshold:-1.0}" >> $GITHUB_ENV
echo "enable_sd=${enable_sd:-true}" >> $GITHUB_ENV
echo "deps_installation_method=${deps_installation_method:-staged-dependencies}" >> $GITHUB_ENV
shell: bash

- name: Restore npm cache 💰
Expand Down Expand Up @@ -356,7 +375,9 @@ jobs:
shell: bash

- name: Restore SD cache 💰
if: inputs.install-deps-from-package-repositories == ''
if: >-
inputs.install-deps-from-package-repositories == ''
&& env.deps_installation_method == 'staged-dependencies'
uses: actions/cache@v4
with:
key: sd-${{ runner.os }}-${{ github.event.repository.name }}
Expand All @@ -373,6 +394,7 @@ jobs:
if: >-
env.enable_sd == 'true'
&& inputs.install-deps-from-package-repositories == ''
&& env.deps_installation_method == 'staged-dependencies'
uses: insightsengineering/staged-dependencies-action@v2
env:
GITHUB_PAT: ${{ steps.github-token.outputs.token }}
Expand All @@ -382,6 +404,16 @@ jobs:
run-system-dependencies: ${{ inputs.install-system-dependencies }}
direction: ${{ inputs.sd-direction }}

- name: Setup R dependencies 🎦
if: >-
env.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 }}
repository-path: ${{ github.event.repository.name }}

- name: Install dependencies from package repositories 🗄️
if: inputs.install-deps-from-package-repositories != ''
run: |
Expand Down
27 changes: 27 additions & 0 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,20 @@ on:
required: false
type: string
default: ""
deps-installation-method:
description: |
Which method for installing R package dependencies to use? Supported values are:
staged-dependencies
setup-r-dependencies
required: false
type: string
default: staged-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
type: string
default: ""

concurrency:
group: docs-${{ github.event.pull_request.number || github.ref }}
Expand Down Expand Up @@ -194,12 +208,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 +227,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'
uses: insightsengineering/setup-r-dependencies@v1
with:
lookup-refs: ${{ inputs.lookup-refs }}
github-token: ${{ steps.github-token.outputs.token }}
repository-path: ${{ github.event.repository.name }}

- name: Install R package 🚧
run: |
if (file.exists("renv.lock")) renv::restore()
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/rhub.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ jobs:
lookup-refs: ${{ inputs.lookup-refs }}
skip-install: true
github-token: ${{ steps.github-token.outputs.token }}
restore-description: false

- uses: r-hub/actions/setup-deps@v1
with:
Expand Down Expand Up @@ -151,6 +152,7 @@ jobs:
lookup-refs: ${{ inputs.lookup-refs }}
skip-install: true
github-token: ${{ steps.github-token.outputs.token }}
restore-description: false

- uses: r-hub/actions/setup-deps@v1
with:
Expand Down
34 changes: 34 additions & 0 deletions .github/workflows/roxygen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,21 @@ on:
required: false
type: string
default: "."
deps-installation-method:
description: |
Which method for installing R package dependencies to use? Supported values are:
staged-dependencies
setup-r-dependencies
required: false
type: string
default: staged-dependencies
lookup-refs:
description: |
Passed to insightsengineering/setup-r-dependencies. See its documentation.
Used only if deps-installation-method == 'setup-r-dependencies'.
required: false
type: string
default: ""
secrets:
REPO_GITHUB_TOKEN:
description: |
Expand Down Expand Up @@ -108,13 +123,23 @@ jobs:
env:
SKIP_INSTRUCTION: "[skip roxygen]"

- name: Normalize variables 📏
run: |
deps_installation_method="${{ inputs.deps-installation-method }}"
echo "deps_installation_method=${deps_installation_method:-staged-dependencies}" >> $GITHUB_ENV
shell: bash

- name: Restore SD cache 💰
if: >-
env.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: >-
env.deps_installation_method == 'staged-dependencies'
uses: insightsengineering/staged-dependencies-action@v2
env:
GITHUB_PAT: ${{ steps.github-token.outputs.token }}
Expand All @@ -124,6 +149,15 @@ jobs:
run-system-dependencies: ${{ inputs.install-system-dependencies }}
direction: ${{ inputs.sd-direction }}

- name: Setup R dependencies 🎦
if: >-
env.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 }}
repository-path: ${{ github.event.repository.name }}

- name: Generate man pages 📄
run: |
logfile <- "roxygen_${{ github.event.repository.name }}.log"
Expand Down
27 changes: 27 additions & 0 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,20 @@ on:
required: false
type: string
default: ""
deps-installation-method:
description: |
Which method for installing R package dependencies to use? Supported values are:
staged-dependencies
setup-r-dependencies
required: false
type: string
default: staged-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
type: string
default: ""
secrets:
REPO_GITHUB_TOKEN:
description: |
Expand Down Expand Up @@ -207,12 +221,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 +240,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'
uses: insightsengineering/setup-r-dependencies@v1
with:
lookup-refs: ${{ inputs.lookup-refs }}
github-token: ${{ steps.github-token.outputs.token }}
repository-path: ${{ github.event.repository.name }}

- name: Install R package 🚧
run: |
if (file.exists("renv.lock")) renv::restore()
Expand Down
27 changes: 27 additions & 0 deletions .github/workflows/validation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,20 @@ on:
required: false
type: string
default: "."
deps-installation-method:
description: |
Which method for installing R package dependencies to use? Supported values are:
staged-dependencies
setup-r-dependencies
required: false
type: string
default: staged-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
type: string
default: ""
secrets:
REPO_GITHUB_TOKEN:
description: |
Expand Down Expand Up @@ -111,12 +125,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 +144,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'
uses: insightsengineering/setup-r-dependencies@v1
with:
lookup-refs: ${{ inputs.lookup-refs }}
github-token: ${{ steps.github-token.outputs.token }}
repository-path: ${{ env.package_subdirectory }}

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

0 comments on commit b7c75cf

Please sign in to comment.