-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.travis.yml
64 lines (56 loc) · 2.33 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
# Travis config for PHP library
#
# Normal build - only phpunit
#
# Build with checks:
# - code sniffer
# - phpunit with coverage
# - sending coverage data to coveralls.io
# Checks are used only for one version (PHP 5.4)
language: php
matrix:
include:
- php: 7.1
env: CHECKS=yes
- php: 7.2
- php: 7.3
sudo: false
before_install:
# Some versions (HHVM for example) may not support XDebug
- XDEBUG_INI=/home/travis/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini
- if [ -f $XDEBUG_INI ]; then XDEBUG_ENABLED="yes"; fi;
# Disable xdebug for composer (https://getcomposer.org/doc/articles/troubleshooting.md#xdebug-impact-on-composer)
# Do not use `phpenv config-rm` because we need xdebug.ini for enable it for phpunit coverage.
- if [ "$XDEBUG_ENABLED" = "yes" ]; then mv $XDEBUG_INI xdebug.ini; fi;
# Travis container may contain outdated version of composer
- composer self-update
# Info
- if [ "$CHECKS" = "yes" ]; then echo "Checks mode"; else echo "Normal mode"; fi;
- if [ "$XDEBUG_ENABLED" = "yes" ]; then echo "XDebug is supported"; else echo "XDebug is not supported"; fi;
- if [ "$PHPUNIT_BROKEN" = "yes" ]; then echo "PHPUnit is broken"; else echo "PHPUnit is ok"; fi;
install:
# Composer can not used dist (github required the auth token). Just specify prefer-source.
- composer install --prefer-source
- PU="php vendor/bin/phpunit"
- CS="php vendor/bin/phpcs"
- if [ "$CHECKS" = "yes" ]; then composer require php-coveralls/php-coveralls --dev --prefer-source; fi;
# Generate the coveralls config (not to keep it in the repo)
- >
if [ "$CHECKS" = "yes" ]; then
echo "json_path: coveralls-upload.json" >> .coveralls.yml &&
echo "coverage_clover: clover.xml" >> .coveralls.yml
fi;
script:
# Normal run - only phpunit
- if [ ! "$CHECKS" = "yes" ]; then $PU; fi;
# Run with checks
- if [ "$CHECKS" = "yes" ]; then $CS; fi;
# Enable xdebug for coverage
- if [ "$CHECKS" = "yes" ] && [ "$XDEBUG_ENABLED" = "yes" ]; then phpenv config-add xdebug.ini; fi;
- if [ "$CHECKS" = "yes" ]; then $PU --coverage-clover clover.xml; fi;
# Coveralls in `script` section instead `after_succes` for build fail if when error
- if [ "$CHECKS" = "yes" ]; then php vendor/bin/php-coveralls -c .coveralls.yml; fi;
notifications:
email:
on_success: change
on_failure: always