7a9b1dc14094ee7e206164c3a9690c28cadae23a
[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 - and we can use a different base for each php version, but we'll have to
5 # adapt composer.json plus the apache / env setup scripts to accommodate that...)
6 dist: xenial
7
8 env:
9     global:
10         - LOCALSERVER=localhost
11         - URI=/demo/server/server.php
12         - HTTPSSERVER=localhost
13         - HTTPSURI=/demo/server/server.php
14         - PROXY=localhost:8080
15         # Travis currently compiles PHP with an oldish cURL/GnuTLS combination;
16         # to make the tests pass when Apache has a bogus SSL cert whe need the full set of options below
17         - HTTPSVERIFYHOST=0
18         - HTTPSIGNOREPEER=1
19         - SSLVERSION=0
20         - DEBUG=0
21         # temp workaround to xdebug 3.0.0 bug
22         - XDEBUG_MODE=coverage
23
24 php:
25   #- 5.3
26   #- 5.4
27   #- 5.5
28   - 5.6
29   - 7.0
30   - 7.1
31   - 7.2
32   - 7.3
33   - 7.4
34   - 8.0
35
36 before_install:
37   # This is mandatory or the 'apt-get install' calls following will fail
38   - sudo apt-get update -qq
39   - sudo apt-get install -y apache2 libapache2-mod-fastcgi
40   - sudo apt-get install -y privoxy
41
42   # Disable xdebug for speed (executing composer), but allow us to re-enable it later
43   - export XDEBUG_INI=`php -i | grep xdebug.ini | grep home/travis | grep -v '=>' | head -1`
44   - export XDEBUG_INI=${XDEBUG_INI/,/}
45   - if [ "$XDEBUG_INI" != "" ]; then mv "$XDEBUG_INI" "$XDEBUG_INI.bak"; fi
46
47 install:
48   - composer install
49
50   # Re-enable xdebug for when we need to generate code coverage
51   - export COVERAGE_OPTS=""
52   - if [ "$TRAVIS_PHP_VERSION" = "7.4" -a "$XDEBUG_INI" != "" ]; then mv "$XDEBUG_INI.bak" "$XDEBUG_INI" && export COVERAGE_OPTS="--coverage-clover=coverage.clover"; fi
53
54 before_script:
55   # Set up Apache and Privoxy instances inside the Travis VM and use them for testing against
56   - ./tests/ci/travis/setup_php_fpm.sh
57   - ./tests/ci/travis/setup_apache.sh
58   - ./tests/ci/travis/setup_privoxy.sh
59
60   # output what version of phpunit we got going
61   - vendor/bin/phpunit --version
62
63 script:
64   vendor/bin/phpunit $COVERAGE_OPTS tests
65
66 after_failure:
67   # Save as much info as we can to help developers
68   - cat apache_error.log
69   - cat apache_access.log
70
71 after_script:
72   # Upload code-coverage to Scrutinizer
73   - if [ -f coverage.clover ]; then wget https://scrutinizer-ci.com/ocular.phar; fi
74   - if [ -f coverage.clover ]; then php ocular.phar code-coverage:upload --format=php-clover coverage.clover; fi
75   # Upload code-coverage CodeClimate - disabled as it does not support php 8 atm
76   #- if [ -f coverage.clover ]; then CODECLIMATE_REPO_TOKEN=7fa6ee01e345090e059e5e42f3bfbcc8692feb8340396382dd76390a3019ac13 ./vendor/bin/test-reporter --coverage-report=coverage.clover; fi
77
78 # reduce depth (history) of git checkout
79 git:
80     depth: 1