Skip to content
Snippets Groups Projects
.gitlab-ci.yml 3.15 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

stages:
  - compliance
  - test
  - deploy

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

# ===========================================================
# Compliance stage
# ===========================================================

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

# check if imports are sorted
isort:
  stage: compliance
  script:
    - pip install isort
    - isort --check .

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


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

# 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