Skip to content
Snippets Groups Projects
.gitlab-ci.yml 2.34 KiB
variables:
  PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
  DOCKER_HOST: tcp://docker:2375
  DOCKER_DRIVER: overlay2
  CONTAINER_TEST_IMAGE: docker.km3net.de/test/orcasong:$CI_COMMIT_REF_SLUG
  CONTAINER_RELEASE_IMAGE: docker.km3net.de/orcasong:$CI_COMMIT_TAG
  CONTAINER_LATEST_IMAGE: docker.km3net.de/orcasong:latest


stages:
  - test
  - coverage
  - doc
  - docker
  - release


cache:
  paths:
    - .cache/pip
    - venv/
  key: "$CI_COMMIT_REF_SLUG"


.virtualenv_template: &virtualenv_definition |
  python -V
  pip install virtualenv
  virtualenv venv
  source venv/bin/activate
  make install


test:
    image: docker.km3net.de/base/python:3.6
    stage: test
    script:
        - *virtualenv_definition
        - make test


coverage:
    image: docker.km3net.de/base/python:3.6
    stage: coverage
    script:
        - *virtualenv_definition
        - "make test-cov|grep TOTAL| awk '{printf \"COVERAGE: %.2f%%\", (1-$3/$2)*100 }'"
    coverage: '/COVERAGE:\s*([0-9]*\.[0-9]*%)/'
    artifacts:
        paths:
            - reports/coverage


code-style:
    image: docker.km3net.de/base/python:3.7
    stage: test
    script:
        - *virtualenv_definition
        - yapf -r -d -e "venv" .
    allow_failure: true


pages:
    image: docker.km3net.de/base/python:3.6
    stage: doc
    script:
        - *virtualenv_definition
        - cd docs && make html
        - mv _build/html/ ../public/
        - cd .. && mv reports/coverage public/coverage
    artifacts: