minor #26039 [travis] cache compiled php extensions (nicolas-grekas)

This PR was merged into the 2.7 branch.

Discussion
----------

[travis] cache compiled php extensions

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Should save more that 80s per job on PHP 7 esp.

Commits
-------

b9def8a [travis] cache compiled php extensions
This commit is contained in:
Nicolas Grekas 2018-02-04 13:53:07 +01:00
commit c219755f17

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: