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

Send bot message to mattermost (not only after MAgPIE but) also after REMIND automated model test #87

Merged
merged 1 commit into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion .buildlibrary
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: |
gamstransfer=?ignore
any::lucode2
any::covr
any::madrat
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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 = "[email protected]", role = c("aut","cre")),
person("Oliver", "Richters", role = "aut")
Expand Down Expand Up @@ -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
26 changes: 20 additions & 6 deletions R/modeltests.R
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
}
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -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)

Expand Down Expand Up @@ -47,16 +47,16 @@ In case of questions / problems please contact Anastasis Giannousakis <giannou@p

To cite package **modelstats** in publications use:

Giannousakis A, Richters O (2023). _modelstats: Run Analysis Tools_. R package version 0.15.14, <URL: https://github.com/pik-piam/modelstats>.
Giannousakis A, Richters O (2024). _modelstats: Run Analysis Tools_. R package version 0.16.0, <https://github.com/pik-piam/modelstats>.

A BibTeX entry for LaTeX users is

```latex
@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},
}
```