[travis] cache compiled php extensions

This commit is contained in:
Nicolas Grekas 2018-02-04 10:26:21 +01:00
parent 1111da7363
commit b9def8ab50

View File

@ -35,6 +35,7 @@ cache:
directories:
- .phpunit
- php-$MIN_PHP
- php-ext
services: mongodb
@ -102,6 +103,23 @@ before_install:
echo extension = mongo.so >> $INI
fi
# tpecl is a helper to compile and cache php extensions
tpecl () {
local ext_name=$1
local ext_so=$2
local ext_dir=$(php -r "echo ini_get('extension_dir');")
local ext_cache=~/php-ext/$(basename $ext_dir)/$ext_name
if [[ -e $ext_cache/$ext_so ]]; then
echo extension = $ext_cache/$ext_so >> $INI
else
mkdir -p $ext_cache
echo yes | pecl install -f $ext_name &&
cp $ext_dir/$ext_so $ext_cache
fi
}
export -f tpecl
# 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
@ -120,12 +138,12 @@ before_install:
- |
# Install extra PHP extensions
if [[ ! $skip && $PHP = 5.* ]]; then
([[ $deps ]] || tfold ext.symfony_debug 'cd src/Symfony/Component/Debug/Resources/ext && phpize && ./configure && make && echo extension = $(pwd)/modules/symfony_debug.so >> '"$INI") &&
tfold ext.memcached pecl install -f memcached-2.1.0 &&
tfold ext.apcu4 'echo yes | pecl install -f apcu-4.0.11'
([[ $deps ]] || tfold ext.symfony_debug 'cd src/Symfony/Component/Debug/Resources/ext && phpize && ./configure && make && echo extension = $(pwd)/modules/symfony_debug.so >> '"$INI")
tfold ext.memcached tpecl memcached-2.1.0 memcached.so
tfold ext.apcu tpecl apcu-4.0.11 apcu.so
elif [[ ! $skip && $PHP = 7.* ]]; then
tfold ext.apcu5 'echo yes | pecl install -f apcu-5.1.6'
tfold ext.mongodb pecl install -f mongodb-1.4.0RC1
tfold ext.apcu tpecl apcu-5.1.6 apcu.so
tfold ext.mongodb tpecl mongodb-1.4.0RC1 mongodb.so
fi
install: