From 6017ff5fb18a29636be8151ea3b24a775f759101 Mon Sep 17 00:00:00 2001 From: David Klein Date: Tue, 5 Mar 2024 10:41:57 +0100 Subject: [PATCH 1/3] Include testthat result to mattermost bot message. Move log file created by `make test-full-slurm` to tests folder and append date tag. --- R/modeltests.R | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/R/modeltests.R b/R/modeltests.R index 8e746e4..e7e4ddc 100644 --- a/R/modeltests.R +++ b/R/modeltests.R @@ -154,9 +154,7 @@ startRuns <- function(test, model, mydir, gitPath, user) { withr::with_dir("magpie", { system(paste0(gitPath, " reset --hard origin/develop && ", gitPath, " pull")) }) - # 2. rename old test-full.log - system("mv test-full.log test-full-previous.log") - # 3. execute test + # 2. execute test system("make test-full-slurm") } else if (model == "MAgPIE") { @@ -371,16 +369,22 @@ evaluateRuns <- function(model, mydir, gitPath, compScen, email, mattermostToken } # Evaluate result of tests/testthat - logStatus <- NULL - try(logStatus <- readLines("../test-full.log", warn = FALSE)) - if (is.null(logStatus)) { - testthatResult <- "Could not check for the results of TESTTHAT, test-full.log not found" - } else if (! any(grep("FAIL", logStatus))) { - testthatResult <- "`make test-full` did not run properly. Check test-full.log" - } else if (any(grep("FAIL 1", logStatus))) { - testthatResult <- "Some tests FAIL in `make test-full`. Check test-full.log" + currentName <- "../test-full.log" + dateTag <- format(file.info(currentName)$mtime, "%Y-%m-%d") + if (is.na(dateTag)) { + testthatResult <- "Could not check for the results of `make test-full`, test-full.log not found" } else { - # "make test-full reports all tests PASS" + logStatus <- readLines(currentName, warn = FALSE) + logStatus <- tail(grep("\\[ FAIL", logStatus, value = TRUE)) + newName <- paste0("tests/test-full-", dateTag, ".log") + file.rename(from = currentName, to = paste0("../", newName)) + if (!isTRUE(grepl("FAIL", logStatus))) { + testthatResult <- paste("`make test-full` did not run properly. Check", newName) + } else if (!isTRUE(grepl("FAIL 0", logStatus) & grepl("WARN 0", logStatus) & grepl("SKIP 0", logStatus))) { + testthatResult <- paste0("Not all tests pass in `make test-full`: ", logStatus ,". Check ", newName) + } else { + testthatResult <- paste("All tests pass in `make test-full`:", logStatus) + } } } From 5156cc6d95ca8c6455c8791cc88eaa65d58f4f96 Mon Sep 17 00:00:00 2001 From: David Klein Date: Tue, 5 Mar 2024 10:49:19 +0100 Subject: [PATCH 2/3] build --- .buildlibrary | 2 +- CITATION.cff | 4 ++-- DESCRIPTION | 4 ++-- README.md | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.buildlibrary b/.buildlibrary index eb7db20..c642c4c 100644 --- a/.buildlibrary +++ b/.buildlibrary @@ -1,4 +1,4 @@ -ValidationKey: '3560940' +ValidationKey: '3581447' AcceptedWarnings: - 'Warning: package ''.*'' was built under R version' - 'Warning: namespace ''.*'' is not available and has been replaced' diff --git a/CITATION.cff b/CITATION.cff index a9ae5f2..0336187 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -2,8 +2,8 @@ cff-version: 1.2.0 message: If you use this software, please cite it using the metadata from this file. type: software title: 'modelstats: Run Analysis Tools' -version: 0.18.0 -date-released: '2024-03-01' +version: 0.18.1 +date-released: '2024-03-05' abstract: A collection of tools to analyze model runs. authors: - family-names: Giannousakis diff --git a/DESCRIPTION b/DESCRIPTION index 272b7c4..2653835 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: modelstats Type: Package Title: Run Analysis Tools -Version: 0.18.0 -Date: 2024-03-01 +Version: 0.18.1 +Date: 2024-03-05 Authors@R: c( person("Anastasis", "Giannousakis", email = "giannou@pik-potsdam.de", role = c("aut","cre")), person("Oliver", "Richters", role = "aut") diff --git a/README.md b/README.md index 75109e9..99b5008 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Run Analysis Tools -R package **modelstats**, version **0.18.0** +R package **modelstats**, version **0.18.1** [![CRAN status](https://www.r-pkg.org/badges/version/modelstats)](https://cran.r-project.org/package=modelstats) [![R build status](https://github.com/pik-piam/modelstats/workflows/check/badge.svg)](https://github.com/pik-piam/modelstats/actions) [![codecov](https://codecov.io/gh/pik-piam/modelstats/branch/master/graph/badge.svg)](https://app.codecov.io/gh/pik-piam/modelstats) [![r-universe](https://pik-piam.r-universe.dev/badges/modelstats)](https://pik-piam.r-universe.dev/builds) @@ -47,7 +47,7 @@ In case of questions / problems please contact Anastasis Giannousakis . +Giannousakis A, Richters O (2024). _modelstats: Run Analysis Tools_. R package version 0.18.1, . A BibTeX entry for LaTeX users is @@ -56,7 +56,7 @@ A BibTeX entry for LaTeX users is title = {modelstats: Run Analysis Tools}, author = {Anastasis Giannousakis and Oliver Richters}, year = {2024}, - note = {R package version 0.18.0}, + note = {R package version 0.18.1}, url = {https://github.com/pik-piam/modelstats}, } ``` From 9b4612d0ea0624aef91df59e31d0bb968fbd6ec1 Mon Sep 17 00:00:00 2001 From: David Klein Date: Tue, 5 Mar 2024 11:22:27 +0100 Subject: [PATCH 3/3] Remove condition that no testthat tests must be skipped. --- R/modeltests.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/modeltests.R b/R/modeltests.R index e7e4ddc..6f84c1f 100644 --- a/R/modeltests.R +++ b/R/modeltests.R @@ -380,7 +380,7 @@ evaluateRuns <- function(model, mydir, gitPath, compScen, email, mattermostToken file.rename(from = currentName, to = paste0("../", newName)) if (!isTRUE(grepl("FAIL", logStatus))) { testthatResult <- paste("`make test-full` did not run properly. Check", newName) - } else if (!isTRUE(grepl("FAIL 0", logStatus) & grepl("WARN 0", logStatus) & grepl("SKIP 0", logStatus))) { + } else if (!isTRUE(grepl("FAIL 0", logStatus) & grepl("WARN 0", logStatus))) { testthatResult <- paste0("Not all tests pass in `make test-full`: ", logStatus ,". Check ", newName) } else { testthatResult <- paste("All tests pass in `make test-full`:", logStatus)