Gitlab CI и PHPUnit Lumen — CI не работает, даже если тесты пройдены

По какой-то причине мое задание Gitlab CI, которое запускает тесты PHPUnit в приложении PHP Lumen, только что начало сбой — хотя тесты фактически все проходят.

Вот мой файл YAML:

    image: php:7.1.3

cache:
paths:
- vendor/

before_script:
- apt-get -qq update -y
- apt-get -qq install openssh-client -y
- apt-get -qq install git -y
- apt-get -qq install zip unzip
# setup the private key
- eval $(ssh-agent -s)
- ssh-add <(echo "$SSH_PRIVATE_KEY")
- mkdir -p ~/.ssh
- echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
- ssh -L 3306:127.0.0.1:3306 [email protected] -Nf
- curl -sS https://getcomposer.org/installer | php
- php composer.phar install

stages:
- testphpunit:
stage: test
script:
- vendor/bin/phpunit --configuration phpunit.xml || exit 1

Вот журнал сборки:

    [0KRunning with gitlab-ci-multi-runner 1.10.6 (2dadd48)[0;m
[0;m[0KUsing Docker executor with image php:7.1.3 ...
[0;m[0KPulling docker image php:7.1.3 ...
[0;mRunning on runner-2b6016b4-project-1032-concurrent-0 via xxx-iMac.local...
[32;1mFetching changes...[0;m
Removing composer.phar
Removing vendor/
HEAD is now at d08ea1a Restored CI yaml to how it was when it was passing, also changed some config attributes in phpunit xml file
From https://xxxxxxxxxx
d08ea1a..bd0955d  development -> origin/development
[32;1mChecking out bd0955d0 as development...[0;m
[32;1mSkipping Git submodules setup[0;m
[32;1mChecking cache for phpunit/development...[0;m
[32;1mSuccessfully extracted cache[0;m
[32;1m$ apt-get -qq update -y[0;m
[32;1m$ apt-get -qq install openssh-client -y[0;m
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package libxau6:amd64.
(Reading database ...
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 12253 files and directories currently installed.)
Preparing to unpack .../libxau6_1%3a1.0.8-1_amd64.deb ...
Unpacking libxau6:amd64 (1:1.0.8-1) ...
Selecting previously unselected package libxdmcp6:amd64.
Preparing to unpack .../libxdmcp6_1%3a1.1.1-1+b1_amd64.deb ...
Unpacking libxdmcp6:amd64 (1:1.1.1-1+b1) ...
Selecting previously unselected package libxcb1:amd64.
Preparing to unpack .../libxcb1_1.10-3+b1_amd64.deb ...
Unpacking libxcb1:amd64 (1.10-3+b1) ...
Selecting previously unselected package libx11-data.
Preparing to unpack .../libx11-data_2%3a1.6.2-3_all.deb ...
Unpacking libx11-data (2:1.6.2-3) ...
Selecting previously unselected package libx11-6:amd64.
Preparing to unpack .../libx11-6_2%3a1.6.2-3_amd64.deb ...
Unpacking libx11-6:amd64 (2:1.6.2-3) ...
Selecting previously unselected package libxext6:amd64.
Preparing to unpack .../libxext6_2%3a1.3.3-1_amd64.deb ...
Unpacking libxext6:amd64 (2:1.3.3-1) ...
Selecting previously unselected package libxmuu1:amd64.
Preparing to unpack .../libxmuu1_2%3a1.1.2-1_amd64.deb ...
Unpacking libxmuu1:amd64 (2:1.1.2-1) ...
Selecting previously unselected package openssh-client.
Preparing to unpack .../openssh-client_1%3a6.7p1-5+deb8u3_amd64.deb ...
Unpacking openssh-client (1:6.7p1-5+deb8u3) ...
Selecting previously unselected package xauth.
Preparing to unpack .../xauth_1%3a1.0.9-1_amd64.deb ...
Unpacking xauth (1:1.0.9-1) ...
Setting up libxau6:amd64 (1:1.0.8-1) ...
Setting up libxdmcp6:amd64 (1:1.1.1-1+b1) ...
Setting up libxcb1:amd64 (1.10-3+b1) ...
Setting up libx11-data (2:1.6.2-3) ...
Setting up libx11-6:amd64 (2:1.6.2-3) ...
Setting up libxext6:amd64 (2:1.3.3-1) ...
Setting up libxmuu1:amd64 (2:1.1.2-1) ...
Setting up openssh-client (1:6.7p1-5+deb8u3) ...
Setting up xauth (1:1.0.9-1) ...
Processing triggers for libc-bin (2.19-18+deb8u7) ...
[32;1m$ apt-get -qq install git -y[0;m
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package libpopt0:amd64.
(Reading database ...
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 12600 files and directories currently installed.)
Preparing to unpack .../libpopt0_1.16-10_amd64.deb ...
Unpacking libpopt0:amd64 (1.16-10) ...
Selecting previously unselected package libcurl3-gnutls:amd64.
Preparing to unpack .../libcurl3-gnutls_7.38.0-4+deb8u5_amd64.deb ...
Unpacking libcurl3-gnutls:amd64 (7.38.0-4+deb8u5) ...
Selecting previously unselected package libexpat1:amd64.
Preparing to unpack .../libexpat1_2.1.0-6+deb8u3_amd64.deb ...
Unpacking libexpat1:amd64 (2.1.0-6+deb8u3) ...
Selecting previously unselected package less.
Preparing to unpack .../archives/less_458-3_amd64.deb ...
Unpacking less (458-3) ...
Selecting previously unselected package patch.
Preparing to unpack .../patch_2.7.5-1_amd64.deb ...
Unpacking patch (2.7.5-1) ...
Selecting previously unselected package liberror-perl.
Preparing to unpack .../liberror-perl_0.17-1.1_all.deb ...
Unpacking liberror-perl (0.17-1.1) ...
Selecting previously unselected package git-man.
Preparing to unpack .../git-man_1%3a2.1.4-2.1+deb8u2_all.deb ...
Unpacking git-man (1:2.1.4-2.1+deb8u2) ...
Selecting previously unselected package git.
Preparing to unpack .../git_1%3a2.1.4-2.1+deb8u2_amd64.deb ...
Unpacking git (1:2.1.4-2.1+deb8u2) ...
Selecting previously unselected package rsync.
Preparing to unpack .../rsync_3.1.1-3_amd64.deb ...
Unpacking rsync (3.1.1-3) ...
Processing triggers for systemd (215-17+deb8u6) ...
Setting up libpopt0:amd64 (1.16-10) ...
Setting up libcurl3-gnutls:amd64 (7.38.0-4+deb8u5) ...
Setting up libexpat1:amd64 (2.1.0-6+deb8u3) ...
Setting up less (458-3) ...
debconf: unable to initialize frontend: Dialog
debconf: (TERM is not set, so the dialog frontend is not usable.)
debconf: falling back to frontend: Readline
Setting up patch (2.7.5-1) ...
Setting up liberror-perl (0.17-1.1) ...
Setting up git-man (1:2.1.4-2.1+deb8u2) ...
Setting up git (1:2.1.4-2.1+deb8u2) ...
Setting up rsync (3.1.1-3) ...
invoke-rc.d: policy-rc.d denied execution of restart.
Processing triggers for libc-bin (2.19-18+deb8u7) ...
Processing triggers for systemd (215-17+deb8u6) ...
[32;1m$ apt-get -qq install zip unzip[0;m
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package unzip.
(Reading database ...
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 13497 files and directories currently installed.)
Preparing to unpack .../unzip_6.0-16+deb8u2_amd64.deb ...
Unpacking unzip (6.0-16+deb8u2) ...
Selecting previously unselected package zip.
Preparing to unpack .../archives/zip_3.0-8_amd64.deb ...
Unpacking zip (3.0-8) ...
Setting up unzip (6.0-16+deb8u2) ...
Setting up zip (3.0-8) ...
[32;1m$ eval $(ssh-agent -s)[0;m
Agent pid 377
[32;1m$ ssh-add <(echo "$SSH_PRIVATE_KEY")[0;m
Identity added: /dev/fd/63 (rsa w/o comment)
[32;1m$ mkdir -p ~/.ssh[0;m
[32;1m$ echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config[0;m
[32;1m$ ssh -L 3306:127.0.0.1:3306 [email protected] -Nf[0;m
Warning: Permanently added '128.243.22.101' (ECDSA) to the list of known hosts.
[32;1m$ curl -sS https://getcomposer.org/installer | php[0;m
All settings correct for using Composer
Downloading...

Composer (version 1.4.1) successfully installed to: /builds/XXXXX/XXXX/composer.phar
Use it: php composer.phar

[32;1m$ php composer.phar install[0;m
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Package operations: 3 installs, 38 updates, 1 removal
- Removing symfony/yaml (v3.2.6)
- Updating symfony/debug (v3.2.6 => v3.2.7): Downloading (connecting...)Downloading (0%)           Downloading (5%)Downloading (15%)Downloading (20%)Downloading (25%)Downloading (35%)Downloading (40%)Downloading (55%)Downloading (60%)Downloading (75%)Downloading (80%)Downloading (100%)
- Updating symfony/console (v3.2.6 => v3.2.7): Downloading (connecting...)Downloading (0%)           Downloading (5%)Downloading (10%)Downloading (15%)Downloading (20%)Downloading (25%)Downloading (30%)Downloading (35%)Downloading (40%)Downloading (45%)Downloading (50%)Downloading (55%)Downloading (60%)Downloading (65%)Downloading (70%)Downloading (75%)Downloading (80%)Downloading (85%)Downloading (90%)Downloading (95%)Downloading (100%)
- Updating symfony/translation (v3.2.6 => v3.2.7): Downloading (connecting...)Downloading (0%)           Downloading (5%)Downloading (10%)Downloading (15%)Downloading (20%)Downloading (25%)Downloading (30%)Downloading (35%)Downloading (40%)Downloading (45%)Downloading (50%)Downloading (55%)Downloading (60%)Downloading (65%)Downloading (70%)Downloading (75%)Downloading (80%)Downloading (90%)Downloading (100%)
- Updating illuminate/contracts (v5.4.13 => v5.4.17): Downloading (connecting...)Downloading (0%)           Downloading (15%)Downloading (25%)Downloading (40%)Downloading (50%)Downloading (60%)Downloading (75%)Downloading (90%)Downloading (100%)
- Updating illuminate/support (v5.4.13 => v5.4.17): Downloading (connecting...)Downloading (0%)           Downloading (5%)Downloading (10%)Downloading (15%)Downloading (50%)Downloading (55%)Downloading (60%)Downloading (80%)Downloading (85%)Downloading (90%)Downloading (95%)Downloading (100%)
- Updating illuminate/console (v5.4.13 => v5.4.17): Downloading (connecting...)Downloading (0%)           Downloading (20%)Downloading (40%)Downloading (95%)Downloading (100%)
- Updating symfony/http-foundation (v3.2.6 => v3.2.7): Downloading (connecting...)Downloading (0%)           Downloading (5%)Downloading (10%)Downloading (15%)Downloading (20%)Downloading (25%)Downloading (30%)Downloading (35%)Downloading (40%)Downloading (45%)Downloading (50%)Downloading (55%)Downloading (60%)Downloading (65%)Downloading (70%)Downloading (75%)Downloading (80%)Downloading (85%)Downloading (90%)Downloading (95%)Downloading (100%)
- Updating symfony/finder (v3.2.6 => v3.2.7): Downloading (connecting...)Downloading (0%)           Downloading (5%)Downloading (10%)Downloading (15%)Downloading (20%)Downloading (25%)Downloading (35%)Downloading (40%)Downloading (45%)Downloading (80%)Downloading (85%)Downloading (90%)Downloading (95%)Downloading (100%)
- Updating illuminate/filesystem (v5.4.13 => v5.4.17): Downloading (connecting...)Downloading (0%)           Downloading (85%)Downloading (95%)Downloading (100%)
- Updating illuminate/session (v5.4.13 => v5.4.17): Downloading (connecting...)Downloading (0%)           Downloading (45%)Downloading (60%)Downloading (95%)Downloading (100%)
- Updating symfony/event-dispatcher (v3.2.6 => v3.2.7): Downloading (connecting...)Downloading (0%)           Downloading (5%)Downloading (10%)Downloading (15%)Downloading (65%)Downloading (70%)Downloading (75%)Downloading (80%)Downloading (100%)
- Updating symfony/http-kernel (v3.2.6 => v3.2.7): Downloading (connecting...)Downloading (0%)           Downloading (5%)Downloading (10%)Downloading (15%)Downloading (20%)Downloading (25%)Downloading (30%)Downloading (35%)Downloading (40%)Downloading (45%)Downloading (50%)Downloading (55%)Downloading (60%)Downloading (65%)Downloading (70%)Downloading (75%)Downloading (80%)Downloading (85%)Downloading (90%)Downloading (95%)Downloading (100%)
- Updating illuminate/container (v5.4.13 => v5.4.17): Downloading (connecting...)Downloading (0%)           Downloading (15%)Downloading (30%)Downloading (45%)Downloading (60%)Downloading (75%)Downloading (90%)Downloading (100%)
- Updating illuminate/events (v5.4.13 => v5.4.17): Downloading (connecting...)Downloading (0%)           Downloading (100%)
- Updating illuminate/view (v5.4.13 => v5.4.17): Downloading (connecting...)Downloading (0%)           Downloading (30%)Downloading (55%)Downloading (65%)Downloading (70%)Downloading (85%)Downloading (90%)Downloading (100%)
- Updating illuminate/translation (v5.4.13 => v5.4.17): Downloading (connecting...)Downloading (0%)           Downloading (50%)Downloading (100%)
- Updating illuminate/validation (v5.4.13 => v5.4.17): Downloading (connecting...)Downloading (0%)           Downloading (40%)Downloading (60%)Downloading (65%)Downloading (95%)Downloading (100%)
- Updating symfony/process (v3.2.6 => v3.2.7): Downloading (connecting...)Downloading (0%)           Downloading (25%)Downloading (50%)Downloading (60%)Downloading (75%)Downloading (80%)Downloading (85%)Downloading (100%)
- Updating illuminate/queue (v5.4.13 => v5.4.17): Downloading (connecting...)Downloading (0%)           Downloading (5%)Downloading (10%)Downloading (15%)Downloading (35%)Downloading (40%)Downloading (45%)Downloading (50%)Downloading (55%)Downloading (60%)Downloading (100%)
- Updating illuminate/pipeline (v5.4.13 => v5.4.17): Downloading (connecting...)Downloading (0%)           Downloading (40%)Downloading (100%)
- Updating illuminate/pagination (v5.4.13 => v5.4.17): Downloading (connecting...)Downloading (0%)           Downloading (25%)Downloading (50%)Downloading (100%)
- Updating illuminate/http (v5.4.13 => v5.4.17): Downloading (connecting...)Downloading (0%)           Downloading (50%)Downloading (55%)Downloading (85%)Downloading (90%)Downloading (100%)
- Updating illuminate/hashing (v5.4.13 => v5.4.17): Downloading (connecting...)Downloading (0%)           Downloading (100%)
- Updating illuminate/encryption (v5.4.13 => v5.4.17): Downloading (connecting...)Downloading (0%)           Downloading (100%)
- Updating illuminate/database (v5.4.13 => v5.4.17): Downloading (connecting...)Downloading (0%)           Downloading (5%)Downloading (10%)Downloading (15%)Downloading (20%)Downloading (25%)Downloading (30%)Downloading (35%)Downloading (40%)Downloading (45%)Downloading (50%)Downloading (55%)Downloading (60%)Downloading (65%)Downloading (70%)Downloading (75%)Downloading (80%)Downloading (85%)Downloading (90%)Downloading (95%)Downloading (100%)
- Updating illuminate/config (v5.4.13 => v5.4.17): Downloading (connecting...)Downloading (0%)           Downloading (100%)
- Updating illuminate/cache (v5.4.13 => v5.4.17): Downloading (connecting...)Downloading (0%)           Downloading (5%)Downloading (10%)Downloading (100%)
- Updating illuminate/bus (v5.4.13 => v5.4.17): Downloading (connecting...)Downloading (0%)           Downloading (100%)
- Updating illuminate/broadcasting (v5.4.13 => v5.4.17): Downloading (connecting...)Downloading (0%)           Downloading (55%)Downloading (85%)Downloading (100%)
- Updating illuminate/auth (v5.4.13 => v5.4.17): Downloading (connecting...)Downloading (0%)           Downloading (10%)Downloading (20%)Downloading (50%)Downloading (60%)Downloading (65%)Downloading (75%)Downloading (85%)Downloading (90%)Downloading (100%)
- Updating laravel/lumen-framework (v5.4.5 => v5.4.6): Downloading (connecting...)Downloading (0%)           Downloading (5%)Downloading (30%)Downloading (35%)Downloading (50%)Downloading (55%)Downloading (80%)Downloading (85%)Downloading (100%)
- Updating sebastian/recursion-context (2.0.0 => 3.0.0): Downloading (connecting...)Downloading (0%)           Downloading (35%)Downloading (70%)Downloading (100%)
- Installing sebastian/object-reflector (1.1.1): Downloading (connecting...)Downloading (0%)           Downloading (65%)Downloading (100%)
- Updating sebastian/object-enumerator (2.0.1 => 3.0.2): Downloading (connecting...)Downloading (0%)           Downloading (100%)
- Updating sebastian/exporter (2.0.0 => 3.1.0): Downloading (connecting...)Downloading (0%)           Downloading (100%)
- Updating sebastian/comparator (1.2.4 => 2.0.0): Downloading (connecting...)Downloading (0%)           Downloading (35%)Downloading (45%)Downloading (55%)Downloading (80%)Downloading (95%)Downloading (100%)
- Updating phpunit/phpunit-mock-objects (3.4.3 => 4.0.1): Downloading (connecting...)Downloading (0%)           Downloading (5%)Downloading (15%)Downloading (20%)Downloading (25%)Downloading (35%)Downloading (40%)Downloading (45%)Downloading (50%)Downloading (55%)Downloading (60%)Downloading (65%)Downloading (75%)Downloading (80%)Downloading (85%)Downloading (95%)Downloading (100%)
- Updating phpunit/php-code-coverage (4.0.8 => 5.1.0): Downloading (connecting...)Downloading (0%)           Downloading (5%)Downloading (10%)Downloading (15%)Downloading (20%)Downloading (25%)Downloading (30%)Downloading (35%)Downloading (40%)Downloading (45%)Downloading (50%)Downloading (55%)Downloading (60%)Downloading (65%)Downloading (75%)Downloading (80%)Downloading (90%)Downloading (95%)Downloading (100%)
- Installing phar-io/version (1.0.1): Downloading (connecting...)Downloading (0%)           Downloading (50%)Downloading (55%)Downloading (100%)
- Installing phar-io/manifest (1.0.1): Downloading (connecting...)Downloading (0%)           Downloading (10%)Downloading (20%)Downloading (30%)Downloading (45%)Downloading (60%)Downloading (70%)Downloading (85%)Downloading (90%)Downloading (100%)
- Updating phpunit/phpunit (5.7.18 => 6.1.0): Downloading (connecting...)Downloading (0%)           Downloading (5%)Downloading (10%)Downloading (15%)Downloading (20%)Downloading (25%)Downloading (30%)Downloading (35%)Downloading (40%)Downloading (45%)Downloading (50%)Downloading (55%)Downloading (60%)Downloading (65%)Downloading (80%)Downloading (85%)Downloading (90%)Downloading (95%)Downloading (100%)
Generating autoload files
[32;1m$ vendor/bin/phpunit --configuration phpunit.xml[0;m
PHPUnit 6.1.0 by Sebastian Bergmann and contributors.

........................W......................................  63 / 224 ( 28%)
..................................................W............ 126 / 224 ( 56%)
WW............................................................. 189 / 224 ( 84%)
...............WW..................                             224 / 224 (100%)

Time: 24.6 seconds, Memory: 38.00MB

There were 6 warnings:

1) Warning
No tests found in class "XX".

2) Warning
No tests found in class "XX".

3) Warning
No tests found in class "XX".

4) Warning
No tests found in class "XX".

5) Warning
No tests found in class "XX".

6) Warning
No tests found in class "XX".

WARNINGS!
Tests: 224, Assertions: 218, Warnings: 6.
[31;1mERROR: Build failed: exit code 1
[0;m

Как я уже сказал, эти тесты на самом деле проходят, и не потерпели неудачу с КИ всего несколько дней назад.

Кто-нибудь может посоветовать?

Версия Gitlab: GitLab Community Edition 8.17.0 77254ab
CI Runner с использованием Docker (последняя версия на сегодняшний день)

0

Решение

Вы смотрели на файлы, которые вы пометили XX? Кажется, что они не содержат никаких тестов или не придерживаются соглашений для phpunit, то есть тесты должны иметь префикс с test, Если в папке с тестами есть файлы, которые не содержат тесты, вы можете их исправить или выбросить.

Я создал пример, чтобы продемонстрировать проблему:

<?php

require_once __DIR__ . '/vendor/autoload.php';

use PHPUnit\Framework\TestCase;

class Question43423064Test extends TestCase
{
//function testTrue() { $this->assertTrue(true); }
}

При выполнении этого теста я получаю аналогичный вывод, как вы:

dbr:stackoverflow/ $ phpunit Question43423064Test.php
PHPUnit 6.0.6 by Sebastian Bergmann and contributors.

W                                                                   1 / 1 (100%)

Time: 64 ms, Memory: 8.00MB

There was 1 warning:

1) Warning
No tests found in class "Question43423064Test".

WARNINGS!
Tests: 1, Assertions: 0, Warnings: 1.

dbr:stackoverflow/ $ echo $?
1

echo $? напечатает последний код возврата и, как вы можете видеть, равен 1. Если вы удалите комментарий или добавите пропущенную аннотацию, предупреждение исчезнет, ​​а код выхода должен вернуться к 0.

tl; dr Похоже, что вам нужно либо выбросить эти файлы, либо исправить включенные тесты, либо, возможно, пометить их как пропущенные, если вы хотите исправить их позже.

1

Другие решения

script:
- vendor/bin/phpunit --configuration phpunit.xml || exit 1

ты используешь exit 1 — выход> 0 всегда обрабатывается как ошибка.

использование exit 0 или же true

увидеть http://man7.org/linux/man-pages/man3/exit.3.html

до тех пор, пока вы не вызываете phpunit с --fail-on-warning он не должен использовать код выхода> 0

0

По вопросам рекламы [email protected]