Skip to content

Commit b7436ce

Browse files
committed
Set PHP patch version automatically
1 parent 199cd73 commit b7436ce

File tree

2 files changed

+28
-7
lines changed

2 files changed

+28
-7
lines changed

.evergreen/install-dependencies.sh

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,33 @@
11
#!/bin/sh
22
set -o errexit # Exit the script with error if any of the commands fail
33

4+
set_php_version ()
5+
{
6+
PHP_VERSION=$1
7+
8+
if [ ! -d "/opt/php" ]; then
9+
echo "PHP is not available"
10+
exit 1
11+
fi
12+
13+
if [ -d "/opt/php/${PHP_VERSION}-64bit/bin" ]; then
14+
export PHP_PATH="/opt/php/${PHP_VERSION}-64bit/bin"
15+
else
16+
# Try to find the newest version matching our constant
17+
ls -1 /opt/php
18+
find /opt/php/ -maxdepth 1 -type d -name "${PHP_VERSION}*-64bit" -print
19+
export PHP_PATH=`find /opt/php/ -maxdepth 1 -type d -name "${PHP_VERSION}*-64bit" -print | sort -V -r | head -1`/bin
20+
fi
21+
22+
if [ ! -d "$PHP_PATH" ]; then
23+
echo "Could not find PHP binaries for version ${PHP_VERSION}. Listing available versions..."
24+
ls -1 /opt/php
25+
exit 1
26+
fi
27+
28+
export PATH=$PHP_PATH:$PATH
29+
}
30+
431
install_extension ()
532
{
633
# Workaround to get PECL running on PHP 7.0
@@ -100,10 +127,7 @@ case "$DEPENDENCIES" in
100127
;;
101128
esac
102129

103-
PHP_PATH=/opt/php/${PHP_VERSION}-64bit
104-
OLD_PATH=$PATH
105-
PATH=$PHP_PATH/bin:$OLD_PATH
106-
130+
set_php_version $PHP_VERSION
107131
install_extension
108132
install_composer
109133

.evergreen/run-tests.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,6 @@ OS=$(uname -s | tr '[:upper:]' '[:lower:]')
3737

3838
echo "Running tests with $AUTH and $SSL, connecting to: $MONGODB_URI"
3939

40-
OLD_PATH=$PATH
41-
PATH=/opt/php/${PHP_VERSION}-64bit/bin:$OLD_PATH
42-
4340
# Disable failing PHPUnit due to deprecations
4441
export SYMFONY_DEPRECATIONS_HELPER=999999
4542

0 commit comments

Comments
 (0)