I am deploying Django
application using Gitlab CI/CD
and pytest
for testing of code and pytest-cov
for generating coverage report
My .gitlab-ci.yml
stages:
- test
- deploy
image: python:3.6
test:
stage: test
script:
- pip install pipenv
- pipenv install
- pipenv run py.test src/
artifacts:
paths:
- htmlcov/
pages:
stage: deploy
dependencies:
- test
script:
- mv htmlcov/ public/
artifacts:
paths:
- public
expire_in: 30 days
only:
- master
staging:
stage: deploy
script:
- apt-get update -qy
- apt-get install -y ruby-dev
- gem install dpl
- dpl --provider=heroku --app=app-staging --api-key=$HEROKU_PRODUCTION_API_KEY
only:
- master
production:
stage: deploy
script:
- apt-get update -qy
- apt-get install -y ruby-dev
- gem install dpl
- dpl --provider=heroku --app=app-production --api-key=$HEROKU_PRODUCTION_API_KEY
when: manual
only:
- master
Since repository is under a group namespace, the url to the coverage report is
https://<group>.gitlab.io/<repository>/
For coverage report,
[![coverage report](https://gitlab.com/<group>/<repository>/badges/master/coverage.svg?job=coverage)](https://<group>.gitlab.io/<repository>/)
But this is displaying Unknown
I have setup Test Coverage parsing regex for python