Skip to content

Commit

Permalink
Merge pull request #20 from insightsengineering/add_extra
Browse files Browse the repository at this point in the history
Add option to install extra deps
  • Loading branch information
pawelru authored Jun 25, 2024
2 parents 745a7b0 + 06b4559 commit 0bbf95f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 8 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@ Insights Engineering

_Default_: `repository`

* `extra-deps`:

_Description_: Extra dependencies specified similarly as in the `DESCRIPTION` file, i.e. `"<package name> (<operator> <version>)"` where both `<operator>` and `<version>` are optional. Multiple entries are possible separated by `";"`.

_Required_: `false`

_Default_: `""`

* `check-args`:

_Description_: Optional value of `args` argument to `rcmdcheck::rcmdcheck` in form of a string with space as delimeter, e.g. `"--no-examples --no-tests"`.
Expand Down
8 changes: 6 additions & 2 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ inputs:
description: Directory where the checked package has been cloned.
required: false
default: "."
extra-deps:
description: Extra dependencies specified similarly as in the `DESCRIPTION` file, i.e. `"<package name> (<operator> <version>)"` where both `<operator>` and `<version>` are optional. Multiple entries are possible separated by `";"`.
required: false
default: ""
check-args:
description: Optional value of args argument to rcmdcheck::rcmdcheck in form of a string with space as delimeter, e.g. "--no-examples --no-tests".
required: false
Expand All @@ -22,7 +26,7 @@ inputs:
default: ""
strategy:
description: |
Strategy to test package dependencies. One of: min, release, max.
Strategy to test package dependencies. One of: min_isolated, min_cohort, release, max.
required: true
additional-env-vars:
description: |
Expand Down Expand Up @@ -53,7 +57,7 @@ runs:
echo ".libPaths(\" \", include.site = FALSE)" > .Rprofile
export R_LIBS_SITE=" "
export R_LIBS_USER=" "
Rscript ${GITHUB_ACTION_PATH}/script.R '${{ inputs.repository-path }}' '${{ inputs.build-args }}' '${{ inputs.check-args }}' '${{ inputs.strategy }}'
Rscript ${GITHUB_ACTION_PATH}/script.R '${{ inputs.repository-path }}' '${{ inputs.extra-deps }}' '${{ inputs.build-args }}' '${{ inputs.check-args }}' '${{ inputs.strategy }}'
shell: bash
env:
GITHUB_PAT: "${{ inputs.github-token }}"
Expand Down
13 changes: 7 additions & 6 deletions script.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,18 @@ install.packages(c("remotes", "cli"), quiet = TRUE, verbose = FALSE)
remotes::install_github("insightsengineering/verdepcheck", quiet = TRUE, verbose = FALSE)
remotes::install_github("r-lib/rcmdcheck#196", quiet = TRUE, verbose = FALSE) # TODO: remove when merged / linked issue fixed

args <- commandArgs(trailingOnly = TRUE)
args <- trimws(commandArgs(trailingOnly = TRUE))
path <- normalizePath(file.path(".", args[1]))
build_args <- strsplit(args[2], " ")[[1]]
check_args <- strsplit(args[3], " ")[[1]]
strategy <- strsplit(args[4], " ")[[1]]
extra_deps <- args[2]
build_args <- strsplit(args[3], " ")[[1]]
check_args <- strsplit(args[4], " ")[[1]]
strategy <- args[5]

cli::cli_h1("Cat script parameters")
catnl_param(path)
catnl_param(extra_deps)
catnl_param(build_args)
catnl_param(check_args)
catnl_param(strategy)

cli::cli_h1("Execute verdepcheck...")
fun <- switch(
Expand All @@ -35,7 +36,7 @@ fun <- switch(
"max" = verdepcheck::max_deps_check,
stop("Unknown strategy")
)
x <- fun(path, check_args = check_args, build_args = build_args)
x <- fun(path, extra_deps = extra_deps, check_args = check_args, build_args = build_args)
saveRDS(x, "res.RDS")

cli::cli_h1("Debug output:")
Expand Down

0 comments on commit 0bbf95f

Please sign in to comment.