The-MEO/PyLeihe

View on GitHub
.gitlab-ci.yml

Summary

Maintainability
Test Coverage
stages:
  - test
  - docu
  - deploy

include:
  - template: Code-Quality.gitlab-ci.yml
  - template: Dependency-Scanning.gitlab-ci.yml
  - template: SAST.gitlab-ci.yml
  - template: License-Scanning.gitlab-ci.yml

default:
  image: python:3.6-alpine

pytest:3.6:
  stage: test
  artifacts:
    paths:
      - htmlcov
      - coverage.xml
      - .coverage
    reports:
      junit: pjunit.xml
    expire_in: 30 days
  before_script:
    - pip install -r requirements.txt
    - pip install -r requirements_tools.txt
  script:
    - pytest 


pytest:3:
  stage: test
  image: python:3
  artifacts:
    paths:
      - htmlcov3
      - coverage3.xml
    expire_in: 30 days
  before_script:
    - pip install -r requirements.txt
    - pip install -r requirements_tools.txt
  script:
    - pytest
  after_script:
    - mv htmlcov htmlcov3
    - mv coverage.xml coverage3.xml

pdoc:
  stage: docu
  artifacts:
    paths:
      - doc/PyLeihe
    expire_in: 30 days
  before_script:
    - pip install -r requirements.txt
    - pip install -r requirements_tools.txt
  script:
    - pdoc --html -o ./doc -f PyLeihe

coverage:
  stage: docu
  dependencies:
    - pytest:3.6
  allow_failure: true
  variables:
    GIT_BRANCH: $CI_COMMIT_REF_NAME
    GIT_COMMIT_SHA: $CI_COMMIT_SHA
  before_script:
    - pip install codecov codacy-coverage coveralls
    - apk --no-cache add git
    - wget -O cc-test-reporter https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64
    - chmod +x ./cc-test-reporter
    - ./cc-test-reporter before-build
  script:
    - codecov
    - python-codacy-coverage -r coverage.xml
    - coveralls
    - ./cc-test-reporter after-build --coverage-input-type coverage.py coverage.xml

pages:
  stage: deploy
  script:
    - mv doc/PyLeihe public/
    - mv htmlcov public/htmlcov
    - mv htmlcov3 public/htmlcov3
  artifacts:
    paths:
      - public
    expire_in: 30 days
  only:
    - master
    - /.*pages.*$/