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