Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
87 lines (73 sloc) 2.74 KB
language: php
sudo: false
addons:
apt_packages:
- parallel
- libgeoip-dev
branches:
except:
- /^analysis-.*$/
- /^patch-.*$/
env:
global:
- MIN_PHP=7.0
cache:
directories:
- $HOME/.composer/cache/files
matrix:
fast_finish: true
include:
- php: 7.3
env: deps="low"
- php: 7.3
env: deps="high"
- php: 7.0
- php: 7.1
- php: 7.2
- php: 7.3
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_INSTALL='(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"'
export GEOIP_EXT_REMOVE='(grep -Fq "geoip-1.1.1" .travis.yml && sleep 30 && pecl uninstall geoip-1.1.1 && echo "Removed php-geoip") || echo "php-geoip not installed"'
# 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_INSTALL && $COMPOSER_UP && $PHPUNIT_X$LEGACY && $GEOIP_EXT_REMOVE'"
elif [[ $deps = low ]]; then
echo "$COMPONENTS" | parallel --gnu -j10% "tfold {} 'cd {} && $GEOIP_EXT_INSTALL && $COMPOSER_UP --prefer-lowest --prefer-stable && $PHPUNIT_X && $GEOIP_EXT_REMOVE'"
else
echo "$COMPONENTS" | parallel --gnu "tfold {} $PHPUNIT_X {}"
tfold tty-group $PHPUNIT --group tty
fi
}
script:
- (run_tests)
You can’t perform that action at this time.