generated from maileryio/template-php
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
executable file
·61 lines (56 loc) · 1.55 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
language: php
env:
global:
- DEFAULT_COMPOSER_FLAGS="--prefer-dist --no-interaction --no-progress --optimize-autoloader"
- TASK_STATIC_ANALYSIS=0
- TASK_TESTS_COVERAGE=0
matrix:
include:
- php: "7.4"
env:
- TASK_STATIC_ANALYSIS=0 # set to 1 to enable static analysis
- TASK_TESTS_COVERAGE=1
# faster builds on new travis setup not using sudo
sudo: false
# cache vendor dirs
cache:
directories:
- $HOME/.composer/cache
before_install:
- |
if [[ $TASK_TESTS_COVERAGE != 1 ]]; then
# disable xdebug for performance reasons when code coverage is not needed
phpenv config-rm xdebug.ini || echo "xdebug is not installed"
fi
install:
- travis_retry composer self-update && composer --version
- export PATH="$HOME/.composer/vendor/bin:$PATH"
- travis_retry composer install $DEFAULT_COMPOSER_FLAGS
- |
if [ $TASK_STATIC_ANALYSIS == 1 ]; then
pecl install ast
fi
before_script:
- php --version
- composer --version
# enable code coverage
- |
if [ $TASK_TESTS_COVERAGE == 1 ]; then
PHPUNIT_COVERAGE_FLAG="--coverage-clover=coverage.clover"
fi
script:
- vendor/bin/phpunit --verbose $PHPUNIT_COVERAGE_FLAG
- |
if [ $TASK_STATIC_ANALYSIS == 1 ]; then
composer phan
fi
- |
if [ $TASK_STATIC_ANALYSIS == 1 ]; then
cat analysis.txt
fi
after_script:
- |
if [ $TASK_TESTS_COVERAGE == 1 ]; then
travis_retry wget https://scrutinizer-ci.com/ocular.phar
php ocular.phar code-coverage:upload --format=php-clover coverage.clover
fi