Skip to content

Commit

Permalink
Backport [56464].
Browse files Browse the repository at this point in the history
  • Loading branch information
desrosj committed Jun 3, 2024
1 parent 0e30be5 commit 41e04b6
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
1 change: 0 additions & 1 deletion .github/workflows/phpunit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ concurrency:
# Any needed permissions should be configured at the job level.
permissions: {}


jobs:
#
# Creates a PHPUnit test job for each PHP/MySQL combination.
Expand Down
24 changes: 20 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ services:
command: /bin/sh -c "envsubst '$$LOCAL_DIR' < /etc/nginx/conf.d/default.template > /etc/nginx/conf.d/default.conf && exec nginx -g 'daemon off;'"

depends_on:
- php
php:
condition: service_started
mysql:
condition: service_healthy

##
# The PHP container.
Expand All @@ -50,9 +53,6 @@ services:
# Copy or delete the Memcached dropin plugin file as appropriate.
command: /bin/sh -c "if [ $LOCAL_PHP_MEMCACHED = true ]; then cp -n /var/www/tests/phpunit/includes/object-cache.php /var/www/src/wp-content/object-cache.php; else rm -f /var/www/src/wp-content/object-cache.php; fi && exec php-fpm"

depends_on:
- mysql

# The init directive ensures the command runs with a PID > 1, so Ctrl+C works correctly.
init: true

Expand Down Expand Up @@ -82,6 +82,12 @@ services:
# For compatibility with PHP versions that don't support the caching_sha2_password auth plugin used in MySQL 8.0.
command: --default-authentication-plugin=mysql_native_password

healthcheck:
test: [ "CMD-SHELL", "if [ \"$LOCAL_DB_TYPE\" = \"mariadb\" ]; then mariadb-admin ping -h localhost; else mysqladmin ping -h localhost; fi" ]
timeout: 5s
interval: 5s
retries: 10

##
# The WP CLI container.
##
Expand All @@ -106,6 +112,12 @@ services:
extra_hosts:
- localhost:host-gateway

depends_on:
php:
condition: service_started
mysql:
condition: service_healthy

##
# The Memcached container.
##
Expand All @@ -118,6 +130,10 @@ services:
ports:
- 11211:11211

depends_on:
php:
condition: service_started

volumes:
# So that sites aren't wiped every time containers are restarted, MySQL uses a persistent volume.
mysql: {}
Expand Down

0 comments on commit 41e04b6

Please sign in to comment.