From adb0a37fb90d65335fb3731408565802f4b2860b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Fri, 20 Dec 2024 14:58:37 +0000 Subject: [PATCH 1/5] feat: allow custom repositories --- .gitignore | 4 ++++ action.yaml | 9 ++++++++- r-verdepcheck-action.Rproj | 17 +++++++++++++++++ script.R | 9 +++++++-- 4 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 .gitignore create mode 100644 r-verdepcheck-action.Rproj diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5b6a065 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +.Rproj.user +.Rhistory +.RData +.Ruserdata diff --git a/action.yaml b/action.yaml index e31d3ff..45e7e8d 100644 --- a/action.yaml +++ b/action.yaml @@ -24,6 +24,13 @@ inputs: description: Optional value of build_args argument to rcmdcheck::rcmdcheck in form of a string with space as delimeter, e.g. "--force --keep-empty-dirs". required: false default: "" + additional-repos: + description: | + Optional value that add R repositories for a given strategy (multiple repos per strategy can be defined by separating with a comma). + Example usage: + additional-repos: https://repo1.example.com,https://repo2.example.com + required: false + default: "" strategy: description: | Strategy to test package dependencies. One of: min_isolated, min_cohort, release, max. @@ -57,7 +64,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.extra-deps }}' '${{ 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 }}' '${{ inputs.additional-repos }}' shell: bash env: GITHUB_PAT: "${{ inputs.github-token }}" diff --git a/r-verdepcheck-action.Rproj b/r-verdepcheck-action.Rproj new file mode 100644 index 0000000..84e8a4d --- /dev/null +++ b/r-verdepcheck-action.Rproj @@ -0,0 +1,17 @@ +Version: 1.0 +ProjectId: e3332795-a944-4d3d-a820-49a444b08471 + +RestoreWorkspace: Default +SaveWorkspace: Default +AlwaysSaveHistory: Default + +EnableCodeIndexing: Yes +UseSpacesForTab: Yes +NumSpacesForTab: 2 +Encoding: UTF-8 + +RnwWeave: Sweave +LaTeX: pdfLaTeX + +AutoAppendNewline: Yes +StripTrailingWhitespace: Yes diff --git a/script.R b/script.R index 80ecc93..f186230 100644 --- a/script.R +++ b/script.R @@ -8,9 +8,9 @@ catnl_param <- function(x = "") { if (length(x) == 0) cat(var_string, "(empty)\n") else cat(var_string, x, "\n") } -catnl("Install required packages") +catnl("-- \033[1mInstall required packages\033[22m ------") -install.packages(c("remotes", "cli"), quiet = TRUE, verbose = FALSE) +install.packages(c("remotes", "cli", "rlang"), 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 @@ -20,12 +20,17 @@ extra_deps <- args[2] build_args <- strsplit(args[3], " ")[[1]] check_args <- strsplit(args[4], " ")[[1]] strategy <- args[5] +additional_repositories <- strsplit(args[6], ",")[[1]] cli::cli_h1("Cat script parameters") catnl_param(path) catnl_param(extra_deps) catnl_param(build_args) catnl_param(check_args) +catnl_param(strategy) +catnl_param(additional_repositories) + +rlang::local_options(repos = c(options("repos"), additional_repositories)) cli::cli_h1("Execute verdepcheck...") fun <- switch( From 73853b39812f7fb8a5c2eebe59f02077d31b5ff6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Fri, 20 Dec 2024 15:00:34 +0000 Subject: [PATCH 2/5] style: small improvement on first (manual) header message --- script.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script.R b/script.R index f186230..199388c 100644 --- a/script.R +++ b/script.R @@ -8,7 +8,7 @@ catnl_param <- function(x = "") { if (length(x) == 0) cat(var_string, "(empty)\n") else cat(var_string, x, "\n") } -catnl("-- \033[1mInstall required packages\033[22m ------") +catnl("\n── \033[1mInstall required packages\033[22m ────────────") install.packages(c("remotes", "cli", "rlang"), quiet = TRUE, verbose = FALSE) remotes::install_github("insightsengineering/verdepcheck", quiet = TRUE, verbose = FALSE) From d2c01ce5e04dff157dd5b758451a954a335555dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Fri, 20 Dec 2024 15:09:15 +0000 Subject: [PATCH 3/5] docs: style readme --- README.md | 69 +++++++++++------------------------------------------ action.yaml | 14 +++++------ script.R | 2 +- 3 files changed, 22 insertions(+), 63 deletions(-) diff --git a/README.md b/README.md index 7419729..672de44 100644 --- a/README.md +++ b/README.md @@ -18,70 +18,29 @@ When executed for A, script would read A's `DESCRIPTION` file, determine version Please see [`verdepcheck`](https://github.com/insightsengineering/verdepcheck) package documentation for details. ## Action type + Composite ## Author -Insights Engineering - -## Inputs -* `github-token`: - - _Description_: Token with permissions to clone repositories with dependencies. - - _Required_: `false` - - _Default_: `""` - -* `repository-path`: - - _Description_: Directory where the checked package has been cloned. - - _Required_: `false` - - _Default_: `repository` - -* `extra-deps`: - - _Description_: Extra dependencies specified similarly as in the `DESCRIPTION` file, i.e. `" ( )"` where both `` and `` are optional. Multiple entries are possible separated by `";"`. - - _Required_: `false` - - _Default_: `""` -* `check-args`: +[Insights Engineering](https://github.com/insightsengineering/) - _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` - - _Default_: `""` - -* `build-args`: - - _Description_: Optional value of `build_args` argument to `rcmdcheck::rcmdcheck` in form of a string with space as delimeter, e.g. `"--force --keep-empty-dirs"`. - - _Required_: `false` - - _Default_: `""` - -* `strategy`: - - _Description_: Strategy for dependency test, should be one of: min, release, max. - - _Required_: `true` - -* `additional-env-vars`: - - _Description_: Additional environment variables. - - _Required_: `false` - - _Default_: `""` +## Inputs +| Input | Description | Required | Default | +| -------------- | --------------------------------------------------------------- | ------- | ---- | +| `github-token` | Token with permissions to clone repositories with dependencies. | _no_ | `""` | +| `repository-path` | Directory where the checked package has been cloned. | _no_ | `"repository"` | +| `extra-deps` | Extra dependencies specified similarly as in the `DESCRIPTION` file, i.e. `" ( )"` where both `` and `` are optional. Multiple entries are possible separated by `";"`. | _no_ | `""` | +| `check-args` | Optional value of `args` argument to `rcmdcheck::rcmdcheck` in form of a string with space as delimeter, e.g. `"--no-examples --no-tests"`. | `false` | `""` | +| `build-args` | Optional value of `build_args` argument to `rcmdcheck::rcmdcheck` in form of a string with space as delimeter, e.g. `"--force --keep-empty-dirs"`. | `false` | `""` | +| `strategy` | Strategy for dependency test, should be one of: min, release, max. | _yes_ | | +| `additional-env-vars` | Additional environment variables. | _no_ | `""` | +| `additional-repos` | Optional value that add R repositories for a given strategy. Multiple entries are possible separated by `";"`. | _no_ | `""` | ## Outputs -None +_None_ ## Usage diff --git a/action.yaml b/action.yaml index 45e7e8d..20638fc 100644 --- a/action.yaml +++ b/action.yaml @@ -24,13 +24,6 @@ inputs: description: Optional value of build_args argument to rcmdcheck::rcmdcheck in form of a string with space as delimeter, e.g. "--force --keep-empty-dirs". required: false default: "" - additional-repos: - description: | - Optional value that add R repositories for a given strategy (multiple repos per strategy can be defined by separating with a comma). - Example usage: - additional-repos: https://repo1.example.com,https://repo2.example.com - required: false - default: "" strategy: description: | Strategy to test package dependencies. One of: min_isolated, min_cohort, release, max. @@ -44,6 +37,13 @@ inputs: XYZ=456 required: false default: "" + additional-repos: + description: | + Optional value that add R repositories for a given strategy (multiple repos per strategy can be defined by separating with a comma). + Example usage: + additional-repos: https://repo1.example.com,https://repo2.example.com + required: false + default: "" branding: icon: 'refresh-ccw' diff --git a/script.R b/script.R index 199388c..85dc417 100644 --- a/script.R +++ b/script.R @@ -20,7 +20,7 @@ extra_deps <- args[2] build_args <- strsplit(args[3], " ")[[1]] check_args <- strsplit(args[4], " ")[[1]] strategy <- args[5] -additional_repositories <- strsplit(args[6], ",")[[1]] +additional_repositories <- strsplit(args[6], ";")[[1]] cli::cli_h1("Cat script parameters") catnl_param(path) From 91d5b00e0c78b26702e6541e8f90b44813f83e72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Fri, 20 Dec 2024 15:16:59 +0000 Subject: [PATCH 4/5] fix: remove extra line added by mistake --- script.R | 1 - 1 file changed, 1 deletion(-) diff --git a/script.R b/script.R index 85dc417..daede25 100644 --- a/script.R +++ b/script.R @@ -27,7 +27,6 @@ catnl_param(path) catnl_param(extra_deps) catnl_param(build_args) catnl_param(check_args) -catnl_param(strategy) catnl_param(additional_repositories) rlang::local_options(repos = c(options("repos"), additional_repositories)) From 09f4c0af9b982314e705bedd062150138cc7c640 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Fri, 20 Dec 2024 15:18:15 +0000 Subject: [PATCH 5/5] chore: ignore R and rstudio files --- .gitignore | 1 + r-verdepcheck-action.Rproj | 17 ----------------- 2 files changed, 1 insertion(+), 17 deletions(-) delete mode 100644 r-verdepcheck-action.Rproj diff --git a/.gitignore b/.gitignore index 5b6a065..feb9205 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ .Rhistory .RData .Ruserdata +r-verdepcheck-action.Rproj diff --git a/r-verdepcheck-action.Rproj b/r-verdepcheck-action.Rproj deleted file mode 100644 index 84e8a4d..0000000 --- a/r-verdepcheck-action.Rproj +++ /dev/null @@ -1,17 +0,0 @@ -Version: 1.0 -ProjectId: e3332795-a944-4d3d-a820-49a444b08471 - -RestoreWorkspace: Default -SaveWorkspace: Default -AlwaysSaveHistory: Default - -EnableCodeIndexing: Yes -UseSpacesForTab: Yes -NumSpacesForTab: 2 -Encoding: UTF-8 - -RnwWeave: Sweave -LaTeX: pdfLaTeX - -AutoAppendNewline: Yes -StripTrailingWhitespace: Yes