Build failing PHP project in Travis-CI

Asked

Viewed 106 times

1

I’m trying to make night builds of a PHP project on Travis-CI but I’m catching on. My builds are failing because Travis-CI says they can’t find Composer. There are more details in the log below.

Using worker: worker-linux-docker-c22a70ed.prod.travis-ci.org:travis-linux-3

Build system information
Build language: ruby
Build image provisioning date and time
Thu Feb  5 15:09:33 UTC 2015
Operating System Details
Distributor ID: Ubuntu
Description:    Ubuntu 12.04.5 LTS
Release:    12.04
Codename:   precise
Linux Version
3.13.0-29-generic
Cookbooks Version
a68419e https://github.com/travis-ci/travis-cookbooks/tree/a68419e
GCC version
gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

LLVM version
clang version 3.4 (tags/RELEASE_34/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
Pre-installed Ruby versions
ruby-1.9.3-p551
Pre-installed Node.js versions
v0.10.36
Pre-installed Go versions
1.4.1
Redis version
redis-server 2.8.19
riak version
2.0.2
MongoDB version
MongoDB 2.4.12
CouchDB version
couchdb 1.6.1
Neo4j version
1.9.4
RabbitMQ Version
3.4.3
ElasticSearch version
1.4.0
Installed Sphinx versions
2.0.10
2.1.9
2.2.6
Default Sphinx version
2.2.6
Installed Firefox version
firefox 31.0esr
PhantomJS version
1.9.8
ant -version
Apache Ant(TM) version 1.8.2 compiled on December 3 2011
mvn -version
Apache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-14T17:29:23+00:00)
Maven home: /usr/local/maven
Java version: 1.7.0_76, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-7-oracle/jre
Default locale: en_US, platform encoding: ANSI_X3.4-1968
OS name: "linux", version: "3.13.0-29-generic", arch: "amd64", family: "unix"

$ git clone --depth=50 --branch=master git://github.com/rgiaviti/laravel-correios-track.git rgiaviti/laravel-correios-track
Cloning into 'rgiaviti/laravel-correios-track'...
remote: Counting objects: 69, done.
remote: Compressing objects: 100% (40/40), done.
remote: Total 69 (delta 14), reused 0 (delta 0), pack-reused 20
Receiving objects: 100% (69/69), 11.17 KiB | 0 bytes/s, done.
Resolving deltas: 100% (14/14), done.
Checking connectivity... done.
$ cd rgiaviti/laravel-correios-track
$ git checkout -qf e2c8293aa5a996f5d8bbdef6788e4e2d84c15c1e

This job is running on container-based infrastructure, which does not allow use of 'sudo', setuid and setguid executables.
If you require sudo, add 'sudo: required' to your .travis.yml
See http://docs.travis-ci.com/user/workers/container-based-infrastructure/ for details.
$ rvm use default
Using /home/travis/.rvm/gems/ruby-1.9.3-p551
$ ruby --version
ruby 1.9.3p551 (2014-11-13 revision 48407) [x86_64-linux]
$ rvm --version
rvm 1.26.10 (latest-minor) by Wayne E. Seguin <[email protected]>, Michal Papis <[email protected]> [https://rvm.io/]
$ bundle --version
Bundler version 1.7.6
$ gem --version
2.4.5
$ composer self-update
/home/travis/build.sh: line 41: composer: command not found

The command "composer self-update" failed and exited with 127 during .

Your build has been stopped.

What I realized is that Travis-CI is setting the environment to Ruby instead of the PHP environment. Even though I set up the file .travis.yml to use the PHP environment, it seems that at build time, Travis-CI ignores my settings. Below is my file .Travis.yml.

language: php

php:
  - 5.4
  - 5.5
  - 5.6
  - hhvm
  - hhvm-nightly

before_script:
  - composer self-update
  - composer install --prefer-source --no-interaction --dev

I already went through all of Travis-CI’s documentation and posted this same issue in Stackoverflow. I haven’t found a solution yet. I also set up Travis-CI to only build if .travis.yml was present and it builds. So I think Travis-CI is reading the travis.yml.

Another point is that I checked on other projects to see what the travis.yml file should look like and it’s all right..

I have no idea if the problem is in Travis-CI itself or in my file or some configuration that I have not checked.

1 answer

1

I contacted Travis-CI support explaining my problem. They checked my file .travis.yml and saw that there was a hidden character before the tag language: php. This made Travis-CI not detect the language and then started build with Ruby environment.

I recreated the travis.yml file by removing the hidden character and the build worked perfectly.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.