forked from geocoder-php/Geocoder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
92 lines (82 loc) · 3.04 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
79
80
81
82
83
84
85
86
87
88
89
90
91
language: php
sudo: false
addons:
apt_packages:
- parallel
- libgeoip-dev
env:
global:
- MIN_PHP=5.5.9
matrix:
fast_finish: true
allow_failures:
- php: 5.5
env: deps="low"
include:
- php: 5.5
env: deps="low"
- php: 5.5
- php: 5.6
- php: 7.0
- php: 7.1
- php: hhvm
before_install:
- if [ "$TRAVIS_PHP_VERSION" != "hhvm" && "$TRAVIS_PHP_VERSION" != "7.0" ]; then pecl install geoip; fi
- if [ "$TRAVIS_PHP_VERSION" == "7.0" ]; then composer require "geoip/geoip"; fi
- |
# 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'
# 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
# Matrix lines for intermediate PHP versions are skipped for pull requests
if [[ ! $deps && ! $PHP = ${MIN_PHP%.*} && ! $PHP = hhvm* && $TRAVIS_PULL_REQUEST != false ]]; then
deps=skip
skip=1
else
COMPONENTS=$(find src -mindepth 2 -type f -name phpunit.xml.dist -printf '%h\n')
fi
# php.ini configuration
if [[ $PHP = hhvm* ]]; then
INI=/etc/hhvm/php.ini
else
INI=~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
phpenv config-rm xdebug.ini || echo "xdebug not available"
fi
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 {} && $COMPOSER_UP && $PHPUNIT_X$LEGACY'"
elif [[ $deps = low ]]; then
echo "$COMPONENTS" | parallel --gnu -j10% "tfold {} 'cd {} && $COMPOSER_UP --prefer-lowest --prefer-stable && $PHPUNIT_X'" &&
# Test the PhpUnit bridge on PHP 5.5, using the original phpunit script
tfold src/Symfony/Bridge/PhpUnit \
"cd src/Symfony/Bridge/PhpUnit && wget https://phar.phpunit.de/phpunit-4.8.phar && phpenv global 5.3 && composer update --no-progress --ansi && php phpunit-4.8.phar"
elif [[ $PHP = hhvm* ]]; then
$PHPUNIT --exclude-group benchmark,intl-data
else
echo "$COMPONENTS" | parallel --gnu "tfold {} $PHPUNIT_X {}"
tfold tty-group $PHPUNIT --group tty
fi
}
script:
- (run_tests)