From 3985a05eda65931a2f5e873280b970056796c327 Mon Sep 17 00:00:00 2001 From: David Klein Date: Wed, 24 Jan 2024 12:32:44 +0100 Subject: [PATCH] Send bot message also after REMIND automated model test to mattermost --- .buildlibrary | 2 +- .github/workflows/check.yaml | 1 + .pre-commit-config.yaml | 4 ++-- CITATION.cff | 4 ++-- DESCRIPTION | 6 +++--- R/modeltests.R | 26 ++++++++++++++++++++------ README.md | 8 ++++---- 7 files changed, 33 insertions(+), 18 deletions(-) diff --git a/.buildlibrary b/.buildlibrary index 9a97756..5a80af2 100644 --- a/.buildlibrary +++ b/.buildlibrary @@ -1,4 +1,4 @@ -ValidationKey: '29765240' +ValidationKey: '3159360' AcceptedWarnings: - 'Warning: package ''.*'' was built under R version' - 'Warning: namespace ''.*'' is not available and has been replaced' diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml index b75d0ed..870f216 100644 --- a/.github/workflows/check.yaml +++ b/.github/workflows/check.yaml @@ -23,6 +23,7 @@ jobs: - uses: r-lib/actions/setup-r-dependencies@v2 with: extra-packages: | + gamstransfer=?ignore any::lucode2 any::covr any::madrat diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7a47c41..2f13466 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,7 +3,7 @@ exclude: '^tests/testthat/_snaps/.*$' repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v4.5.0 hooks: - id: check-case-conflict - id: check-json @@ -15,7 +15,7 @@ repos: - id: mixed-line-ending - repo: https://github.com/lorenzwalthert/precommit - rev: v0.3.2.9021 + rev: v0.3.2.9025 hooks: - id: parsable-R - id: deps-in-desc diff --git a/CITATION.cff b/CITATION.cff index cd4bbfd..93652dd 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.15.14 -date-released: '2023-10-30' +version: 0.16.0 +date-released: '2024-01-24' abstract: A collection of tools to analyze model runs. authors: - family-names: Giannousakis diff --git a/DESCRIPTION b/DESCRIPTION index 239f6c2..0755f4a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: modelstats Type: Package Title: Run Analysis Tools -Version: 0.15.14 -Date: 2023-10-30 +Version: 0.16.0 +Date: 2024-01-24 Authors@R: c( person("Anastasis", "Giannousakis", email = "giannou@pik-potsdam.de", role = c("aut","cre")), person("Oliver", "Richters", role = "aut") @@ -30,5 +30,5 @@ URL: https://github.com/pik-piam/modelstats BugReports: https://github.com/pik-piam/modelstats/issues Encoding: UTF-8 License: LGPL-3 -RoxygenNote: 7.2.3 +RoxygenNote: 7.3.1 VignetteBuilder: knitr diff --git a/R/modeltests.R b/R/modeltests.R index 3b4dd0f..4fc0872 100644 --- a/R/modeltests.R +++ b/R/modeltests.R @@ -371,15 +371,29 @@ evaluateRuns <- function(model, mydir, gitPath, compScen, email, mattermostToken sendmail(path = gitdir, file = myfile, commitmessage = "Automated Test Results", remote = TRUE, reset = TRUE) } - if (!is.null(errorList) && !is.null(mattermostToken)) { - message <- paste0("Some ", + if (!test) saveRDS(commitTested, file = paste0(mydir, "/lastcommit.rds")) + + # send message to mattermost channel (for MAgPIE only if warnings/errors occur, for REMIND always display AMT status) + if (!is.null(mattermostToken)) { + message <- NULL + if (model == "REMIND") { + rs2 <- utils::capture.output(loopRuns(paths, user = NULL, colors = FALSE)) + message <- paste(c("Please find below the status of the latest REMIND automated model tests (AMT): ", "```", rs2, "```\n"), collapse = "\n") + } + if (!is.null(errorList)) { + message <- paste0(message, "Some ", model, - " tests produce warnings, check https://gitlab.pik-potsdam.de/", + " tests produce warnings. Please check ", + "https://gitlab.pik-potsdam.de/", ifelse(model == "MAgPIE", "landuse", model), - "/testing_suite") - .mattermostBotMessage(message = message, token = mattermostToken) + "/testing_suite", + ifelse(model == "REMIND", " or `rs2 -t`", "") + ) + } + if (!is.null(message)) { + .mattermostBotMessage(message = message, token = mattermostToken) + } } - if (!test) saveRDS(commitTested, file = paste0(mydir, "/lastcommit.rds")) message("Function 'evaluateRuns' finished.") } diff --git a/README.md b/README.md index d20fa2e..299eeb2 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Run Analysis Tools -R package **modelstats**, version **0.15.14** +R package **modelstats**, version **0.16.0** [![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.16.0, . A BibTeX entry for LaTeX users is @@ -55,8 +55,8 @@ A BibTeX entry for LaTeX users is @Manual{, title = {modelstats: Run Analysis Tools}, author = {Anastasis Giannousakis and Oliver Richters}, - year = {2023}, - note = {R package version 0.15.14}, + year = {2024}, + note = {R package version 0.16.0}, url = {https://github.com/pik-piam/modelstats}, } ```