Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install dependencies from package repositories #200

Merged
merged 8 commits into from
Nov 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading