-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy path.travis.yml
72 lines (61 loc) · 2.7 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
sudo: required
dist: xenial
git:
depth: 1
language: php
php:
- 7.2
- 7.3
- 7.4
- 8.0
services:
- mysql
- postgresql
env:
matrix:
- DB_DRIVER=pdo_mysql DB_USER=root
- DB_DRIVER=pdo_pgsql DB_USER=phpunit DB_PASSWORD=phpunit
global:
- TRAVIS_SECURE_ENV_VARS=true
- secure: "D85mhHqlhgIZExOQMJCp3oxiYYAPLm2N9by9C1dw/q/GNWsWRy3sdVsTALSkhwFRRR1JiU3a0C0ExxrsrwGQ/Nk6j5gmdQNRlJCeHZ6jiLzpsW+fkma/Kh29+gz4ZGHtqi1FzwAV7RhzSWMmVvbbKId2qsbGCR+sWpxpZ+48jifGBHq4+VDk+tpSXh2SFOi3VR8tGeEiaUqYm79fLKkrtCZjHf2mvzv0epJcPzqIZVXytpypoL4NB1rpPOBMDj9iQDpbEkVbD0yt4zE26m7GWVJADniOUa/ZsFiFEFKz9TioeP36QEfykYHXq6pSqAwh4GAePn4ceLkRvorH3llh+DxTJU2o6+RxH8640Db1B169ewxUoj9dFuMaaEvojOk+ZfNg3aE3RW0xF6WY1oYJYkSDtmfFoavIf8WH5HuaqeBcVYKPcRcCRw88NJoG7QRIOyKk2g7Xy9N1fInYm+AZnO+nc02GcwKzJ2izScW65GOt8ceLq8Sy+8NvrxrT1VgpqDGOWnAX3iF2cYJ3ECvUTyoBen8qRrobW+YuchbNtXmy2Afus7Jmn21TtCSX1ekyqO43jSQExrNZJINhA0R9i89Jz7qwsMQQwEjsq620awN/nlXYCxnvrRHLozbe2616IKge81OFgy2xc/Ebi2xwOuSTz6YM+/EG4eWRI5nxvHA="
before_install:
# Set Coverage flag
- export COVERAGE=0
- |
if [[ "${TRAVIS_PHP_VERSION}" == "7.3" && "${DB_DRIVER}" == "pdo_mysql" ]]; then
export COVERAGE=1;
fi
# Code Climate
- |
if [[ ${COVERAGE} -eq 1 ]]; then
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter;
chmod +x ./cc-test-reporter;
./cc-test-reporter before-build;
fi
# Postgres
- |
if [[ "${DB_DRIVER}" == "pdo_pgsql" ]]; then
psql -c "CREATE DATABASE test_db;" -U postgres;
psql -c "CREATE USER phpunit WITH PASSWORD 'phpunit';" -U postgres;
psql -c "GRANT ALL PRIVILEGES ON DATABASE test_db to phpunit;" -U postgres;
sudo sed -i 's/trust/md5/g' /etc/postgresql/*/main/pg_hba.conf;
sudo /etc/init.d/postgresql restart;
fi
# Mysql
- |
if [[ "${DB_DRIVER}" == "pdo_mysql" ]]; then
mysql -e "CREATE DATABASE IF NOT EXISTS test_db;";
mysql -e "SET GLOBAL sql_mode = 'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'";
fi
before_script:
- composer install --no-interaction --prefer-source
script:
- if [[ ${COVERAGE} -eq 1 ]]; then vendor/bin/phpunit --configuration phpunit.xml.dist --colors --coverage-clover=clover.xml; fi
- if [[ ${COVERAGE} -eq 0 ]]; then vendor/bin/phpunit --configuration phpunit.xml.dist --no-cover; fi
after_script:
# Code Climate
- if [[ ${COVERAGE} -eq 1 ]]; then
./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT;
wget https://scrutinizer-ci.com/ocular.phar;
test -f ocular.phar && php ocular.phar code-coverage:upload --format=php-clover clover.xml;
fi