-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy path.travis.yml
58 lines (50 loc) · 2.02 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#
# See https://docs.travis-ci.com/user/languages/php/
# See https://docs.travis-ci.com/user/database-setup/
#
# Note: To run tests on PHP 7.1 need to use PHPUnit 7.x
# MySQL 5.7 is default on Ubuntu 16.04 (Xenial) and 18.04 (Bionic)
# MariaDB is drop-in replacement for MySQL and has when defined as addon takes precedence ove MySQL
# MariaDB doesn't have travis user on xenial https://travis-ci.community/t/mariadb-10-1-fails-to-install-on-xenial/3151
# SQLite is bundled as PHP extension
#
dist: bionic
language: php
php:
- 7.1
# - 7.2
# - 7.3
# - 7.4
- 8.0
# Start provisioned database services
services:
- mysql
# - mongodb
# Available as addons
addons:
postgresql: '9.5'
# mariadb: '10.2'
# Create build matrix exporting DB variable
env:
- DRIVER=mysql
- DRIVER=pgsql
# - DRIVER=mariadb
# - DRIVER=cockpit-sqlite
# - DRIVER=cockpit-mongodb
before_script:
- phpenv config-rm xdebug.ini
- composer install --no-interaction --ignore-platform-reqs
- sh -c "if [ '$DRIVER' = 'mysql' ] || [ '$DRIVER' = 'mariadb' ]; then mysql -e 'CREATE DATABASE IF NOT EXISTS cockpitdb;'; fi"
# To fix issue https://travis-ci.community/t/mariadb-10-1-fails-to-install-on-xenial/3151
- sh -c "if [ '$DRIVER' = 'mariadb' ]; then mysql -u root -e 'CREATE USER IF NOT EXISTS travis@localhost; GRANT ALL ON *.* TO travis@localhost;'; fi"
- sh -c "if [ '$DRIVER' = 'pgsql' ]; then psql -c 'DROP DATABASE IF EXISTS cockpitdb;' -U postgres; fi"
- sh -c "if [ '$DRIVER' = 'pgsql' ]; then psql -c 'CREATE DATABASE cockpitdb;' -U postgres; fi"
# - sh -c "if [ '$DRIVER' = 'cockpit-mongodb' ]; then pecl install mongodb; fi"
# - sh -c "if [ '$DRIVER' = 'cockpit-mongodb']; then mongo 'cockpitdb' --eval 'db.createUser({user:\"travis\",pwd:\"test\",roles:[\"readWrite\"]});'; fi"
# Run PHPUnit with current driver
script:
- vendor/bin/phpunit --configuration tests/travis/$DRIVER.phpunit.xml
# - vendor/bin/php-cs-fixer fix -v --diff --dry-run
allow_failures:
# - php: 7.5snapshot
# - env: DRIVER=cockpit-sqlite