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

Add option to install extra deps #20

Merged
merged 5 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
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
15 changes: 8 additions & 7 deletions script.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,21 @@
catnl("Install required packages")

install.packages(c("remotes", "cli"), quiet = TRUE, verbose = FALSE)
remotes::install_github("insightsengineering/verdepcheck", quiet = TRUE, verbose = FALSE)
remotes::install_github("insightsengineering/verdepcheck@add_extra", quiet = TRUE, verbose = FALSE)
pawelru marked this conversation as resolved.
Show resolved Hide resolved
remotes::install_github("r-lib/rcmdcheck#196", quiet = TRUE, verbose = FALSE) # TODO: remove when merged / linked issue fixed

Check warning on line 15 in script.R

View workflow job for this annotation

GitHub Actions / Lint Code Base

file=/github/workspace/script.R,line=15,col=121,[line_length_linter] Lines should not be more than 120 characters.

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 @@
"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 Expand Up @@ -65,7 +66,7 @@

# TODO: https://github.com/r-lib/pkgdepends/issues/305 - remove when fixed
# this provides additional debug info in case of empty error report
if (inherits(x$ip, "pkg_installation_proposal") &&

Check warning on line 69 in script.R

View workflow job for this annotation

GitHub Actions / Lint Code Base

file=/github/workspace/script.R,line=69,col=1,[cyclocomp_linter] Functions should have cyclomatic complexity of less than 15, this has 16.
inherits(x$ip$get_solution(), "pkg_solution_result") &&
x$ip$get_solution()$status == "FAILED" &&
inherits(x$ip$get_solution()$failures, "pkg_solution_failures") &&
Expand Down
Loading