Skip to content

Commit

Permalink
Install dependencies from package repositories (#200)
Browse files Browse the repository at this point in the history
  • Loading branch information
walkowif authored Nov 28, 2023
1 parent 76959c9 commit cf2a2b6
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/build-check-install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,13 @@ on:
required: false
type: string
default: upstream
install-deps-from-package-repositories:
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/"
required: false
type: string
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 @@ -304,12 +311,14 @@ jobs:
path: ${{ github.event.repository.name }}

- name: Restore SD cache 💰
if: inputs.install-deps-from-package-repositories == ''
uses: actions/cache@v3
with:
key: sd-${{ runner.os }}-${{ github.event.repository.name }}
path: ~/.staged.dependencies

- name: Run Staged dependencies 🎦
if: inputs.install-deps-from-package-repositories == ''
uses: insightsengineering/staged-dependencies-action@v1
env:
GITHUB_PAT: ${{ steps.github-token.outputs.token }}
Expand All @@ -319,6 +328,19 @@ jobs:
run-system-dependencies: ${{ inputs.install-system-dependencies }}
direction: ${{ inputs.sd-direction }}

- name: Install dependencies from package repositories 🗄️
if: inputs.install-deps-from-package-repositories != ''
run: |
split_to_map <- function(args) {
tmp <- strsplit(x = unlist(strsplit(args, ",")), "=")
content <- unlist(lapply(tmp, function(x) x[2]))
names(content) <- unlist(lapply(tmp, function(x) x[1]))
return(content)
}
devtools::install_dev_deps(".", repos = split_to_map("${{ inputs.install-deps-from-package-repositories }}"))
shell: Rscript {0}
working-directory: ${{ github.event.repository.name }}/${{ inputs.package-subdirectory }}

- name: Show session info and installed packages ℹ
run: |
sessionInfo()
Expand Down

0 comments on commit cf2a2b6

Please sign in to comment.