another attempt; make Logger friend to php 5.3
[plcapi.git] / .travis.yml
1 language: php
2
3 # the current Travis VMs are based on Ubuntu Trusty. Alas, those do not have php 5.3 available. So we keep using Precise...
4 dist: precise
5
6 php:
7   - 5.3
8   - 5.4
9   - 5.5
10   - 5.6
11   - 7.0
12   - 7.1
13   - 7.2
14   # hhvm is not available any more on Precise images
15   #- hhvm
16
17 before_install:
18   # This is mandatory or the 'apt-get install' calls following will fail
19   - sudo apt-get update -qq
20   - sudo apt-get install -y apache2 libapache2-mod-fastcgi
21   - sudo apt-get install -y privoxy
22
23   # Disable xdebug for speed (executing composer), but allow us to re-enable it later
24   # NB: 'php -i' does not work on hhvm
25   - if [ "$TRAVIS_PHP_VERSION" = "hhvm" ]; then export XDEBUG_INI=''; fi
26   - if [ "$TRAVIS_PHP_VERSION" != "hhvm" ]; then export XDEBUG_INI=`php -i | grep xdebug.ini | grep home/travis | grep -v '=>' | head -1`; fi
27   - export XDEBUG_INI=${XDEBUG_INI/,/}
28   - if [ "$XDEBUG_INI" != "" ]; then mv "$XDEBUG_INI" "$XDEBUG_INI.bak"; fi
29
30 install:
31   - composer self-update && composer install
32
33   # Re-enable xdebug for when we need to generate code coverage
34   - export COVERAGE_OPTS=""
35   - if [ "$TRAVIS_PHP_VERSION" = "5.6" -a "$XDEBUG_INI" != "" ]; then mv "$XDEBUG_INI.bak" "$XDEBUG_INI" && export COVERAGE_OPTS="--coverage-clover=coverage.clover"; fi
36
37 before_script:
38   # Set up Apache and Privoxy instances inside the Travis VM and use them for testing against
39   - if [ "$TRAVIS_PHP_VERSION" != "hhvm" ]; then ./tests/ci/travis/setup_php_fpm.sh; ./tests/ci/travis/setup_apache.sh; fi
40   - if [ "$TRAVIS_PHP_VERSION" = "hhvm" ]; then ./tests/ci/travis/setup_hhvm.sh; ./tests/ci/travis/setup_apache_hhvm.sh; fi
41   - ./tests/ci/travis/setup_privoxy.sh
42
43   # output what version of phpunit we got going
44   - vendor/bin/phpunit --version
45
46 script:
47   # Travis currently compiles PHP with an oldish cURL/GnuTLS combination;
48   # to make the tests pass when Apache has a bogus SSL cert whe need the full set of options below
49   vendor/bin/phpunit $COVERAGE_OPTS tests LOCALSERVER=localhost URI=/demo/server/server.php HTTPSSERVER=localhost HTTPSURI=/demo/server/server.php PROXY=localhost:8080 HTTPSVERIFYHOST=0 HTTPSIGNOREPEER=1 SSLVERSION=3 DEBUG=1
50
51 after_failure:
52   # Save as much info as we can to help developers
53   - cat apache_error.log
54   - cat apache_access.log
55   #- if [ "$TRAVIS_PHP_VERSION" = "hhvm" ]; then cat /var/log/hhvm/error.log; fi
56
57 after_script:
58   # Upload code-coverage to Scrutinizer
59   - if [ -f coverage.clover ]; then wget https://scrutinizer-ci.com/ocular.phar; fi
60   - if [ -f coverage.clover ]; then php ocular.phar code-coverage:upload --format=php-clover coverage.clover; fi
61   # Upload code-coverage CodeClimate
62   - if [ -f coverage.clover ]; then CODECLIMATE_REPO_TOKEN=7fa6ee01e345090e059e5e42f3bfbcc8692feb8340396382dd76390a3019ac13 ./vendor/bin/test-reporter --coverage-report=coverage.clover; fi
63
64 # reduce depth (history) of git checkout
65 git:
66     depth: 5