Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add MySQL 8.4 LTS testing. #6680

Open
wants to merge 8 commits into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions .github/workflows/install-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@ jobs:
- db-version: '5.0'
- db-version: '5.1'
- db-version: '5.5'
- php: '7.2'
db-version: '8.4'
- php: '7.3'
db-version: '8.4'

services:
database:
Expand All @@ -131,13 +135,13 @@ jobs:
- 3306
options: >-
--health-cmd="mysqladmin ping"
--health-interval=30s
--health-timeout=10s
--health-retries=5
-e MYSQL_ROOT_PASSWORD=root
-e MYSQL_DATABASE=test_db
--health-interval="30s"
--health-timeout="10s"
--health-retries="5"
-e MYSQL_ROOT_PASSWORD="root"
-e MYSQL_DATABASE="test_db"
--entrypoint sh ${{ matrix.db-type }}:${{ matrix.db-version }}
-c "exec docker-entrypoint.sh mysqld${{ matrix.db-version != '5.5' && ' --default-authentication-plugin=mysql_native_password"' || '' }}
-c "exec docker-entrypoint.sh mysqld${{ matrix.db-type == 'mysql' && contains( fromJSON('["7.2", "7.3"]'), matrix.php ) && ' --default-authentication-plugin=mysql_native_password' || '' }}"

