|
| 1 | +# This file is a template, and might need editing before it works on your project. |
| 2 | +# Official language image. Look for the different tagged releases at: |
| 3 | +# https://hub.docker.com/r/library/plone/tags/ |
| 4 | +image: python:3.7-buster |
| 5 | + |
| 6 | +# Change pip's cache directory to be inside the project directory since we can |
| 7 | +# only cache local items. |
| 8 | +variables: |
| 9 | + PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip" |
| 10 | + |
| 11 | +# Pip's cache doesn't store the python packages |
| 12 | +# https://pip.pypa.io/en/stable/reference/pip_install/#caching |
| 13 | +# |
| 14 | +# If you want to also cache the installed packages, you have to install |
| 15 | +# them in a virtualenv and cache it as well. |
| 16 | +cache: |
| 17 | + paths: |
| 18 | + - .cache/pip |
| 19 | + - venv/ |
| 20 | + - downloads/ |
| 21 | + - eggs/ |
| 22 | + |
| 23 | +# Set execution order: first run jobs on 'test' stage on parallel |
| 24 | +# then run jobs on 'report' stage |
| 25 | +stages: |
| 26 | + - test |
| 27 | + - report |
| 28 | + |
| 29 | +before_script: |
| 30 | + - echo "deb http://ftp.de.debian.org/debian/ stretch main contrib non-free" >> /etc/apt/sources.list |
| 31 | + - apt-get update |
| 32 | + - apt-get install -y firefoxdriver |
| 33 | + - apt-get install -y xvfb |
| 34 | + - python -V # Print out python version for debugging |
| 35 | + - pip install virtualenv |
| 36 | + - export LC_CTYPE=en_US.UTF-8 |
| 37 | + - export LC_ALL=en_US.UTF-8 |
| 38 | + - export LANG=en_US.UTF-8 |
| 39 | + - python3 -m venv venv |
| 40 | + - source venv/bin/activate |
| 41 | + - pip install -r requirements.txt |
| 42 | + - buildout bootstrap |
| 43 | + - bin/buildout -n -c buildout.cfg |
| 44 | + |
| 45 | +code-analysis: |
| 46 | + stage: test |
| 47 | + # still not available, see: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/5004 |
| 48 | + # success_with_warnings: True |
| 49 | + script: |
| 50 | + - tox -e black-check |
| 51 | + - tox -e py37-lint |
| 52 | + |
| 53 | +test: |
| 54 | + stage: test |
| 55 | + script: |
| 56 | + - export DISPLAY=:99.0 |
| 57 | + # - sh -e /etc/init.d/xvfb start |
| 58 | + - tox -r |
| 59 | + |
| 60 | +coverage: |
| 61 | + stage: report |
| 62 | + script: |
| 63 | + - bin/createcoverage |
| 64 | + - bin/coverage html |
| 65 | + - bin/coverage report |
| 66 | + when: on_success |
| 67 | + |
| 68 | + coverage: '/TOTAL\s+\d+\s+\d+\s+(\d+\%)/' |
| 69 | + artifacts: |
| 70 | + paths: |
| 71 | + - htmlcov |
0 commit comments