8000 minor #26039 [travis] cache compiled php extensions (nicolas-grekas) · symfony/symfony@c219755 · GitHub
[go: up one dir, main page]

Skip to content

Commit c219755

Browse files
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
2 parents 1111da7 + b9def8a commit c219755

File tree

1 file changed

+23
-5
lines changed

1 file changed

+23
-5
lines changed

.travis.yml

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ cache:
3535
directories:
3636
- .phpunit
3737
- php-$MIN_PHP
38+
- php-ext
3839

3940
services: mongodb
4041

@@ -102,6 +103,23 @@ before_install:
102103
echo extension = mongo.so >> $INI
103104
fi
104105
106+
# tpecl is a helper to compile and cache php extensions
107+
tpecl () {
108+
local ext_name=$1
109+
local ext_so=$2
110+
local ext_dir=$(php -r "echo ini_get('extension_dir');")
111+
local ext_cache=~/php-ext/$(basename $ext_dir)/$ext_name
112+
113+
if [[ -e $ext_cache/$ext_so ]]; then
114+
echo extension = $ext_cache/$ext_so >> $INI
115+
else
116+
mkdir -p $ext_cache
117+
echo yes | pecl install -f $ext_name &&
118+
cp $ext_dir/$ext_so $ext_cache
119+
fi
120+
}
121+
export -f tpecl
122+
105123
# Matrix lines for intermediate PHP versions are skipped for pull requests
106124
if [[ ! $deps && ! $PHP = ${MIN_PHP%.*} && ! $PHP = hhvm* && $TRAVIS_PULL_REQUEST != false ]]; then
107125
deps=skip
@@ -120,12 +138,12 @@ before_install:
120138
- |
121139
# Install extra PHP extensions
122140
if [[ ! $skip && $PHP = 5.* ]]; then
123-
([[ $deps ]] || tfold ext.symfony_debug 'cd src/Symfony/Component/Debug/Resources/ext && phpize && ./configure && make && echo extension = $(pwd)/modules/symfony_debug.so >> '"$INI") &&
124-
tfold ext.memcached pecl install -f memcached-2.1.0 &&
125-
tfold ext.apcu4 'echo yes | pecl install -f apcu-4.0.11'
141+
([[ $deps ]] || tfold ext.symfony_debug 'cd src/Symfony/Component/Debug/Resources/ext && phpize && ./configure && make && echo extension = $(pwd)/modules/symfony_debug.so >> '"$INI")
142+
tfold ext.memcached tpecl memcached-2.1.0 memcached.so
143+
tfold ext.apcu tpecl apcu-4.0.11 apcu.so
126144
elif [[ ! $skip && $PHP = 7.* ]]; then
127-
tfold ext.apcu5 'echo yes | pecl install -f apcu-5.1.6'
128-
tfold ext.mongodb pecl install -f mongodb-1.4.0RC1
145+
tfold ext.apcu tpecl apcu-5.1.6 apcu.so
146+
tfold ext.mongodb tpecl mongodb-1.4.0RC1 mongodb.so
129147
fi
130148
131149
install:

0 commit comments

Comments
 (0)
0