Skip to content

Commit 58a499f

Browse files
committed
PHPLIB-519: Extract driver installation to separate script
1 parent ee0b453 commit 58a499f

File tree

2 files changed

+24
-19
lines changed

2 files changed

+24
-19
lines changed

.travis.yml

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
php: "7.1"
3232
before_install: []
3333
before_script:
34-
- pecl install -f mongodb-${DRIVER_VERSION}
34+
- .travis/install-extension.sh
3535
- composer require --no-update doctrine/coding-standard=^6.0
3636
- composer install --no-interaction --no-progress --no-suggest ${COMPOSER_OPTIONS}
3737
script: vendor/bin/phpcs
@@ -120,28 +120,11 @@ before_install:
120120
- mongod --version
121121
- mongo-orchestration --version
122122
- export MO_PATH=`python -c 'import mongo_orchestration; from os import path; print(path.dirname(mongo_orchestration.__file__));'`
123-
- |
124-
INI=~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
125-
# tpecl is a helper to compile and cache php extensions
126-
tpecl () {
127-
local ext_name=$1
128-
local ext_so=$2
129-
local ext_dir=$(php -r "echo ini_get('extension_dir');")
130-
local ext_cache=~/php-ext/$(basename $ext_dir)/$ext_name
131-
if [[ -e $ext_cache/$ext_so ]]; then
132-
echo extension = $ext_cache/$ext_so >> $INI
133-
else
134-
mkdir -p $ext_cache
135-
echo yes | pecl install -f $ext_name &&
136-
cp $ext_dir/$ext_so $ext_cache
137-
fi
138-
}
139-
export -f tpecl
140123

141124
before_script:
142125
- mongo-orchestration start
143126
- .travis/setup_mo.sh
144-
- pecl install -f mongodb-${DRIVER_VERSION}
127+
- .travis/install-extension.sh
145128
- php --ri mongodb
146129
- composer update --no-interaction --no-progress --no-suggest --prefer-dist --prefer-stable ${COMPOSER_OPTIONS}
147130
- ulimit -c

.travis/install-extension.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/sh
2+
3+
INI=~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
4+
# tpecl is a helper to compile and cache php extensions
5+
tpecl () {
6+
local ext_name=$1
7+
local ext_so=$2
8+
local ext_dir=$(php -r "echo ini_get('extension_dir');")
9+
local ext_cache=~/php-ext/$(basename $ext_dir)/$ext_name
10+
if [[ -e $ext_cache/$ext_so ]]; then
11+
echo extension = $ext_cache/$ext_so >> $INI
12+
else
13+
mkdir -p $ext_cache
14+
echo yes | pecl install -f $ext_name &&
15+
cp $ext_dir/$ext_so $ext_cache
16+
fi
17+
}
18+
19+
if [ "x${DRIVER_VERSION}" != "x" ]; then
20+
echo "Installing driver version ${DRIVER_VERSION} from PECL"
21+
tpecl mongodb-${DRIVER_VERSION} mongodb.so
22+
fi

0 commit comments

Comments
 (0)