steps:
- name: Set up PHP ${{ matrix.php }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/phpunit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
os: [ ubuntu-latest ]
php: [ '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3' ]
db-type: [ 'mysql' ]
db-version: [ '5.7', '8.0', '8.1', '8.2', '8.3' ]
db-version: [ '5.7', '8.0', '8.4' ]
tests-domain: [ 'example.org' ]
multisite: [ false, true ]
memcached: [ false ]
Expand Down
11 changes: 10 additions & 1 deletion .github/workflows/reusable-upgrade-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,16 @@ jobs:
image: ${{ inputs.db-type }}:${{ inputs.db-version }}
ports:
- 3306
options: --health-cmd="mysqladmin ping" --health-interval=30s --health-timeout=10s --health-retries=5 -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=test_db --entrypoint sh ${{ inputs.db-type }}:${{ inputs.db-version }} -c "exec docker-entrypoint.sh mysqld --default-authentication-plugin=mysql_native_password"
options: >-
--health-cmd="mysqladmin ping"
--health-interval="30s"
--health-timeout="10s"
--health-retries="5"
-e MYSQL_ROOT_PASSWORD="root"
-e MYSQL_DATABASE="test_db"
--entrypoint sh ${{ inputs.db-type }}:${{ inputs.db-version }}
-c "exec docker-entrypoint.sh mysqld${{ inputs.db-type == 'mysql' && contains( fromJSON('["7.2", "7.3"]'), inputs.php ) && ' --default-authentication-plugin=mysql_native_password' || '' }}"


steps:
- name: Set up PHP ${{ inputs.php }}
Expand Down
40 changes: 29 additions & 11 deletions .github/workflows/upgrade-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,25 @@ jobs:
# Spawns upgrade testing from WordPress 6.x versions with MySQL.
upgrade-tests-wp-6x-mysql:
name: ${{ matrix.wp }} to ${{ inputs.new-version && inputs.new-version || 'latest' }}
uses: WordPress/wordpress-develop/.github/workflows/reusable-upgrade-testing.yml@trunk
uses: desrosj/wordpress-develop/.github/workflows/reusable-upgrade-testing.yml@add/mysql-8.4
desrosj marked this conversation as resolved.
Show resolved Hide resolved
if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
permissions:
contents: read
strategy:
fail-fast: false
matrix:
os: [ 'ubuntu-latest' ]
php: [ '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3' ]
php: [ '7.2', '7.3', '7.4', '8.0', '8.4' ]
db-type: [ 'mysql' ]
db-version: [ '5.7', '8.0' ]
wp: [ '6.0', '6.1', '6.2', '6.3', '6.4', '6.5', '6.6' ]
db-version: [ '5.7', '8.0', '8.4' ]
multisite: [ false, true ]

exclude:
- php: '7.2'
db-version: '8.4'
- php: '7.3'
db-version: '8.4'
with:
os: ${{ matrix.os }}
php: ${{ matrix.php }}
Expand All @@ -60,17 +66,23 @@ jobs:
# Spawns upgrade testing from WordPress 5.x versions on PHP 7.x with MySQL.
upgrade-tests-wp-5x-php-7x-mysql:
name: ${{ matrix.wp }} to ${{ inputs.new-version && inputs.new-version || 'latest' }}
uses: WordPress/wordpress-develop/.github/workflows/reusable-upgrade-testing.yml@trunk
uses: desrosj/wordpress-develop/.github/workflows/reusable-upgrade-testing.yml@add/mysql-8.4
if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
strategy:
fail-fast: false
matrix:
os: [ 'ubuntu-latest' ]
php: [ '7.2', '7.3', '7.4' ]
db-type: [ 'mysql' ]
db-version: [ '5.7', '8.0' ]
db-version: [ '5.7', '8.0', '8.4' ]
wp: [ '5.0', '5.1', '5.2', '5.3', '5.4', '5.5', '5.6', '5.7', '5.8', '5.9' ]
multisite: [ false, true ]

exclude:
- php: '7.2'
db-version: '8.4'
- php: '7.3'
db-version: '8.4'
with:
os: ${{ matrix.os }}
php: ${{ matrix.php }}
Expand All @@ -87,15 +99,15 @@ jobs:
# - array/string offset with curly braces.
upgrade-tests-wp-5x-php-8x-mysql:
name: ${{ matrix.wp }} to ${{ inputs.new-version && inputs.new-version || 'latest' }}
uses: WordPress/wordpress-develop/.github/workflows/reusable-upgrade-testing.yml@trunk
uses: desrosj/wordpress-develop/.github/workflows/reusable-upgrade-testing.yml@add/mysql-8.4
if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
strategy:
fail-fast: false
matrix:
os: [ 'ubuntu-latest' ]
php: [ '8.0', '8.1', '8.2', '8.3' ]
db-type: [ 'mysql' ]
db-version: [ '5.7', '8.0' ]
db-version: [ '5.7', '8.0', '8.4' ]
wp: [ '5.3', '5.4', '5.5', '5.6', '5.7', '5.8', '5.9' ]
multisite: [ false, true ]
with:
Expand All @@ -110,17 +122,23 @@ jobs:
# Spawns upgrade testing from WordPress 4.x versions on PHP 7.x with MySQL.
upgrade-tests-wp-4x-php-7x-mysql:
name: ${{ matrix.wp }} to ${{ inputs.new-version && inputs.new-version || 'latest' }}
uses: WordPress/wordpress-develop/.github/workflows/reusable-upgrade-testing.yml@trunk
uses: desrosj/wordpress-develop/.github/workflows/reusable-upgrade-testing.yml@add/mysql-8.4
if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
strategy:
fail-fast: false
matrix:
os: [ 'ubuntu-latest' ]
php: [ '7.2', '7.3', '7.4' ]
db-type: [ 'mysql' ]
db-version: [ '5.7', '8.0' ]
db-version: [ '5.7', '8.0', '8.4' ]
wp: [ '4.1', '4.2', '4.3', '4.4', '4.5', '4.6', '4.7', '4.8', '4.9' ]
multisite: [ false, true ]

exclude:
- php: '7.2'
db-version: '8.4'
- php: '7.3'
db-version: '8.4'
with:
os: ${{ matrix.os }}
php: ${{ matrix.php }}
Expand All @@ -137,15 +155,15 @@ jobs:
# - array/string offset with curly braces.
upgrade-tests-wp-4x-php-8x-mysql:
name: ${{ matrix.wp }} to ${{ inputs.new-version && inputs.new-version || 'latest' }}
uses: WordPress/wordpress-develop/.github/workflows/reusable-upgrade-testing.yml@trunk
uses: desrosj/wordpress-develop/.github/workflows/reusable-upgrade-testing.yml@add/mysql-8.4
if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
strategy:
fail-fast: false
matrix:
os: [ 'ubuntu-latest' ]
php: [ '8.0', '8.1', '8.2', '8.3' ]
db-type: [ 'mysql' ]
db-version: [ '5.7', '8.0' ]
db-version: [ '5.7', '8.0', '8.4' ]
wp: [ '4.1', '4.2', '4.3', '4.4', '4.5' ]
multisite: [ false, true ]
with:
Expand Down
8 changes: 1 addition & 7 deletions .version-support-mysql.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,20 @@
{
"6-7": [
"8.3",
"8.2",
"8.1",
"8.4",
"8.0",
"5.7",
"5.6",
"5.5"
],
"6-6": [
"8.3",
"8.2",
"8.1",
"8.0",
"5.7",
"5.6",
"5.5"
],
"6-5": [
"8.3",
"8.2",
"8.1",
"8.0",
"5.7",
"5.6",
Expand Down
5 changes: 5 additions & 0 deletions docker-compose.old-php-mysql-84.override.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
services:
desrosj marked this conversation as resolved.
Show resolved Hide resolved

mysql:
volumes:
- ./tools/local-env/mysql-old-php.conf:/etc/mysql/conf.d/config-file.cnf
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ services:
- mysql:/var/lib/mysql

# 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
command: ${LOCAL_DB_AUTH_OPTION-}
desrosj marked this conversation as resolved.
Show resolved Hide resolved

healthcheck:
test: [ "CMD-SHELL", "if [ \"$LOCAL_DB_TYPE\" = \"mariadb\" ]; then mariadb-admin ping -h localhost; else mysqladmin ping -h localhost; fi" ]
Expand Down
20 changes: 20 additions & 0 deletions tools/local-env/mysql-old-php.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
##
# The local Docker environment will try to use the database software's default authentication plugin whenever possible.
#
# One exception to this is using PHP 7.2 & 7.3 in combination with MySQL >= 8.0. These versions of PHP lack support for
# MySQL's caching_sha2_password plugin, which was made the new default in MySQL 8.0.
#
# Until MySQL 8.4, this could easily be changed using the --default-authentication-plugin with the old value of
# mysql_native_password.
#
# In MySQL 8.4, the --default-authentication-plugin option was removed in favor of --authentication-policy and
# mysql_native_password was disabled by default.
#
# When mounted to the database container in the local Docker environment, this file turns the old authentication plugin
# back on so that PHP 7.2 & 7.3 can be used in combination with MySQL 8.4.
#
# MySQL 9.0 will remove mysql_native_password.
##

[mysqld]
mysql-native-password=ON
5 changes: 4 additions & 1 deletion tools/local-env/scripts/docker.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
const dotenv = require( 'dotenv' );
const dotenvExpand = require( 'dotenv-expand' );
const { execSync } = require( 'child_process' );
const local_env_utils = require( './utils' );

dotenvExpand.expand( dotenv.config() );

local_env_utils.determine_compose_files();

// Execute any docker compose command passed to this script.
execSync( 'docker compose ' + process.argv.slice( 2 ).join( ' ' ), { stdio: 'inherit' } );
execSync( 'docker compose ' + process.env.LOCAL_COMPOSE_FILE + ' ' + process.argv.slice( 2 ).join( ' ' ), { stdio: 'inherit' } );
12 changes: 9 additions & 3 deletions tools/local-env/scripts/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@ const dotenvExpand = require( 'dotenv-expand' );
const wait_on = require( 'wait-on' );
const { execSync } = require( 'child_process' );
const { renameSync, readFileSync, writeFileSync } = require( 'fs' );
const { utils } = require( './utils.js' );
const local_env_utils = require( './utils' );

dotenvExpand.expand( dotenv.config() );

local_env_utils.determine_compose_files();
local_env_utils.determine_auth_option();

// Create wp-config.php.
wp_cli( 'config create --dbname=wordpress_develop --dbuser=root --dbpass=password --dbhost=mysql --path=/var/www/src --force' );

Expand All @@ -18,6 +23,7 @@ wp_cli( `config set SCRIPT_DEBUG ${process.env.LOCAL_SCRIPT_DEBUG} --raw --type=
wp_cli( `config set WP_ENVIRONMENT_TYPE ${process.env.LOCAL_WP_ENVIRONMENT_TYPE} --type=constant` );
wp_cli( `config set WP_DEVELOPMENT_MODE ${process.env.LOCAL_WP_DEVELOPMENT_MODE} --type=constant` );

console.log( process.env.COMPOSE_FILE );
desrosj marked this conversation as resolved.
Show resolved Hide resolved
// Move wp-config.php to the base directory, so it doesn't get mixed up in the src or build directories.
renameSync( 'src/wp-config.php', 'wp-config.php' );

Expand Down Expand Up @@ -48,7 +54,7 @@ wait_on( { resources: [ `tcp:localhost:${process.env.LOCAL_PORT}`] } )
* @param {string} cmd The WP-CLI command to run.
*/
function wp_cli( cmd ) {
execSync( `docker compose run --rm cli ${cmd}`, { stdio: 'inherit' } );
execSync( `docker compose ${process.env.LOCAL_COMPOSE_FILE} run --rm cli ${cmd}`, { stdio: 'inherit' } );
}

/**
Expand All @@ -57,6 +63,6 @@ function wp_cli( cmd ) {
function install_wp_importer() {
const testPluginDirectory = 'tests/phpunit/data/plugins/wordpress-importer';

execSync( `docker compose exec -T php rm -rf ${testPluginDirectory}`, { stdio: 'inherit' } );
execSync( `docker compose exec -T php git clone https://github.com/WordPress/wordpress-importer.git ${testPluginDirectory} --depth=1`, { stdio: 'inherit' } );
execSync( `docker compose ${process.env.LOCAL_COMPOSE_FILE} exec -T php rm -rf ${testPluginDirectory}`, { stdio: 'inherit' } );
execSync( `docker compose ${process.env.LOCAL_COMPOSE_FILE} exec -T php git clone https://github.com/WordPress/wordpress-importer.git ${testPluginDirectory} --depth=1`, { stdio: 'inherit' } );
}
6 changes: 5 additions & 1 deletion tools/local-env/scripts/start.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
const dotenv = require( 'dotenv' );
const dotenvExpand = require( 'dotenv-expand' );
const { execSync } = require( 'child_process' );
const local_env_utils = require( './utils' );

dotenvExpand.expand( dotenv.config() );

local_env_utils.determine_compose_files();
local_env_utils.determine_auth_option();

// Check if the Docker service is running.
try {
execSync( 'docker info' );
Expand All @@ -19,7 +23,7 @@ try {
const containers = ( process.env.LOCAL_PHP_MEMCACHED === 'true' )
? 'wordpress-develop memcached'
: 'wordpress-develop';
execSync( `docker compose up -d ${containers}`, { stdio: 'inherit' } );
execSync( `docker compose ${process.env.LOCAL_COMPOSE_FILE} up -d ${containers}`, { stdio: 'inherit' } );

// If Docker Toolbox is being used, we need to manually forward LOCAL_PORT to the Docker VM.
if ( process.env.DOCKER_TOOLBOX_INSTALL_PATH ) {
Expand Down
50 changes: 50 additions & 0 deletions tools/local-env/scripts/utils.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
const local_env_utils = {

/**
* Determines which Docker compose files are required to properly configure the local environment given the
* specified PHP version, database type, and database version.
*/
determine_compose_files: function() {
process.env.LOCAL_COMPOSE_FILE = '-f docker-compose.yml';
desrosj marked this conversation as resolved.
Show resolved Hide resolved

if ( process.env.LOCAL_DB_TYPE !== 'mysql' ) {
return;
}

if ( process.env.LOCAL_PHP !== '7.2-fpm' && process.env.LOCAL_PHP !== '7.3-fpm' ) {
return;
}

// PHP 7.2/7.3 in combination with MySQL 8.4 requires additional configuration to function properly.
if ( process.env.LOCAL_DB_VERSION === '8.4' ) {
process.env.LOCAL_COMPOSE_FILE = process.env.LOCAL_COMPOSE_FILE + ' -f docker-compose.old-php-mysql-84.override.yml';
}
},

/**
* Determines the option to pass for proper authentication plugin configuration given the specified PHP version,
* database type, and database version.
*
* Unless a specific
*/
determine_auth_option: function() {
process.env.LOCAL_DB_AUTH_OPTION = '';

if ( process.env.LOCAL_DB_TYPE !== 'mysql' ) {
return;
}

if ( process.env.LOCAL_PHP !== '7.2-fpm' && process.env.LOCAL_PHP !== '7.3-fpm' ) {
return;
}

// MySQL 8.4 removed --default-authentication-plugin in favor of --authentication-policy.
if ( process.env.LOCAL_DB_VERSION === '8.4' ) {
process.env.LOCAL_DB_AUTH_OPTION = '--authentication-policy=mysql_native_password';
} else {
process.env.LOCAL_DB_AUTH_OPTION = '--default-authentication-plugin=mysql_native_password';
}
}
};

module.exports = local_env_utils;
Loading