673d0ba6bbc6ffda6665c203e44cab22802029d3
[plcapi.git] / .travis.yml
1 language: php
2
3 # As of May 2019, Travis is deprecating VMs based on Precise, which means that we can only test on php >= 5.6 going forward
4 # (nb: this is not necessarily true yet - there are projects that seem to use a different base dist depending on php version...)
5 dist: xenial
6
7 php:
8   #- 5.3
9   #- 5.4
10   #- 5.5
11   - 5.6
12   - 7.0
13   - 7.1
14   - 7.2
15   - 7.3
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   - export XDEBUG_INI=`php -i | grep xdebug.ini | grep home/travis | grep -v '=>' | head -1`
25   - export XDEBUG_INI=${XDEBUG_INI/,/}
26   - if [ "$XDEBUG_INI" != "" ]; then mv "$XDEBUG_INI" "$XDEBUG_INI.bak"; fi
27
28 install:
29   - composer install
30
31   # Re-enable xdebug for when we need to generate code coverage
32   - export COVERAGE_OPTS=""
33   - if [ "$TRAVIS_PHP_VERSION" = "7.3" -a "$XDEBUG_INI" != "" ]; then mv "$XDEBUG_INI.bak" "$XDEBUG_INI" && export COVERAGE_OPTS="--coverage-clover=coverage.clover"; fi
34
35 before_script:
36   # Set up Apache and Privoxy instances inside the Travis VM and use them for testing against
37   - ./tests/ci/travis/setup_php_fpm.sh
38   - ./tests/ci/travis/setup_apache.sh
39   - ./tests/ci/travis/setup_privoxy.sh
40
41   # output what version of phpunit we got going
42   - vendor/bin/phpunit --version
43
44 script:
45   # Travis currently compiles PHP with an oldish cURL/GnuTLS combination;
46   # to make the tests pass when Apache has a bogus SSL cert whe need the full set of options below
47   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=0 DEBUG=0
48
49 after_failure:
50   # Save as much info as we can to help developers
51   - cat apache_error.log
52   - cat apache_access.log
53
54 after_script:
55   # Upload code-coverage to Scrutinizer
56   - if [ -f coverage.clover ]; then wget https://scrutinizer-ci.com/ocular.phar; fi
57   - if [ -f coverage.clover ]; then php ocular.phar code-coverage:upload --format=php-clover coverage.clover; fi
58   # Upload code-coverage CodeClimate
59   - if [ -f coverage.clover ]; then CODECLIMATE_REPO_TOKEN=7fa6ee01e345090e059e5e42f3bfbcc8692feb8340396382dd76390a3019ac13 ./vendor/bin/test-reporter --coverage-report=coverage.clover; fi
60
61 # reduce depth (history) of git checkout
62 git:
63     depth: 5