From 48277b1a241243430b32b22ee8c85abc52983b79 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dennis=20Gl=C3=A4ser?= <dennis.glaeser@iws.uni-stuttgart.de>
Date: Fri, 17 Mar 2023 14:33:34 +0100
Subject: [PATCH] [ci] check if examples are up-to-date

---
 .gitlab-ci.yml         |  1 +
 .gitlab-ci/default.yml | 18 ++++++++++++++++++
 2 files changed, 19 insertions(+)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 2bfb7ccdb2..287f62ebd5 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -114,6 +114,7 @@ full-dune-master-gcc-cpp-20:
     CXX_MAX_STANDARD: "20"
     DUMUX_ENABLE_CPPCHECK: "true"
     DUMUX_ENABLE_DOXYGEN_BUILD: "true"
+    DUMUX_CHECK_EXAMPLE_DOCS: "true"
 
 ##################################
 # additional scheduled pipelines #
diff --git a/.gitlab-ci/default.yml b/.gitlab-ci/default.yml
index 92112979e1..c1c66910fe 100644
--- a/.gitlab-ci/default.yml
+++ b/.gitlab-ci/default.yml
@@ -101,6 +101,24 @@ cppcheck:
   rules:
     - if: $DUMUX_ENABLE_CPPCHECK == "true"
 
+
+check-example-docs:
+  stage: linting
+  rules:
+  - if: $DUMUX_CHECK_EXAMPLE_DOCS == "true"
+    when: always
+  script:
+    - cd examples
+    - python3 generate_example_docs.py
+    - git diff . > example_diff.txt
+    - |
+      if [ -s example_diff.txt ]; then
+          cat example_diff.txt
+          echo "Example documentation is not up-to-date. Please rerun 'generate_example_docs.py'"
+          exit 1
+      fi
+
+
 select tests:
   stage: select
   script:
-- 
GitLab