tests: do not assume PHP CLI is always installed
[racktables] / .travis.yml
1 # Ubuntu 18.04 with PHP 7.1, 7.2 and 7.3
2 dist: bionic
3 language: php
4
5 git:
6 quiet: true
7 depth: 3
8
9 matrix:
10 fast_finish: true
11 include:
12 # PHP 7.0 is not available on U18.04. U16.04 with PHP 7.0 comes with
13 # PHPUnit 7, which requires PHP >= 7.1 hence does not work. PHPUnit 6.5.14
14 # on PHP 7.0.33 errors RackTables tests that were updated to meet the
15 # requirements of PHPUnit 8. Quite oddly, the error message of PHPUnit 6
16 # after the update resembles the message of PHPUnit 8 before the update:
17 # "TypeError: Return value of ConfigVarTest::setUp() must be an instance of
18 # void, none returned"
19 # That said, outside of Travis CI on a U18.04 host PHPUnit 6.5.5 with
20 # PHP 7.2.24 works fine, but anyway.
21 - php: 7.1
22 # U18.04 with PHP 7.1 comes with PHPUnit 8, which requires PHP >= 7.2
23 # hence does not work.
24 env: PHPUNIT_BIN=~/bin/phpunit-7.5.17.phar
25 - php: 7.2 # PHPUnit 8 by default
26 - php: 7.3 # PHPUnit 8 by default
27
28 services:
29 - mysql
30
31 before_script:
32 - ./tests/travis_setup_mysql.sh racktables_unittest racktables travistest
33 - if [ "$PHPUNIT_BIN" != "" ]; then mkdir -p ~/bin && curl -sSfL -o "$PHPUNIT_BIN" https://phar.phpunit.de/${PHPUNIT_BIN##~/bin/} && chmod a+x "$PHPUNIT_BIN"; fi
34
35 script:
36 - ./tests/express_pre.sh
37 - if [ "$SKIP_PHPUNIT" = yes ]; then echo '(skipped PHPUnit tests on request)'; else ./tests/express_phpunit.sh; fi
38 - ./tests/express_post.sh
39 - mysql -u racktables -ptravistest racktables_unittest < scripts/init-sample-racks.sql
40 - DESTDIR=/tmp make install