Skip to content

Commit 0c12b15

Browse files
tofumattnotnownikki
authored andcommitted
fix: Downgrade Docker image for WordPress, fix PHP5.2 testing (#8427)
1 parent 9ae5aa2 commit 0c12b15

File tree

5 files changed

+25
-17
lines changed

5 files changed

+25
-17
lines changed

.travis.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,36 +29,38 @@ branches:
2929
jobs:
3030
include:
3131
- stage: test
32+
env: WP_VERSION=4.9.7
3233
script:
3334
- npm install || exit 1
3435
- npm run ci || exit 1
3536

3637
- stage: test
37-
env: WP_VERSION=latest DOCKER=true
38+
env: WP_VERSION=4.9.7 DOCKER=true
3839
script:
3940
- ./bin/run-wp-unit-tests.sh
4041

4142
- stage: test
4243
php: 5.6
43-
env: WP_VERSION=latest
44+
env: WP_VERSION=4.9.7
4445
script:
4546
- ./bin/run-wp-unit-tests.sh
4647
if: branch = master and type != "pull_request"
4748

4849
- stage: test
4950
php: 7.1
50-
env: WP_VERSION=latest SWITCH_TO_PHP=5.3
51+
env: WP_VERSION=4.9.7 SWITCH_TO_PHP=5.3
5152
script:
5253
- ./bin/run-wp-unit-tests.sh
5354
if: branch = master and type != "pull_request"
5455

5556
- stage: test
5657
php: 7.1
57-
env: WP_VERSION=latest SWITCH_TO_PHP=5.2
58+
env: WP_VERSION=4.9.7 SWITCH_TO_PHP=5.2
5859
script:
5960
- ./bin/run-wp-unit-tests.sh
6061

6162
- stage: test
63+
env: WP_VERSION=4.9.7
6264
script:
6365
- npm install || exit 1
6466
- npm run build || exit 1

bin/install-docker.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
# Exit if any command fails.
44
set -e
55

6+
WP_VERSION=${WP_VERSION-latest}
7+
68
# Include useful functions.
79
. "$(dirname "$0")/includes.sh"
810

@@ -37,7 +39,7 @@ docker-compose up -d >/dev/null
3739

3840
# Install the PHPUnit test scaffolding.
3941
echo -e $(status_message "Installing PHPUnit test scaffolding...")
40-
docker-compose run --rm wordpress_phpunit /app/bin/install-wp-tests.sh wordpress_test root example mysql latest false >/dev/null
42+
docker-compose run --rm wordpress_phpunit /app/bin/install-wp-tests.sh wordpress_test root example mysql $WP_VERSION false > /dev/null
4143

4244
# Install Composer. This is only used to run WordPress Coding Standards checks.
4345
echo -e $(status_message "Installing and updating Composer modules...")

bin/install-php-phpunit.sh

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,20 @@ if [[ ${SWITCH_TO_PHP:0:3} == "5.2" ]] || [[ ${SWITCH_TO_PHP:0:3} == "5.3" ]]; t
4747
$HOME/php-utils-bin/phpbrew init
4848
$HOME/php-utils-bin/phpbrew known --old
4949

50+
# fetch the build tarballs manually
51+
mkdir -p $HOME/.phpbrew/distfiles
52+
curl -L -o $HOME/.phpbrew/distfiles/php-5.2.17.tar.bz2 https://museum.php.net/php5/php-5.2.17.tar.bz2
53+
curl -L -o $HOME/.phpbrew/distfiles/php-5.3.29.tar.bz2 https://museum.php.net/php5/php-5.3.29.tar.bz2
54+
5055
# build PHP5.2
5156
echo 'Installing PHP 5.2...'
52-
$HOME/php-utils-bin/phpbrew install --patch ${THIS_DIR}/patches/node.patch --patch ${THIS_DIR}/patches/openssl.patch 5.2 +default +mysql +pdo \
53-
+gettext +phar +openssl -- --with-openssl-dir=/usr/include/openssl --enable-spl --with-mysql --with-mysqli=/usr/bin/mysql_config --with-pdo-mysql=/usr \
54-
> /dev/null
57+
$HOME/php-utils-bin/phpbrew install --patch ${THIS_DIR}/patches/node.patch --patch ${THIS_DIR}/patches/openssl.patch 5.2.17 +default +mysql +pdo \
58+
+gettext +phar +openssl -- --with-openssl-dir=/usr/include/openssl --enable-spl --with-mysql --with-mysqli=/usr/bin/mysql_config --with-pdo-mysql=/usr
5559

5660
# build PHP5.3
5761
echo 'Installing PHP 5.3...'
58-
$HOME/php-utils-bin/phpbrew install --patch ${THIS_DIR}/patches/node.patch --patch ${THIS_DIR}/patches/openssl.patch 5.3 +default +mysql +pdo \
59-
+gettext +phar +openssl -- --with-openssl-dir=/usr/include/openssl --enable-spl --with-mysql --with-mysqli=/usr/bin/mysql_config --with-pdo-mysql=/usr \
60-
> /dev/null
62+
$HOME/php-utils-bin/phpbrew install --patch ${THIS_DIR}/patches/node.patch --patch ${THIS_DIR}/patches/openssl.patch 5.3.29 +default +mysql +pdo \
63+
+gettext +phar +openssl -- --with-openssl-dir=/usr/include/openssl --enable-spl --with-mysql --with-mysqli=/usr/bin/mysql_config --with-pdo-mysql=/usr
6164

6265
# install PHPUnit 3.6. The only install method available is from source, using git branches old
6366
# enough that they don't rely on any PHP5.3+ features. This clones each needed dependency
@@ -91,8 +94,6 @@ if [[ ${SWITCH_TO_PHP:0:3} == "5.2" ]] || [[ ${SWITCH_TO_PHP:0:3} == "5.3" ]]; t
9194
export PHPBREW_RC_ENABLE=1
9295
source $HOME/.phpbrew/bashrc
9396
phpbrew use 5.2.17
94-
pear channel-discover pear.symfony-project.com
95-
pear install pear.symfony-project.com/YAML-1.0.2
9697

9798
# manually go back to the system php, we can't use `phpbrew switch-off`
9899
# because we're running a version of php that phpbrew doesn't work with at this point

bin/install-wordpress.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,12 @@ fi
4747

4848
# Install WordPress.
4949
echo -e $(status_message "Installing WordPress...")
50-
docker-compose run --rm $CLI core install --title="$SITE_TITLE" --admin_user=admin --admin_password=password --admin_email=test@test.com --skip-email --url=http://localhost:$HOST_PORT >/dev/null
50+
# The `-u 33` flag tells Docker to run the command as a particular user and
51+
# prevents permissions errors. See: https://github.com/WordPress/gutenberg/pull/8427#issuecomment-410232369
52+
docker-compose run --rm -u 33 $CLI core install --title="$SITE_TITLE" --admin_user=admin --admin_password=password --admin_email=test@test.com --skip-email --url=http://localhost:$HOST_PORT >/dev/null
5153
# Check for WordPress updates, just in case the WordPress image isn't up to date.
52-
docker-compose run --rm $CLI core update >/dev/null
54+
# (Disabled until https://github.com/WordPress/gutenberg/issues/8445 is fixed.)
55+
# docker-compose run --rm -u 33 $CLI core update >/dev/null
5356

5457
# If the 'wordpress' volume wasn't during the down/up earlier, but the post port has changed, we need to update it.
5558
CURRENT_URL=$(docker-compose run -T --rm $CLI option get siteurl)

docker-compose.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ version: '3.1'
33
services:
44

55
wordpress:
6-
image: wordpress
6+
image: wordpress:4.9.7 # Pinned to version 4.9.7 until https://github.com/WordPress/gutenberg/issues/8445 is fixed.
77
ports:
88
- 8888:80
99
environment:
@@ -41,7 +41,7 @@ services:
4141
- .:/app
4242

4343
wordpress_e2e_tests:
44-
image: wordpress
44+
image: wordpress:4.9.7 # Pinned to version 4.9.7 until https://github.com/WordPress/gutenberg/issues/8445 is fixed.
4545
ports:
4646
- 8889:80
4747
environment:

0 commit comments

Comments
 (0)