2017-06-21 17 views
4

对于在https://www.gitlab.com托管的项目,我想设置代码覆盖在CI的设置,所以它可以显示在任务列表如何启用作业列表代码覆盖率输出PHP项目上gitlab.com

job list in gitlab.com project

我的配置是这样的:

.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 

作业成功,但显示错误消息

错误:没有代码覆盖率驱动程序可

no code coverage found job output

我已经更新了setting for Test coverage parsing和正则表达式设置为

^\s*Lines:\s*\d+.\d+\% 

PHP/PHPUnit的例子。

当我运行命令

vendor/bin/phpunit --coverage-text --colors=never 

地方,我得到下面的输出:

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) 
+1

你在你的运动员失踪Xdebug的。 – Rufinus

+0

是的,这也是我想到的。有问题通过'apt-get'安装它,但它使用pecl。 – lordrhodos

回答

2

的问题是缺少Xdebug的安装搬运工形象。我无法安装使用apt-get一个正确的版本,所以我不得不在before_script部分添加一个pecl install xdebug电话:

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 Xdebug 
- pecl install xdebug 
- docker-php-ext-enable xdebug 

# Install composer 
- curl -sS https://getcomposer.org/installer | php 

# Install all project dependencies 
- php composer.phar install 

# Run our tests 
test: 
    only: 
     - master 
    script: 
     - vendor/bin/phpunit --configuration phpunit.xml --coverage-text --colors=never