From e7a1f396661db7ecc9aa14df7eb64f94870d62f0 Mon Sep 17 00:00:00 2001
From: Michael Kuron <mkuron@icp.uni-stuttgart.de>
Date: Mon, 25 Jan 2021 16:59:20 +0100
Subject: [PATCH] Display pytest results in Gitlab

---
 .gitlab-ci.yml | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index f1d029fa..0b937e38 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -22,7 +22,7 @@ tests-and-coverage:
     - pip install git+https://gitlab-ci-token:${CI_JOB_TOKEN}@i10git.cs.fau.de/pycodegen/pystencils.git@master#egg=pystencils
     - env
     - pip list
-    - py.test -v -n $NUM_CORES --cov-report html --cov-report term --cov=. -m "not longrun"
+    - py.test -v -n $NUM_CORES --cov-report html --cov-report term --cov=. -m "not longrun" --junitxml=report.xml
   tags:
     - docker
     - cuda11
@@ -31,6 +31,8 @@ tests-and-coverage:
     when: always
     paths:
       - coverage_report
+    reports:
+      junit: report.xml
 
 # Nightly test  - runs "long run" jobs only
 test-longrun:
@@ -46,14 +48,17 @@ test-longrun:
     - mkdir -p ~/.config/matplotlib
     - echo "backend:template" > ~/.config/matplotlib/matplotlibrc
     - pip install git+https://gitlab-ci-token:${CI_JOB_TOKEN}@i10git.cs.fau.de/pycodegen/pystencils.git@master#egg=pystencils
-    - py.test -v -n $NUM_CORES --cov-report html --cov-report term --cov=.
+    - py.test -v -n $NUM_CORES --cov-report html --cov-report term --cov=. --junitxml=report.xml
   tags:
     - docker
     - cuda11
     - AVX
   artifacts:
+    when: always
     paths:
       - coverage_report
+    reports:
+      junit: report.xml
 
 # Minimal tests in windows environment
 minimal-windows:
@@ -84,10 +89,14 @@ ubuntu:
     - pip3 install git+https://gitlab-ci-token:${CI_JOB_TOKEN}@i10git.cs.fau.de/pycodegen/pystencils.git@master#egg=pystencils
     - env
     - pip3 list
-    - pytest-3 -v -m "not longrun"
+    - pytest-3 -v -m "not longrun" --junitxml=report.xml
   tags:
     - docker
     - cuda11
+  artifacts:
+    when: always
+    reports:
+      junit: report.xml
 
 minimal-conda:
   stage: test
-- 
GitLab