travis
[plcapi.git] / .travis.yml
1 language: php
2
3 # As of May 2019, Travis is phasing out VMs based on Precise, which means that we can only test on php >= 5.6 going forward...
4 dist: xenial
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   - 7.3
15
16 before_install:
17   # This is mandatory or the 'apt-get install' calls following will fail
18   - sudo apt-get update -qq
19   - sudo apt-get install -y apache2 libapache2-mod-fastcgi
20   - sudo apt-get install -y privoxy
21
22   # Disable xdebug for speed (executing composer), but allow us to re-enable it later
23   - export XDEBUG_INI=`php -i | grep xdebug.ini | grep home/travis | grep -v '=>' | head -1`
24   - export XDEBUG_INI=${XDEBUG_INI/,/}
25   - if [ "$XDEBUG_INI" != "" ]; then mv "$XDEBUG_INI" "$XDEBUG_INI.bak"; fi
26
27 install:
28   - composer install
29
30   # Re-enable xdebug for when we need to generate code coverage
31   - export COVERAGE_OPTS=""
32   - if [ "$TRAVIS_PHP_VERSION" = "7.3" -a "$XDEBUG_INI" != "" ]; then mv "$XDEBUG_INI.bak" "$XDEBUG_INI" && export COVERAGE_OPTS="--coverage-clover=coverage.clover"; fi
33
34 before_script:
35   # Set up Apache and Privoxy instances inside the Travis VM and use them for testing against
36   - ./tests/ci/travis/setup_php_fpm.sh
37   - ./tests/ci/travis/setup_apache.sh
38   - ./tests/ci/travis/setup_privoxy.sh
39
40   # output what version of phpunit we got going
41   - vendor/bin/phpunit --version
42
43 script:
44   # Travis currently compiles PHP with an oldish cURL/GnuTLS combination;
45   # to make the tests pass when Apache has a bogus SSL cert whe need the full set of options below
46   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=0
47
48 after_failure:
49   # Save as much info as we can to help developers
50   - cat apache_error.log
51   - cat apache_access.log
52
53 after_script:
54   # Upload code-coverage to Scrutinizer
55   - if [ -f coverage.clover ]; then wget https://scrutinizer-ci.com/ocular.phar; fi
56   - if [ -f coverage.clover ]; then php ocular.phar code-coverage:upload --format=php-clover coverage.clover; fi
57   # Upload code-coverage CodeClimate
58   - if [ -f coverage.clover ]; then CODECLIMATE_REPO_TOKEN=7fa6ee01e345090e059e5e42f3bfbcc8692feb8340396382dd76390a3019ac13 ./vendor/bin/test-reporter --coverage-report=coverage.clover; fi
59
60 # reduce depth (history) of git checkout
61 git:
62     depth: 5