Github Travis.yml在极简主义内容方面失败了?

Github Travis.yml在极简主义内容方面失败了?,github,travis-ci,Github,Travis Ci,我的Github上有当前的travis.yml: # see http://about.travis-ci.org/docs/user/languages/php/ for more hints language: php # list any PHP version you want to test against php: # aliased to a recent 5.4.x version - 5.4 # aliased to a recent 5.5.x version

我的Github上有当前的
travis.yml

# see http://about.travis-ci.org/docs/user/languages/php/ for more hints
language: php

# list any PHP version you want to test against
php:
  # aliased to a recent 5.4.x version
  - 5.4
  # aliased to a recent 5.5.x version
  - 5.5
我所有的工作都在失败,但以极简主义的设计,我看不出失败的原因。。因为特拉维斯没有最好的信息。。以下是我日志的最后几部分:

作业9.1:

$ git clone --depth=50 --branch=master git://github.com/SlayerSolutions/Authentication.git SlayerSolutions/Authentication

Cloning into 'SlayerSolutions/Authentication'...

remote: Counting objects: 128, done.

remote: Compressing objects: 100% (104/104), done.

remote: Total 128 (delta 55), reused 83 (delta 15)

Receiving objects: 100% (128/128), 19.17 KiB | 0 bytes/s, done.

Resolving deltas: 100% (55/55), done.

$ cd SlayerSolutions/Authentication
git.2

$ git checkout -qf 1df78d018dbe8a81e66490e90012229adcff7af8

$ phpenv global 5.4

$ php --version

PHP 5.4.16 (cli) (built: Jun 28 2013 11:14:20)

Copyright (c) 1997-2013 The PHP Group

Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies

with Xdebug v2.2.1, Copyright (c) 2002-2012, by Derick Rethans

$ composer --version

Warning: This development build of composer is over 30 days old. It is recommended to update it by running "/home/travis/.phpenv/versions/5.4.16/bin/composer.phar self-update" to get the latest version.

Composer version 7755564962718189d5d7d9fdee595283c8f032b7

$ phpunit

PHPUnit 3.7.21 by Sebastian Bergmann.

Usage: phpunit [switches] UnitTest [UnitTest.php]

phpunit [switches] <directory>

--log-junit <file> Log test execution in JUnit XML format to file.
 ...Bla,bla,bla

The command "phpunit" exited with 2.

Done. Your build exited with 1.

那么,这里出了什么问题

与Travis一起运行的脚本的任何非零退出代码都被视为失败。 您的极简
.travis.yml
没有指定构建脚本,因此PHP的默认构建脚本是运行的,即
phpunit
()

由于您的存储库中没有phpunit.xml,因此Travis基本上没有什么可运行的。这导致构建失败

这实际上取决于您想对Travis执行什么操作,但是您可以根据默认设置配置存储库,或者在运行构建时定义要执行的脚本,如下所示:

language: php

php:
  - 5.4
  - 5.5

script: ./build.sh
然后,您可以在运行build时在
build.sh
中指定要执行的任何内容

您可能需要确保
/build.sh
是可执行的,您可以使用它

before_install:
  - chmod +x build.sh

您还可以在build.sh文件中编写脚本
bash build.sh
sh build.sh

应该编写什么?@VivekChaturvedi:在CI服务器上测试/构建的任何内容。对于PHP,这可能是例如
phpunit
,或者您想使用
phpcs
检查代码样式。这完全取决于您的项目和需求。
before_install:
  - chmod +x build.sh