From 82d2e069ef85888e5d5fdd0e6df6723648f0f9c6 Mon Sep 17 00:00:00 2001 From: Lucidiot Date: Wed, 30 Jan 2019 19:49:21 +0100 Subject: [PATCH] Try to add Codecov coverage in CI --- .coveragerc | 2 ++ .gitlab-ci.yml | 32 +++++++++++++++++++++----------- requirements-dev.txt | 2 ++ 3 files changed, 25 insertions(+), 11 deletions(-) create mode 100644 .coveragerc diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 0000000..c660552 --- /dev/null +++ b/.coveragerc @@ -0,0 +1,2 @@ +[run] +include=urbantz/* diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f7dbd75..cb9027f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,13 +1,27 @@ image: python:3.7 stages: - - lint + - test - deploy -flake8: - stage: lint +variables: + PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip" - before_script: - - pip install .[dev] +before_script: + - pip install virtualenv + - virtualenv venv + - source venv/bin/activate + - pip install .[dev] + +tests: + stage: test + coverage: '/TOTAL[\s\d]+\s(\d+%)/' + script: + - coverage run setup.py test + - coverage report + - codecov + +flake8: + stage: test script: - flake8 @@ -20,7 +34,7 @@ deploy-pypi: name: pypi url: https://pypi.org/project/pyurbantz - before_script: + script: - pip install twine setuptools wheel - echo "[distutils]" > ~/.pypirc - echo "index-servers =" >> ~/.pypirc @@ -29,7 +43,6 @@ deploy-pypi: - echo "repository=https://upload.pypi.org/legacy/" >> ~/.pypirc - echo "username=$PYPI_DEPLOY_USERNAME" >> ~/.pypirc - echo "password=$PYPI_DEPLOY_PASSWORD" >> ~/.pypirc - script: - python setup.py sdist bdist_wheel - twine upload dist/* -r pypi @@ -42,7 +55,7 @@ deploy-testpypi: name: testpypi url: https://test.pypi.org/project/pyurbantz - before_script: + script: - pip install twine setuptools wheel - echo "[distutils]" > ~/.pypirc - echo "index-servers =" >> ~/.pypirc @@ -51,7 +64,6 @@ deploy-testpypi: - echo "repository=https://test.pypi.org/legacy/" >> ~/.pypirc - echo "username=$PYPI_DEPLOY_USERNAME" >> ~/.pypirc - echo "password=$PYPI_DEPLOY_PASSWORD" >> ~/.pypirc - script: - python setup.py sdist bdist_wheel - twine upload dist/* -r testpypi @@ -64,8 +76,6 @@ pages: paths: - public - before_script: - - pip install .[dev] script: - cd docs - make html diff --git a/requirements-dev.txt b/requirements-dev.txt index b1fce56..7d63c2a 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,2 +1,4 @@ flake8>=3.5 Sphinx>=1.8.1 +coverage>=4.5 +codecov>=2.0