forked from mxr576/apigee-client-php
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
58 lines (50 loc) · 2.2 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
language: php
sudo: false
addons:
apt:
packages:
- git
php:
- 7.1
- 7.2
matrix:
fast_finish: true
cache:
directories:
- vendor
- $HOME/.composer/cache/files
notifications:
email: false
env:
global:
- COMPOSER_OPTIONS="--no-suggest --no-interaction"
# To prevent failing test runs caused by
# "The process "phpunit" exceeded the timeout of 300 seconds.
- COMPOSER_PROCESS_TIMEOUT=0
matrix:
- DEPENDENCIES="--prefer-lowest"
- DEPENDENCIES=""
install:
# Disable xDebug (but do not remove its configuration, because we need that for code coverage calculation).
# Clear the default 6 minutes max execution time limit otherwise test suite fails in case of online tests.
- echo -en "max_execution_time = 0\nxdebug.default_enable = 0" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
- composer global require hirak/prestissimo:^0.3.7
- travis_retry composer update $COMPOSER_OPTIONS $DEPENDENCIES
# Fix PHPUnit tests on PHP >= 7.2 by upgrading Guzzle to >= 6.3.0.
# https://github.com/guzzle/guzzle/issues/1973
- if [[ $(phpenv version-name) = "7.2" ]] && [[ "$DEPENDENCIES" = "--prefer-lowest" ]]; then composer require guzzlehttp/guzzle:^6.3.0 --update-with-dependencies $DEPENDENCIES; fi
- composer show
# We run tests even if the code style analyses fails just to be able get a complete picture about what needs to be
# improved.
script:
- set -e
# Check only changed files.
- IFS=$'\n'; CHANGED_FILES=($(git diff --name-only --diff-filter=ACMRTUXB "${TRAVIS_COMMIT_RANGE}")); unset IFS
- EXTRA_ARGS=('--path-mode=intersection' '--' "${CHANGED_FILES[@]}")
- composer check-style -- --using-cache=no "${EXTRA_ARGS[@]}"
- composer analyze
# Only calculate metrics data for this specific build.
- if [[ $(phpenv version-name) = "7.1" ]] && [[ "$DEPENDENCIES" = "--prefer-lowest" ]]; then composer test -- --coverage-clover=clover.xml; else composer test; fi
- if [[ $(phpenv version-name) = "7.1" ]] && [[ "$DEPENDENCIES" = "--prefer-lowest" ]]; then composer metrics; fi
after_success:
- if [[ $(phpenv version-name) = "7.1" ]] && [[ "$DEPENDENCIES" = "--prefer-lowest" ]]; then bash <(curl -s https://codecov.io/bash) -f ./clover.xml; fi