Skip to content

Commit

Permalink
fix: Downgrade Docker image for WordPress, fix PHP5.2 testing (#8427)
Browse files Browse the repository at this point in the history
  • Loading branch information
tofumatt authored and notnownikki committed Aug 3, 2018
1 parent 9ae5aa2 commit 0c12b15
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 17 deletions.
10 changes: 6 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,36 +29,38 @@ branches:
jobs:
include:
- stage: test
env: WP_VERSION=4.9.7
script:
- npm install || exit 1
- npm run ci || exit 1

- stage: test
env: WP_VERSION=latest DOCKER=true
env: WP_VERSION=4.9.7 DOCKER=true
script:
- ./bin/run-wp-unit-tests.sh

- stage: test
php: 5.6
env: WP_VERSION=latest
env: WP_VERSION=4.9.7
script:
- ./bin/run-wp-unit-tests.sh
if: branch = master and type != "pull_request"

- stage: test
php: 7.1
env: WP_VERSION=latest SWITCH_TO_PHP=5.3
env: WP_VERSION=4.9.7 SWITCH_TO_PHP=5.3
script:
- ./bin/run-wp-unit-tests.sh
if: branch = master and type != "pull_request"

- stage: test
php: 7.1
env: WP_VERSION=latest SWITCH_TO_PHP=5.2
env: WP_VERSION=4.9.7 SWITCH_TO_PHP=5.2
script:
- ./bin/run-wp-unit-tests.sh

- stage: test
env: WP_VERSION=4.9.7
script:
- npm install || exit 1
- npm run build || exit 1
Expand Down
4 changes: 3 additions & 1 deletion bin/install-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
# Exit if any command fails.
set -e

WP_VERSION=${WP_VERSION-latest}

# Include useful functions.
. "$(dirname "$0")/includes.sh"

Expand Down Expand Up @@ -37,7 +39,7 @@ docker-compose up -d >/dev/null

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

# Install Composer. This is only used to run WordPress Coding Standards checks.
echo -e $(status_message "Installing and updating Composer modules...")
Expand Down
17 changes: 9 additions & 8 deletions bin/install-php-phpunit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,20 @@ if [[ ${SWITCH_TO_PHP:0:3} == "5.2" ]] || [[ ${SWITCH_TO_PHP:0:3} == "5.3" ]]; t
$HOME/php-utils-bin/phpbrew init
$HOME/php-utils-bin/phpbrew known --old

# fetch the build tarballs manually
mkdir -p $HOME/.phpbrew/distfiles
curl -L -o $HOME/.phpbrew/distfiles/php-5.2.17.tar.bz2 https://museum.php.net/php5/php-5.2.17.tar.bz2
curl -L -o $HOME/.phpbrew/distfiles/php-5.3.29.tar.bz2 https://museum.php.net/php5/php-5.3.29.tar.bz2

# build PHP5.2
echo 'Installing PHP 5.2...'
$HOME/php-utils-bin/phpbrew install --patch ${THIS_DIR}/patches/node.patch --patch ${THIS_DIR}/patches/openssl.patch 5.2 +default +mysql +pdo \
+gettext +phar +openssl -- --with-openssl-dir=/usr/include/openssl --enable-spl --with-mysql --with-mysqli=/usr/bin/mysql_config --with-pdo-mysql=/usr \
> /dev/null
$HOME/php-utils-bin/phpbrew install --patch ${THIS_DIR}/patches/node.patch --patch ${THIS_DIR}/patches/openssl.patch 5.2.17 +default +mysql +pdo \
+gettext +phar +openssl -- --with-openssl-dir=/usr/include/openssl --enable-spl --with-mysql --with-mysqli=/usr/bin/mysql_config --with-pdo-mysql=/usr

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

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

# manually go back to the system php, we can't use `phpbrew switch-off`
# because we're running a version of php that phpbrew doesn't work with at this point
Expand Down
7 changes: 5 additions & 2 deletions bin/install-wordpress.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,12 @@ fi

# Install WordPress.
echo -e $(status_message "Installing WordPress...")
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
# The `-u 33` flag tells Docker to run the command as a particular user and
# prevents permissions errors. See: https://github.com/WordPress/gutenberg/pull/8427#issuecomment-410232369
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
# Check for WordPress updates, just in case the WordPress image isn't up to date.
docker-compose run --rm $CLI core update >/dev/null
# (Disabled until https://github.com/WordPress/gutenberg/issues/8445 is fixed.)
# docker-compose run --rm -u 33 $CLI core update >/dev/null

# If the 'wordpress' volume wasn't during the down/up earlier, but the post port has changed, we need to update it.
CURRENT_URL=$(docker-compose run -T --rm $CLI option get siteurl)
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: '3.1'
services:

wordpress:
image: wordpress
image: wordpress:4.9.7 # Pinned to version 4.9.7 until https://github.com/WordPress/gutenberg/issues/8445 is fixed.
ports:
- 8888:80
environment:
Expand Down Expand Up @@ -41,7 +41,7 @@ services:
- .:/app

wordpress_e2e_tests:
image: wordpress
image: wordpress:4.9.7 # Pinned to version 4.9.7 until https://github.com/WordPress/gutenberg/issues/8445 is fixed.
ports:
- 8889:80
environment:
Expand Down

0 comments on commit 0c12b15

Please sign in to comment.