Skip to content
Snippets Groups Projects
.gitlab-ci.yml 2.76 KiB
# SPDX-FileCopyrightText: 2021 Helmholtz-Zentrum für Umweltforschung GmbH - UFZ
#
# SPDX-License-Identifier: GPL-3.0-or-later

# ===========================================================
# preparation
# ===========================================================

variables:
  GIT_SUBMODULE_STRATEGY: recursive

default:
  image: python:3.8
  before_script:
    - pip install --upgrade pip
    - pip install pytest
    - pip install -r requirements.txt


# ===========================================================
# Testing stage
# ===========================================================

# check if everything is properly formatted
black:
  stage: test
  script:
    - pip install black
    - black --check .


# Check compliance with the REUSE specification
reuse_compliance:
  stage: test
  image:
    name: fsfe/reuse:latest
    entrypoint: [""]
  before_script:
    - echo "Override default 'before_script'..."
  script:
    - reuse lint


# make (visual) coverage in gitlab merge request diff's
coverage:
  stage: test
  allow_failure: true
  script:
    - pip install pytest-cov coverage
    - pytest --cov=saqc tests --ignore=tests/fuzzy -Werror
  after_script:
    - coverage xml
  # regex to find the coverage percentage in the job output
  coverage: '/^TOTAL.+?(\d+\%)$/'
  artifacts:
    when: always
    reports:
      cobertura: coverage.xml


# test saqc with python 3.7
python37:
  stage: test
  image: python:3.7
  script:
    - pytest tests dios/test -Werror --junitxml=report.xml
    - python -m saqc --config sphinxdoc/resources/data/config.csv --data sphinxdoc/resources/data/data.csv --outfile /tmp/test.csv
  artifacts:
    when: always
    reports: