From ffec93924029ba25d2af4d6c40ed895517d6c930 Mon Sep 17 00:00:00 2001
From: Bert Palm <bert.palm@ufz.de>
Date: Fri, 12 Mar 2021 16:16:55 +0100
Subject: [PATCH] new CI

---
 .gitlab-ci.yml | 79 ++++++++++++++++++++++++++++++++------------------
 1 file changed, 50 insertions(+), 29 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index c014ef029..6de191455 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,46 +1,67 @@
 variables:
   GIT_SUBMODULE_STRATEGY: recursive
 
+
+default:
+  image: python:3.8
+
+
 before_script:
-  - export DEBIAN_FRONTEND=noninteractive
-  - apt-get -qq update
-  - apt-get -qq install -y make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev python-openssl git > /dev/null
-  - export DEBIAN_FRONTEND=dialog
-  - export LC_ALL=C.UTF-8
-  - export LANG=C.UTF-8
-  - git clone https://github.com/pyenv/pyenv.git ~/.pyenv
-  - export PYENV_ROOT="$HOME/.pyenv"
-  - export PATH="$PYENV_ROOT/bin:$PATH"
-  - eval "$(pyenv init -)"
-
-
-test:python37:
+  - pip install --upgrade pip
+  - pip install pytest
+  - pip install -r requirements.txt
+
+
+# test saqc with python 3.7
+python37:
+  stage: test
+  image: python:3.7
   script:
-    - pyenv install 3.7.5
-    - pyenv shell 3.7.5
-    - pip install --upgrade pip
-    - pip install -r requirements.txt
-    - python -m pytest --ignore test/lib test
+    - pytest tests/core tests/flagger tests/funcs
     - python -m saqc --config ressources/data/config_ci.csv --data ressources/data/data.csv --outfile /tmp/test.csv
 
 
-test:python38:
+# test saqc with python 3.8
+python38:
+  stage: test
   script:
-    - pyenv install 3.8.0
-    - pyenv shell 3.8.0
-    - pip install --upgrade pip
-    - pip install -r requirements.txt
-    - python -m pytest --ignore test/lib test
+    - pytest tests/core tests/flagger tests/funcs
     - python -m saqc --config ressources/data/config_ci.csv --data ressources/data/data.csv --outfile /tmp/test.csv
 
-# Make html docu with sphinx
+
+# test lib saqc
+testLib:
+  stage: test
+  script:
+    - pytest tests/lib
+
+
+# fuzzy testing saqc
+fuzzy:
+  stage: test
+  script:
+    - pytest tests/fuzzy
+  allow_failure: true
+
+
+# make (visual) coverage in gitlab merge request diff's
+coverage:
+  stage: test
+  script:
+    - pip install pytest-cov coverage
+    - pytest --cov=saqc tests/core tests/flagger tests/funcs
+    - coverage xml
+  # regex to find the coverage percentage in the job output
+  coverage: '/^TOTAL.+?(\d+\%)$/'
+  artifacts:
+    reports:
+      cobertura: coverage.xml
+
+
+# make html docu with sphinx
 pages:
   stage: deploy
   script:
-    - pyenv install 3.8.0
-    - pyenv shell 3.8.0
-    - pip install --upgrade pip
-    - pip install -r requirements.txt
     - cd sphinx-doc/
     - pip install -r requirements_sphinx.txt
     - make doc
-- 
GitLab