For a project hosted at https://www.gitlab.com I would like to setup code coverage in the CI setup, so it can be displayed in the job list
My configuration looks like this:
.gitlab-ci.yml
image: php:7.1.1
cache:
paths:
- vendor/
before_script:
# Install git, the php image doesn't have installed
- apt-get update -yqq
- apt-get install git -yqq
# Install composer
- curl -sS https://getcomposer.org/installer | php
# Install all project dependencies
- php composer.phar install
# Run our tests
test:
only:
- master
- develop
script:
- vendor/bin/phpunit --configuration phpunit.xml --coverage-text --colors=never
The job succeeds, but shows the error message
Error: No code coverage driver is available
I have updated the setting for Test coverage parsing and set the regex to
^\s*Lines:\s*\d+.\d+\%
the example for PHP/PHPUnit.
When I run the command
vendor/bin/phpunit --coverage-text --colors=never
locally, I get the following output:
Code Coverage Report:
2017-06-21 14:52:55
Summary:
Classes: 100.00% (4/4)
Methods: 100.00% (14/14)
Lines: 100.00% (43/43)
\Rodacker\CartExample::Article
Methods: 100.00% ( 6/ 6) Lines: 100.00% ( 11/ 11)
\Rodacker\CartExample::ArticleLoader
Methods: 100.00% ( 2/ 2) Lines: 100.00% ( 21/ 21)
\Rodacker\CartExample::ArticleRepository
Methods: 100.00% ( 3/ 3) Lines: 100.00% ( 6/ 6)
\Rodacker\CartExample::Image
Methods: 100.00% ( 3/ 3) Lines: 100.00% ( 5/ 5)
apt-get
but it works using pecl. – Amand