【问题标题】:Can't accomplish build with Jenkins, Symfony3 and PHPUnit 5.3无法使用 Jenkins、Symfony3 和 PHPUnit 5.3 完成构建
【发布时间】:2016-08-27 19:22:50
【问题描述】:

尝试学习 CI,我遇到了以下问题: 命令行中的 Ant 给出“BUILD SUCCESSFUL”消息。 当我将代码推送到 GitHub 并在 AWS 上运行 Jenkins 时,除了 PHPUnit 部分错误之外,evth 通过了:

> phpunit:
[phpunit] PHP Warning: require(/var/lib/jenkins/workspace/mavajob/app/../vendor/autoload.php): failed to open stream: No such file or directory in /var/lib/jenkins/workspace/mavajob/app/autoload.php on line 9
[phpunit] PHP Stack trace:
[phpunit] PHP 1. {main}() /usr/bin/phpunit:0
[phpunit] PHP 2. PHPUnit_TextUI_Command::main() /usr/bin/phpunit:29
[phpunit] PHP 3. PHPUnit_TextUI_Command->run() /usr/share/php/PHPUnit/TextUI/Command.php:106
[phpunit] PHP 4. PHPUnit_TextUI_Command->handleArguments() /usr/share/php/PHPUnit/TextUI/Command.php:117
[phpunit] PHP 5. PHPUnit_TextUI_Command->handleBootstrap() /usr/share/php/PHPUnit/TextUI/Command.php:622
[phpunit] PHP 6. PHPUnit_Util_Fileloader::checkAndLoad() /usr/share/php/PHPUnit/TextUI/Command.php:793
[phpunit] PHP 7. PHPUnit_Util_Fileloader::load() /usr/share/php/PHPUnit/Util/Fileloader.php:38
[phpunit] PHP 8. include_once() /usr/share/php/PHPUnit/Util/Fileloader.php:56
[phpunit] PHP Fatal error: require(): Failed opening required '/var/lib/jenkins/workspace/mavajob/app/../vendor/autoload.php' (include_path='.:/usr/share/php') in /var/lib/jenkins/workspace/mavajob/app/autoload.php on line 9
[phpunit] PHP Stack trace:
[phpunit] PHP 1. {main}() /usr/bin/phpunit:0
[phpunit] PHP 2. PHPUnit_TextUI_Command::main() /usr/bin/phpunit:29
[phpunit] PHP 3. PHPUnit_TextUI_Command->run() /usr/share/php/PHPUnit/TextUI/Command.php:106
[phpunit] PHP 4. PHPUnit_TextUI_Command->handleArguments() /usr/share/php/PHPUnit/TextUI/Command.php:117
[phpunit] PHP 5. PHPUnit_TextUI_Command->handleBootstrap() /usr/share/php/PHPUnit/TextUI/Command.php:622
[phpunit] PHP 6. PHPUnit_Util_Fileloader::checkAndLoad() /usr/share/php/PHPUnit/TextUI/Command.php:793
[phpunit] PHP 7. PHPUnit_Util_Fileloader::load() /usr/share/php/PHPUnit/Util/Fileloader.php:38
[phpunit] PHP 8. include_once() /usr/share/php/PHPUnit/Util/Fileloader.php:56
[phpunit] Result: 255

我遵循了这些说明http://jenkins-php.org/automation.html 也许有人可以为 Symfony3 的 build.xml 和 phpunit.xml 提供工作示例?

【问题讨论】:

    标签: symfony jenkins phpunit


    【解决方案1】:

    在我看来,您在尝试执行 PHPUnit 之前忘记在 CI 服务器上运行 composer install

    只需为 composer 添加另一个目标(假设您已经安装了 composer):

    <target name="composer" description="Installing composer dependencies">
     <exec executable="composer" failonerror="true">
      <arg value="install" />
     </exec>
    </target>
    

    并使其成为其他需要它的目标的依赖项。例如,full-build,你可以在 prepare 之后直接写:

     <target name="full-build"
             depends="prepare,composer,static-analysis,phpunit,phpdox,-check-failure"
             description="Performs static analysis, runs the tests, and generates project documentation"/>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-07-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-10-05
      • 1970-01-01
      • 1970-01-01
      • 2016-02-02
      相关资源
      最近更新 更多