From 40aa7d3edf9389c84a2ad29ab4d79fe5ee956c64 Mon Sep 17 00:00:00 2001 From: pharmaverse-bot <113703390+pharmaverse-bot@users.noreply.github.com> Date: Tue, 7 Nov 2023 11:15:33 +0100 Subject: [PATCH] test checks on maintenance versions --- .github/workflows/r-cmd-check.yml | 48 ++++++++++++++++++++----------- DESCRIPTION | 2 +- 2 files changed, 32 insertions(+), 18 deletions(-) diff --git a/.github/workflows/r-cmd-check.yml b/.github/workflows/r-cmd-check.yml index d0cdce37..46c4e2e0 100644 --- a/.github/workflows/r-cmd-check.yml +++ b/.github/workflows/r-cmd-check.yml @@ -87,28 +87,42 @@ jobs: _R_CHECK_CRAN_INCOMING_REMOTE_: false _R_CHECK_FORCE_SUGGESTS_: false run: | - script=" + description_old <- readLines("DESCRIPTION") + description_dat <- description_old + for (i in seq_along(description_dat)) { + if (grepl("^Version:", description_dat[i])) { + current_version <- sub("^Version: ", "", description_dat[i]) + version_parts <- strsplit(current_version, "\\.")[[1]] + + # check if maintenance version - if yes, temp update the DESCRIPTION for rcmdchecks + if (length(version_parts) == 4) { + print("Maintenance version detected (format X.Y.Z.M with M >= 9000)") + version_parts <- version_parts[1:3] + } + + new_version <- paste(version_parts, collapse = ".") + description_dat[i] <- paste("Version: ", new_version) + } + } + + # Write the updated DESCRIPTION file back + writeLines(description_dat, con = description_file_path) + + if (!requireNamespace("rcmdcheck", quietly = TRUE)) install.packages("rcmdcheck") options(crayon.enabled = TRUE) - check_error_on <- '${{ inputs.error-on }}' - if (check_error_on == '') { - check_error_on <- 'note' + check_error_on <- "${{ inputs.error-on }}" + if (check_error_on == "") { + check_error_on <- "note" } rcmdcheck::rcmdcheck( - args = c('--no-manual', '--as-cran'), + args = c("--no-manual", "--as-cran"), error_on = check_error_on, - check_dir = 'check' - )" - - if [ ${{ matrix.config.r }} == "devel" ]; then - R -e "install.packages('rcmdcheck')" - fi - - echo "$script" > checks.R - - Rscript checks.R + check_dir = "check" + ) - rm -f checks.R - shell: bash + # Write back initial description file + writeLines(description_dat, con = description_file_path) + shell: Rscript {0} - name: Upload check results if: failure() diff --git a/DESCRIPTION b/DESCRIPTION index 3fb8017e..c89d1fcf 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: admiralci Type: Package Title: ADaM in R Asset Library - CI/CD Workflows -Version: 0.0.1 +Version: 0.0.1.9001 Authors@R: c( person("Open", "Source", email = "admiralci@pharmaverse.com", role = c("aut", "cre"))) Description: A set of common CI/CD workflows originally designed and developed for