From 1f4cef63a6426ee37ba3e7ad3bfb576835a2e723 Mon Sep 17 00:00:00 2001
From: Rebecca Kohlhaas <rebecca.kohlhaas@iws.uni-stuttgart.de>
Date: Fri, 28 Jun 2024 15:37:41 +0000
Subject: [PATCH] Pipeline: run tests only if there are changes in the sources
 or tests. Added first try of running the examples as well.

---
 .gitlab-ci.yml | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 813160022..9bb07c56b 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -66,12 +66,24 @@ unit-test-job:   # This job runs in the test stage.
     - pytest --junitxml=report.xml
     #- python -m pytest # tests/
   artifacts:
-  artifacts:
-    when: always
     paths:
       - report.xml
     reports:
       junit: report.xml
+  rules:
+    - changes:
+       - src/**/*
+       - tests/**/*
+      when: always
+
+
+example-test-job:
+  stage: test
+  script: 
+    - pip install -e .
+    - python examples/analytical-function/example_analytical_function.py
+    - echo "Example `analytical-function` ran through."
+  when: always
 
 lint-test-job:   # This job also runs in the test stage.
   stage: test    # It can run at the same time as unit-test-job (in parallel).
-- 
GitLab