forked from geocoder-php/Geocoder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
79 lines (67 loc) · 2.41 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
73
74
75
76
77
78
language: php
sudo: false
addons:
apt_packages:
- parallel
- libgeoip-dev
branches:
except:
- /^analysis-.*$/
- /^patch-.*$/
env:
global:
- MIN_PHP=7.0
matrix:
fast_finish: true
include:
- php: 7.0
env: deps="low"
- php: 7.1
env: deps="high"
- php: 7.0
- php: 7.1
before_install:
- |
# General configuration
stty cols 120
PHP=$TRAVIS_PHP_VERSION
[ -d ~/.composer ] || mkdir ~/.composer
export PHPUNIT=$(readlink -f ./phpunit)
export PHPUNIT_X="$PHPUNIT --exclude-group benchmark"
export COMPOSER_UP='composer update --no-progress --no-suggest --ansi --prefer-dist'
# If "geoip-1.1.1" exits in a provider's .travis.yml, then install the dependency.
export GEOIP_EXT='(grep -Fq "geoip-1.1.1" .travis.yml && sleep 30 && pecl install geoip-1.1.1 && echo "Installed php-geoip") || echo "Did not install php-geoip"'
# tfold is a helper to create folded reports
tfold () {
title=$1
fold=$(echo $title | sed -r 's/[^-_A-Za-z\d]+/./g')
shift
echo -e "travis_fold:start:$fold\\n\\e[1;34m$title\\e[0m"
bash -xc "$*" 2>&1 &&
echo -e "\\e[32mOK\\e[0m $title\\n\\ntravis_fold:end:$fold" ||
( echo -e "\\e[41mKO\\e[0m $title\\n" && exit 1 )
}
export -f tfold
COMPONENTS=$(find src -mindepth 2 -type f -name phpunit.xml.dist -printf '%h\n')
# php.ini configuration
INI=~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
phpenv config-rm xdebug.ini || echo "xdebug not available"
echo memory_limit = -1 >> $INI
install:
- if [[ ! $skip ]]; then $COMPOSER_UP; fi
- |
run_tests () {
set -e
if [[ $skip ]]; then
echo -e "\\n\\e[1;34mIntermediate PHP version $PHP is skipped for pull requests.\\e[0m"
elif [[ $deps = high ]]; then
echo "$COMPONENTS" | parallel --gnu -j10% "tfold {} 'cd {} && $GEOIP_EXT && $COMPOSER_UP && $PHPUNIT_X$LEGACY'"
elif [[ $deps = low ]]; then
echo "$COMPONENTS" | parallel --gnu -j10% "tfold {} 'cd {} && $GEOIP_EXT && $COMPOSER_UP --prefer-lowest --prefer-stable && $PHPUNIT_X'"
else
echo "$COMPONENTS" | parallel --gnu "tfold {} $PHPUNIT_X {}"
tfold tty-group $PHPUNIT --group tty
fi
}
script:
- (run_tests)