IMB*_*IMB 3 php continuous-integration unit-testing gitlab devops
我有这个基本.gitlab-ci.yml文件。
image: php:7.2
before_script:
# install git
- 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
tests:
script:
- vendor/bin/phpunit tests
Run Code Online (Sandbox Code Playgroud)
这工作得很好,如果单元测试失败或通过,它会提醒我。
我的问题是 Gitlab CI 究竟是如何知道这一点的?他们是否解析 PHPUnit 的输出并查看字符串是否FAILURES!存在?
gitlab-ci 只检查在其中运行的进程的退出代码。如果进程退出时的状态代码不是 0,则管道将停止并声明失败。这就是 CI 管道的整体工作方式,不仅是 gitlab,还有 Jenkins 等。