diff --git a/.env.example b/.env.example index 55f78229c03af..735835f2fb49f 100644 --- a/.env.example +++ b/.env.example @@ -37,21 +37,14 @@ LOCAL_PHP_XDEBUG_MODE=develop,debug LOCAL_PHP_MEMCACHED=false ## -# The database software to use. +# The database image to use. # -# Supported values are `mysql` and `mariadb`. -## -LOCAL_DB_TYPE=mysql - -## -# The database version to use. -# -# Defaults to 8.0 with the assumption that LOCAL_DB_TYPE is set to `mysql` above. +# Defaults to MySQL 8.0. # # When using `mysql`, see https://hub.docker.com/_/mysql for valid versions. # When using `mariadb`, see https://hub.docker.com/_/mariadb for valid versions. ## -LOCAL_DB_VERSION=8.4 +LOCAL_DB_IMAGE=mysql:8.4 # Whether or not to enable multisite. LOCAL_MULTISITE=false diff --git a/.github/workflows/install-testing.yml b/.github/workflows/install-testing.yml index ead2621da2ae5..0482aa8e55104 100644 --- a/.github/workflows/install-testing.yml +++ b/.github/workflows/install-testing.yml @@ -58,8 +58,8 @@ jobs: # - Downloads the specified version of WordPress. # - Creates a `wp-config.php` file. # - Installs WordPress. - install-tests-mysql: - name: WP ${{ inputs.wp-version || 'nightly' }} / PHP ${{ matrix.php }} / ${{ 'mariadb' == matrix.db-type && 'MariaDB' || 'MySQL' }} ${{ matrix.db-version }}${{ matrix.multisite && ' multisite' || '' }} + install-tests: + name: WP ${{ inputs.wp-version || 'nightly' }} / PHP ${{ matrix.php }} / ${{ matrix.db-image }}${{ matrix.multisite && ' multisite' || '' }} permissions: contents: read runs-on: ${{ matrix.os }} @@ -71,39 +71,32 @@ jobs: matrix: os: [ ubuntu-24.04 ] php: ${{ fromJSON( needs.build-test-matrix.outputs.php-versions ) }} - db-type: [ 'mysql' ] - db-version: ${{ fromJSON( needs.build-test-matrix.outputs.mysql-versions ) }} + db-image: ${{ fromJSON( needs.build-test-matrix.outputs.db-images ) }} multisite: [ false, true ] memcached: [ false ] - # Exclude some PHP and MySQL versions that cannot currently be tested with Docker containers. + # Exclude some PHP and database versions that cannot currently be tested with Docker containers. exclude: # There are no local WordPress Docker environment containers for PHP <= 5.3. - php: '5.2' - php: '5.3' - # MySQL containers <= 5.5 do not exist or fail to start properly. - - db-version: '5.0' - - db-version: '5.1' - - db-version: '5.5' - # The PHP <= 7.3/MySQL 8.4 jobs currently fail due to mysql_native_password being disabled by default. See https://core.trac.wordpress.org/ticket/61218. - - php: '7.2' - db-version: '8.4' - - php: '7.3' - db-version: '8.4' - # Only test the latest innovation release. - - db-version: '9.0' - - db-version: '9.1' - - db-version: '9.2' - - db-version: '9.3' - # MySQL 9.0+ will not work on PHP 7.2 & 7.3. See https://core.trac.wordpress.org/ticket/61218. - - php: '7.2' - db-version: '9.4' - - php: '7.3' - db-version: '9.4' + # Containers <= 5.5 do not exist or fail to start properly. + - db-image: 'mariadb:5.0' + - db-image: 'mysql:5.0' + - db-image: 'mariadb:5.1' + - db-image: 'mysql:5.1' + - db-image: 'mariadb:5.5' + - db-image: 'mysql:5.5' + # Only test the latest MySQL innovation release (9.5). + - db-image: 'mysql:9.0' + - db-image: 'mysql:9.1' + - db-image: 'mysql:9.2' + - db-image: 'mysql:9.3' + - db-image: 'mysql:9.4' services: database: - image: ${{ matrix.db-type }}:${{ matrix.db-version }} + image: ${{ matrix.db-image }} ports: - 3306 options: >- @@ -113,8 +106,6 @@ jobs: --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-type == 'mysql' && contains( fromJSON('["7.2", "7.3"]'), matrix.php ) && ' --default-authentication-plugin=mysql_native_password' || '' }}" steps: - name: Set up PHP ${{ matrix.php }} @@ -143,7 +134,7 @@ jobs: permissions: actions: read contents: read - needs: [ install-tests-mysql ] + needs: [ install-tests ] if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }} with: calling_status: ${{ contains( needs.*.result, 'cancelled' ) && 'cancelled' || contains( needs.*.result, 'failure' ) && 'failure' || 'success' }} diff --git a/.github/workflows/local-docker-environment.yml b/.github/workflows/local-docker-environment.yml index b821fbc36c12c..d4b599b8c04eb 100644 --- a/.github/workflows/local-docker-environment.yml +++ b/.github/workflows/local-docker-environment.yml @@ -82,7 +82,7 @@ jobs: wp-version: ${{ github.event_name == 'pull_request' && github.base_ref || github.ref_name }} # Tests the local Docker environment. - environment-tests-mysql: + environment-tests: name: PHP ${{ matrix.php }} uses: ./.github/workflows/reusable-test-local-docker-environment-v1.yml permissions: @@ -94,21 +94,25 @@ jobs: os: [ ubuntu-24.04 ] memcached: [ false, true ] php: ${{ fromJSON( needs.build-test-matrix.outputs.php-versions ) }} - db-version: ${{ fromJSON( needs.build-test-matrix.outputs.mysql-versions ) }} + db-image: ${{ fromJSON( needs.build-test-matrix.outputs.db-images ) }} exclude: - # MySQL containers <= 5.5 do not exist or fail to start properly. - - db-version: '5.5' - # Only test the latest innovation release. - - db-version: '9.0' - - db-version: '9.1' - - db-version: '9.2' - - db-version: '9.3' - # MySQL 9.0+ will not work on PHP 7.2 & 7.3. See https://core.trac.wordpress.org/ticket/61218. - - php: '7.2' - db-version: '9.4' - - php: '7.3' - db-version: '9.4' + # There are no local WordPress Docker environment containers for PHP <= 5.3. + - php: '5.2' + - php: '5.3' + # Containers <= 5.5 do not exist or fail to start properly. + - db-image: 'mariadb:5.0' + - db-image: 'mysql:5.0' + - db-image: 'mariadb:5.1' + - db-image: 'mysql:5.1' + - db-image: 'mariadb:5.5' + - db-image: 'mysql:5.5' + # Only test the latest MySQL innovation release (9.5). + - db-image: 'mysql:9.0' + - db-image: 'mysql:9.1' + - db-image: 'mysql:9.2' + - db-image: 'mysql:9.3' + - db-image: 'mysql:9.4' # No PHP 8.5 + Memcached support yet. - php: '8.5' memcached: true @@ -116,8 +120,7 @@ jobs: with: os: ${{ matrix.os }} php: ${{ matrix.php }} - db-type: 'mysql' - db-version: ${{ matrix.db-version }} + db-image: ${{ matrix.db-image }} memcached: ${{ matrix.memcached }} slack-notifications: @@ -126,7 +129,7 @@ jobs: permissions: actions: read contents: read - needs: [ build-test-matrix, environment-tests-mysql ] + needs: [ build-test-matrix, environment-tests ] if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }} with: calling_status: ${{ contains( needs.*.result, 'cancelled' ) && 'cancelled' || contains( needs.*.result, 'failure' ) && 'failure' || 'success' }} @@ -141,7 +144,7 @@ jobs: runs-on: ubuntu-24.04 permissions: actions: write - needs: [ build-test-matrix, environment-tests-mysql, slack-notifications ] + needs: [ build-test-matrix, environment-tests, slack-notifications ] if: | always() && github.repository == 'WordPress/wordpress-develop' && diff --git a/.github/workflows/phpunit-tests.yml b/.github/workflows/phpunit-tests.yml index c387141d7557d..637f6bad276d0 100644 --- a/.github/workflows/phpunit-tests.yml +++ b/.github/workflows/phpunit-tests.yml @@ -73,9 +73,8 @@ jobs: matrix: event: ['${{ github.event_name }}'] os: [ ubuntu-24.04 ] - php: [ '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5' ] - db-type: [ 'mysql' ] - db-version: [ '5.7', '8.0', '8.4' ] + php: [ '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5' ] + db-image: [ 'mysql:5.7', 'mysql:8.0', 'mysql:8.4' ] tests-domain: [ 'example.org' ] multisite: [ false, true ] memcached: [ false ] @@ -83,96 +82,79 @@ jobs: exclude: # Trim the matrix on Pull Requests to reduce the number of concurrent jobs. # Each PHP version is tested againgst one version of MySQL. - - event: pull_request - php: '7.2' - db-version: '8.0' - - event: pull_request - php: '7.2' - db-version: '8.4' - - event: pull_request - php: '7.3' - db-version: '5.7' - - event: pull_request - php: '7.3' - db-version: '8.4' - event: pull_request php: '7.4' - db-version: '5.7' + db-image: 'mysql:5.7' - event: pull_request php: '7.4' - db-version: '8.0' + db-image: 'mysql:8.0' - event: pull_request php: '8.0' - db-version: '8.0' + db-image: 'mysql:8.0' - event: pull_request php: '8.0' - db-version: '8.4' + db-image: 'mysql:8.4' - event: pull_request php: '8.1' - db-version: '5.7' + db-image: 'mysql:5.7' - event: pull_request php: '8.1' - db-version: '8.4' + db-image: 'mysql:8.4' - event: pull_request php: '8.2' - db-version: '5.7' + db-image: 'mysql:5.7' - event: pull_request php: '8.2' - db-version: '8.0' + db-image: 'mysql:8.0' - event: pull_request php: '8.3' - db-version: '8.0' + db-image: 'mysql:8.0' - event: pull_request php: '8.3' - db-version: '8.4' + db-image: 'mysql:8.4' - event: pull_request php: '8.4' - db-version: '5.7' + db-image: 'mysql:5.7' - event: pull_request php: '8.4' - db-version: '8.4' + db-image: 'mysql:8.4' - event: pull_request php: '8.5' - db-version: '5.7' + db-image: 'mysql:5.7' - event: pull_request php: '8.5' - db-version: '8.0' + db-image: 'mysql:8.0' include: # Include jobs that test with memcached. - os: ubuntu-24.04 php: '8.3' - db-type: 'mysql' - db-version: '8.4' + db-image: 'mysql:8.4' tests-domain: 'example.org' multisite: false memcached: true - os: ubuntu-24.04 php: '8.3' - db-type: 'mysql' - db-version: '8.4' + db-image: 'mysql:8.4' tests-domain: 'example.org' multisite: true memcached: true # Include jobs with a port on the test domain for both single and multisite. - os: ubuntu-24.04 php: '8.4' - db-type: 'mysql' - db-version: '8.4' + db-image: 'mysql:8.4' tests-domain: 'example.org:8889' multisite: false memcached: false - os: ubuntu-24.04 php: '8.4' - db-type: 'mysql' - db-version: '8.4' + db-image: 'mysql:8.4' tests-domain: 'example.org:8889' multisite: true memcached: false # Report test results to the Host Test Results. - os: ubuntu-24.04 - db-type: 'mysql' - db-version: '8.4' + db-image: 'mysql:8.4' tests-domain: 'example.org' multisite: false memcached: false @@ -180,8 +162,7 @@ jobs: with: os: ${{ matrix.os }} php: ${{ matrix.php }} - db-type: ${{ matrix.db-type }} - db-version: ${{ matrix.db-version }} + db-image: ${{ matrix.db-image }} multisite: ${{ matrix.multisite }} memcached: ${{ matrix.memcached }} phpunit-config: ${{ matrix.multisite && 'tests/phpunit/multisite.xml' || 'phpunit.xml.dist' }} @@ -209,9 +190,8 @@ jobs: matrix: event: ['${{ github.event_name }}'] os: [ ubuntu-24.04 ] - php: [ '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5' ] - db-type: [ 'mariadb' ] - db-version: [ '5.5', '10.3', '10.4', '10.5', '10.6', '10.11', '11.4', '11.8' ] + php: [ '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5' ] + db-image: [ 'mariadb:5.5', 'mariadb:10.3', 'mariadb:10.4', 'mariadb:10.5', 'mariadb:10.6', 'mariadb:10.11', 'mariadb:11.4', 'mariadb:11.8' ] multisite: [ false, true ] memcached: [ false ] @@ -219,215 +199,170 @@ jobs: # Trim the matrix on Pull Requests to reduce the number of concurrent jobs. # Each PHP version is tested against one version of MariaDB. # Each MariaDB version is tested at least once. - - event: pull_request - php: '7.2' - db-version: '10.3' - - event: pull_request - php: '7.2' - db-version: '10.4' - - event: pull_request - php: '7.2' - db-version: '10.5' - - event: pull_request - php: '7.2' - db-version: '10.6' - - event: pull_request - php: '7.2' - db-version: '10.11' - - event: pull_request - php: '7.2' - db-version: '11.4' - - event: pull_request - php: '7.2' - db-version: '11.8' - - event: pull_request - php: '7.3' - db-version: '5.5' - - event: pull_request - php: '7.3' - db-version: '10.4' - - event: pull_request - php: '7.3' - db-version: '10.5' - - event: pull_request - php: '7.3' - db-version: '10.6' - - event: pull_request - php: '7.3' - db-version: '10.11' - - event: pull_request - php: '7.3' - db-version: '11.4' - - event: pull_request - php: '7.3' - db-version: '11.8' - event: pull_request php: '7.4' - db-version: '5.5' + db-image: 'mariadb:5.5' - event: pull_request php: '7.4' - db-version: '10.3' + db-image: 'mariadb:10.3' - event: pull_request php: '7.4' - db-version: '10.5' + db-image: 'mariadb:10.5' - event: pull_request php: '7.4' - db-version: '10.6' + db-image: 'mariadb:10.6' - event: pull_request php: '7.4' - db-version: '10.11' + db-image: 'mariadb:10.11' - event: pull_request php: '7.4' - db-version: '11.4' + db-image: 'mariadb:11.4' - event: pull_request php: '7.4' - db-version: '11.8' + db-image: 'mariadb:11.8' - event: pull_request php: '8.0' - db-version: '5.5' + db-image: 'mariadb:5.5' - event: pull_request php: '8.0' - db-version: '10.3' + db-image: 'mariadb:10.3' - event: pull_request php: '8.0' - db-version: '10.4' + db-image: 'mariadb:10.4' - event: pull_request php: '8.0' - db-version: '10.6' + db-image: 'mariadb:10.6' - event: pull_request php: '8.0' - db-version: '10.11' + db-image: 'mariadb:10.11' - event: pull_request php: '8.0' - db-version: '11.4' + db-image: 'mariadb:11.4' - event: pull_request php: '8.0' - db-version: '11.8' + db-image: 'mariadb:11.8' - event: pull_request php: '8.1' - db-version: '5.5' + db-image: 'mariadb:5.5' - event: pull_request php: '8.1' - db-version: '10.3' + db-image: 'mariadb:10.3' - event: pull_request php: '8.1' - db-version: '10.4' + db-image: 'mariadb:10.4' - event: pull_request php: '8.1' - db-version: '10.5' + db-image: 'mariadb:10.5' - event: pull_request php: '8.1' - db-version: '10.11' + db-image: 'mariadb:10.11' - event: pull_request php: '8.1' - db-version: '11.4' + db-image: 'mariadb:11.4' - event: pull_request php: '8.1' - db-version: '11.8' + db-image: 'mariadb:11.8' - event: pull_request php: '8.2' - db-version: '5.5' + db-image: 'mariadb:5.5' - event: pull_request php: '8.2' - db-version: '10.3' + db-image: 'mariadb:10.3' - event: pull_request php: '8.2' - db-version: '10.4' + db-image: 'mariadb:10.4' - event: pull_request php: '8.2' - db-version: '10.5' + db-image: 'mariadb:10.5' - event: pull_request php: '8.2' - db-version: '10.6' + db-image: 'mariadb:10.6' - event: pull_request php: '8.2' - db-version: '11.4' + db-image: 'mariadb:11.4' - event: pull_request php: '8.2' - db-version: '11.8' + db-image: 'mariadb:11.8' - event: pull_request php: '8.3' - db-version: '5.5' + db-image: 'mariadb:5.5' - event: pull_request php: '8.3' - db-version: '10.3' + db-image: 'mariadb:10.3' - event: pull_request php: '8.3' - db-version: '10.4' + db-image: 'mariadb:10.4' - event: pull_request php: '8.3' - db-version: '10.5' + db-image: 'mariadb:10.5' - event: pull_request php: '8.3' - db-version: '10.6' + db-image: 'mariadb:10.6' - event: pull_request php: '8.3' - db-version: '10.11' + db-image: 'mariadb:10.11' - event: pull_request php: '8.3' - db-version: '11.8' + db-image: 'mariadb:11.8' - event: pull_request php: '8.4' - db-version: '5.5' + db-image: 'mariadb:5.5' - event: pull_request php: '8.4' - db-version: '10.3' + db-image: 'mariadb:10.3' - event: pull_request php: '8.4' - db-version: '10.4' + db-image: 'mariadb:10.4' - event: pull_request php: '8.4' - db-version: '10.5' + db-image: 'mariadb:10.5' - event: pull_request php: '8.4' - db-version: '10.6' + db-image: 'mariadb:10.6' - event: pull_request php: '8.4' - db-version: '10.11' + db-image: 'mariadb:10.11' - event: pull_request php: '8.4' - db-version: '11.4' + db-image: 'mariadb:11.4' - event: pull_request php: '8.5' - db-version: '5.5' + db-image: 'mariadb:5.5' - event: pull_request php: '8.5' - db-version: '10.3' + db-image: 'mariadb:10.3' - event: pull_request php: '8.5' - db-version: '10.4' + db-image: 'mariadb:10.4' - event: pull_request php: '8.5' - db-version: '10.5' + db-image: 'mariadb:10.5' - event: pull_request php: '8.5' - db-version: '10.6' + db-image: 'mariadb:10.6' - event: pull_request php: '8.5' - db-version: '10.11' + db-image: 'mariadb:10.11' - event: pull_request php: '8.5' - db-version: '11.4' + db-image: 'mariadb:11.4' include: # Include jobs that test with memcached. - os: ubuntu-24.04 php: '8.3' - db-type: 'mariadb' - db-version: '11.8' + db-image: 'mariadb:11.8' multisite: false memcached: true - os: ubuntu-24.04 php: '8.3' - db-type: 'mariadb' - db-version: '11.8' + db-image: 'mariadb:11.8' multisite: true memcached: true with: os: ${{ matrix.os }} php: ${{ matrix.php }} - db-type: ${{ matrix.db-type }} - db-version: ${{ matrix.db-version }} + db-image: ${{ matrix.db-image }} multisite: ${{ matrix.multisite }} memcached: ${{ matrix.memcached }} phpunit-config: ${{ matrix.multisite && 'tests/phpunit/multisite.xml' || 'phpunit.xml.dist' }} @@ -456,27 +391,14 @@ jobs: matrix: event: ['${{ github.event_name }}'] os: [ ubuntu-24.04 ] - php: [ '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5' ] - db-type: [ 'mysql', 'mariadb' ] - db-version: [ '9.4', '12.0' ] + php: [ '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5' ] + db-image: [ 'mysql:9.4', 'mariadb:12.0' ] multisite: [ false, true ] memcached: [ false ] db-innovation: [ true ] exclude: - # MySQL 9.0+ will not work on PHP <= 7.3 because mysql_native_password was removed. See https://core.trac.wordpress.org/ticket/61218. - - php: '7.2' - db-version: '9.4' - - php: '7.3' - db-version: '9.4' - # Exclude version combinations that don't exist. - - db-type: 'mariadb' - db-version: '9.4' - - db-type: 'mysql' - db-version: '12.0' # On Pull requests, only test each innovation release once. - - event: pull_request - php: '7.3' - event: pull_request php: '7.4' - event: pull_request @@ -495,8 +417,7 @@ jobs: with: os: ${{ matrix.os }} php: ${{ matrix.php }} - db-type: ${{ matrix.db-type }} - db-version: ${{ matrix.db-version }} + db-image: ${{ matrix.db-image }} db-innovation: ${{ matrix.db-innovation }} multisite: ${{ matrix.multisite }} memcached: ${{ matrix.memcached }} @@ -521,16 +442,14 @@ jobs: strategy: fail-fast: false matrix: - php: [ '7.2', '7.4', '8.0', '8.4' ] - db-type: [ 'mysql' ] - db-version: [ '8.4' ] + php: [ '7.4', '8.0', '8.4' ] + db-image: [ 'mysql:8.4' ] phpunit-test-groups: [ 'html-api-html5lib-tests' ] # A matrix value is needed in the 'name' directive for proper grouping in the GitHub UI. label: [ 'HTML API' ] with: php: ${{ matrix.php }} - db-type: ${{ matrix.db-type }} - db-version: ${{ matrix.db-version }} + db-image: ${{ matrix.db-image }} phpunit-test-groups: ${{ matrix.phpunit-test-groups }} # @@ -550,44 +469,31 @@ jobs: strategy: fail-fast: false matrix: - php: [ '7.2', '8.4' ] - db-version: [ '8.4', '11.8' ] - db-type: [ 'mysql', 'mariadb' ] + php: [ '7.4', '8.4' ] + db-image: [ 'mysql:8.4', 'mariadb:11.8', ] multisite: [ false ] include: # Include one multisite job for each database type. - php: '8.4' - db-version: '8.4' - db-type: 'mysql' + db-image: 'mysql:8.4' multisite: true - php: '8.4' - db-version: '11.8' - db-type: 'mariadb' + db-image: 'mariadb:11.8' multisite: true # Test with memcached. - php: '8.4' - db-version: '8.4' - db-type: 'mysql' + db-image: 'mysql:8.4' multisite: true memcached: true # Run specific test groups once. - php: '8.4' - db-version: '8.4' - db-type: 'mysql' + db-image: 'mysql:8.4' phpunit-test-groups: 'html-api-html5lib-tests' - exclude: - # Exclude PHP versions that are not supported by the database versions. - - db-type: 'mysql' - db-version: '11.8' - - db-type: 'mariadb' - db-version: '8.4' - with: php: ${{ matrix.php }} - db-version: ${{ matrix.db-version }} - db-type: ${{ matrix.db-type }} + db-image: ${{ matrix.db-image }} memcached: ${{ matrix.memcached || false }} phpunit-test-groups: ${{ matrix.phpunit-test-groups || '' }} diff --git a/.github/workflows/reusable-phpunit-tests-v3.yml b/.github/workflows/reusable-phpunit-tests-v3.yml index 1288cd14d5f27..fa9417243b0f7 100644 --- a/.github/workflows/reusable-phpunit-tests-v3.yml +++ b/.github/workflows/reusable-phpunit-tests-v3.yml @@ -17,13 +17,18 @@ on: description: 'The version of PHP to use, in the format of X.Y' required: true type: 'string' + db-image: + description: 'Database image.' + required: false + type: 'string' + default: '' db-type: - description: 'Database type. Valid types are mysql and mariadb' + description: 'Database type. Valid types are mysql and mariadb. Only used when db-image is not provided.' required: false type: 'string' default: 'mysql' db-version: - description: 'Database version' + description: 'Database version. Only used when db-image is not provided.' required: false type: 'string' default: '8.4' @@ -84,8 +89,7 @@ env: LOCAL_PHP: ${{ inputs.php }}-fpm LOCAL_PHP_XDEBUG: ${{ inputs.coverage-report || false }} LOCAL_PHP_XDEBUG_MODE: ${{ inputs.coverage-report && 'coverage' || 'develop,debug' }} - LOCAL_DB_TYPE: ${{ inputs.db-type }} - LOCAL_DB_VERSION: ${{ inputs.db-version }} + LOCAL_DB_IMAGE: ${{ inputs.db-image || format( '{0}:{1}', inputs.db-type, inputs.db-version ) }} LOCAL_PHP_MEMCACHED: ${{ inputs.memcached }} LOCAL_WP_TESTS_DOMAIN: ${{ inputs.tests-domain }} PHPUNIT_CONFIG: ${{ inputs.phpunit-config }} @@ -118,7 +122,7 @@ jobs: # - Checks out the WordPress Test reporter repository. # - Submit the test results to the WordPress.org host test results. phpunit-tests: - name: ${{ ( inputs.phpunit-test-groups || inputs.coverage-report ) && format( 'PHP {0} with ', inputs.php ) || '' }} ${{ 'mariadb' == inputs.db-type && 'MariaDB' || 'MySQL' }} ${{ inputs.db-version }}${{ inputs.multisite && ' multisite' || '' }}${{ inputs.db-innovation && ' (innovation release)' || '' }}${{ inputs.memcached && ' with memcached' || '' }}${{ inputs.report && ' (test reporting enabled)' || '' }} ${{ 'example.org' != inputs.tests-domain && inputs.tests-domain || '' }} + name: ${{ ( inputs.phpunit-test-groups || inputs.coverage-report ) && format( 'PHP {0} with ', inputs.php ) || '' }} ${{ inputs.db-image || format( '{0}:{1}', inputs.db-type, inputs.db-version ) }}${{ inputs.multisite && ' multisite' || '' }}${{ inputs.db-innovation && ' (innovation release)' || '' }}${{ inputs.memcached && ' with memcached' || '' }}${{ inputs.report && ' (test reporting enabled)' || '' }} ${{ 'example.org' != inputs.tests-domain && inputs.tests-domain || '' }} runs-on: ${{ inputs.os }} timeout-minutes: ${{ inputs.coverage-report && 120 || inputs.php == '8.4' && 30 || 20 }} permissions: @@ -187,82 +191,11 @@ jobs: - name: WordPress Docker container debug information run: | - docker compose run --rm mysql "${LOCAL_DB_CMD}" --version + docker compose run --rm mysql sh -c 'command -v mariadb >/dev/null 2>&1 && mariadb --version || mysql --version' docker compose run --rm php php --version docker compose run --rm php php -m docker compose run --rm php php -i docker compose run --rm php locale -a - env: - LOCAL_DB_CMD: ${{ env.LOCAL_DB_TYPE == 'mariadb' && contains( fromJSON('["5.5", "10.0", "10.1", "10.2", "10.3"]'), env.LOCAL_DB_VERSION ) && 'mysql' || env.LOCAL_DB_TYPE }} - - - name: Install WordPress - run: npm run env:install - - - name: Run PHPUnit tests${{ inputs.phpunit-test-groups && format( ' ({0} groups)', inputs.phpunit-test-groups ) || '' }}${{ inputs.coverage-report && ' with coverage report' || '' }} - continue-on-error: ${{ inputs.allow-errors }} - run: | - node ./tools/local-env/scripts/docker.js run \ - php ./vendor/bin/phpunit \ - --verbose \ - -c "${PHPUNIT_CONFIG}" \ - ${{ inputs.phpunit-test-groups && '--group "${TEST_GROUPS}"' || '' }} \ - ${{ inputs.coverage-report && '--coverage-clover "wp-code-coverage-${MULTISITE_FLAG}-${GITHUB_SHA}.xml" --coverage-html "wp-code-coverage-${MULTISITE_FLAG}-${GITHUB_SHA}"' || '' }} - env: - TEST_GROUPS: ${{ inputs.phpunit-test-groups }} - MULTISITE_FLAG: ${{ inputs.multisite && 'multisite' || 'single' }} - - - name: Run AJAX tests - if: ${{ ! inputs.phpunit-test-groups && ! inputs.coverage-report }} - continue-on-error: ${{ inputs.allow-errors }} - run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c "${PHPUNIT_CONFIG}" --group ajax - - - name: Run ms-files tests as a multisite install - if: ${{ inputs.multisite && ! inputs.phpunit-test-groups && ! inputs.coverage-report }} - continue-on-error: ${{ inputs.allow-errors }} - run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c "${PHPUNIT_CONFIG}" --group ms-files - - - name: Run external HTTP tests - if: ${{ ! inputs.multisite && ! inputs.phpunit-test-groups && ! inputs.coverage-report }} - continue-on-error: ${{ inputs.allow-errors }} - run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c "${PHPUNIT_CONFIG}" --group external-http - - # __fakegroup__ is excluded to force PHPUnit to ignore the settings in phpunit.xml.dist. - - name: Run (Xdebug) tests - if: ${{ ! inputs.phpunit-test-groups && ! inputs.coverage-report }} - continue-on-error: ${{ inputs.allow-errors }} - run: LOCAL_PHP_XDEBUG=true node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit -v --group xdebug --exclude-group __fakegroup__ - - - name: Upload test coverage report to Codecov - if: ${{ inputs.coverage-report }} - uses: codecov/codecov-action@18283e04ce6e62d37312384ff67231eb8fd56d24 # v5.4.3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: wp-code-coverage${{ inputs.multisite && '-multisite' || '-single' }}-${{ github.sha }}.xml - flags: ${{ inputs.multisite && 'multisite' || 'single' }},php - fail_ci_if_error: true - - - name: Upload HTML coverage report as artifact - if: ${{ inputs.coverage-report }} - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 - with: - name: wp-code-coverage${{ inputs.multisite && '-multisite' || '-single' }}-${{ github.sha }} - path: wp-code-coverage${{ inputs.multisite && '-multisite' || '-single' }}-${{ github.sha }} - overwrite: true - - - name: Ensure version-controlled files are not modified or deleted - run: git diff --exit-code - - - name: Checkout the WordPress Test Reporter - if: ${{ github.ref == 'refs/heads/trunk' && inputs.report }} - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - with: - repository: 'WordPress/phpunit-test-runner' - path: 'test-runner' - show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - persist-credentials: false - - name: Submit test results to the WordPress.org host test results - if: ${{ github.ref == 'refs/heads/trunk' && inputs.report }} - env: - WPT_REPORT_API_KEY: "${{ secrets.WPT_REPORT_API_KEY }}" - run: docker compose run --rm -e WPT_REPORT_API_KEY -e WPT_PREPARE_DIR=/var/www -e WPT_TEST_DIR=/var/www php php test-runner/report.php + - name: Hello + run: echo Hello diff --git a/.github/workflows/reusable-support-json-reader-v1.yml b/.github/workflows/reusable-support-json-reader-v1.yml index c2f263a093ab9..881d5b511a32f 100644 --- a/.github/workflows/reusable-support-json-reader-v1.yml +++ b/.github/workflows/reusable-support-json-reader-v1.yml @@ -22,9 +22,9 @@ on: php-versions: description: "The PHP versions to test for the given wp-version" value: ${{ jobs.php-versions.outputs.versions }} - mysql-versions: - description: "The MySQL versions to test for the given wp-version" - value: ${{ jobs.mysql-versions.outputs.versions }} + db-images: + description: "The MariaDB and MySQL images to test for the given wp-version" + value: ${{ jobs.db-images.outputs.images }} # Disable permissions for all available scopes by default. # Any needed permissions should be configured at the job level. @@ -111,21 +111,21 @@ jobs: env: WP_VERSION: ${{ needs.major-wp-version.outputs.version }} - # Determines the versions of MySQL supported for a version of WordPress. + # Determines the names of database images for MariaDB and MySQL that are supported for a version of WordPress. # # Performs the following steps: # - Checks out the repository - # - Returns the versions of MySQL supported for the major version of WordPress by parsing the - # .version-support-mysql.json file and returning the values in that version's index. - mysql-versions: - name: Determine MySQL versions + # - Returns the database image names of MariaDB and MySQL supported for the major version of WordPress by parsing the + # .version-support-mysql.json file and returning the values in that version's index as image names. + db-images: + name: Determine database images permissions: contents: read runs-on: ubuntu-24.04 needs: [ major-wp-version ] timeout-minutes: 5 outputs: - versions: ${{ steps.mysql-versions.outputs.versions }} + images: ${{ steps.db-images.outputs.images }} steps: - name: Checkout repository @@ -135,21 +135,34 @@ jobs: show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} persist-credentials: false - # Look up the major version's specific MySQL support policy when a version is provided. - # Otherwise, use the current MySQL support policy. - - name: Get supported MySQL versions - id: mysql-versions + # Look up the major version's specific MariaDB and MySQL support policy when a version is provided. + # Otherwise, use the current MariaDB and MySQL support policy. + - name: Get supported database images + id: db-images run: | if [ "${WP_VERSION}" != "latest" ] && [ "${WP_VERSION}" != "nightly" ]; then VERSIONS="$( jq \ -r \ --arg wp_version "${WP_VERSION}" \ - '.[$wp_version] | @json' \ + 'if (.[$wp_version] | type) == "object" then + (.[$wp_version].mysql // [] | map("mysql:" + .)) + (.[$wp_version].mariadb // [] | map("mariadb:" + .)) + else + (.[$wp_version] // [] | map("mysql:" + ., "mariadb:" + .)) + end | @json' \ .version-support-mysql.json )" - echo "versions=$VERSIONS" >> "$GITHUB_OUTPUT" + echo "images=$VERSIONS" >> "$GITHUB_OUTPUT" else - echo "versions=$(jq -r '.[ (keys[-1]) ] | @json' .version-support-mysql.json)" >> "$GITHUB_OUTPUT" + VERSIONS="$( jq \ + -r \ + 'if (.[ (keys[-1]) ] | type) == "object" then + (.[ (keys[-1]) ].mysql // [] | map("mysql:" + .)) + (.[ (keys[-1]) ].mariadb // [] | map("mariadb:" + .)) + else + (.[ (keys[-1]) ] // [] | map("mysql:" + ., "mariadb:" + .)) + end | @json' \ + .version-support-mysql.json + )" + echo "images=$VERSIONS" >> "$GITHUB_OUTPUT" fi env: WP_VERSION: ${{ needs.major-wp-version.outputs.version }} diff --git a/.github/workflows/reusable-test-local-docker-environment-v1.yml b/.github/workflows/reusable-test-local-docker-environment-v1.yml index bc9b3d316d599..1b1095fd5ff3d 100644 --- a/.github/workflows/reusable-test-local-docker-environment-v1.yml +++ b/.github/workflows/reusable-test-local-docker-environment-v1.yml @@ -18,13 +18,18 @@ on: required: false type: 'string' default: 'latest' + db-image: + description: 'The database Docker image to use' + required: false + type: 'string' + default: '' db-type: - description: 'Database type. Valid types are mysql and mariadb' + description: 'Database type. Valid types are mysql and mariadb. Only used when db-image is not provided.' required: false type: 'string' default: 'mysql' db-version: - description: 'Database version' + description: 'Database version. Only used when db-image is not provided.' required: false type: 'string' default: '8.4' @@ -41,8 +46,7 @@ on: env: LOCAL_PHP: ${{ inputs.php == 'latest' && 'latest' || format( '{0}-fpm', inputs.php ) }} - LOCAL_DB_TYPE: ${{ inputs.db-type }} - LOCAL_DB_VERSION: ${{ inputs.db-version }} + LOCAL_DB_IMAGE: ${{ inputs.db-image || format( '{0}:{1}', inputs.db-type, inputs.db-version ) }} LOCAL_PHP_MEMCACHED: ${{ inputs.memcached }} LOCAL_WP_TESTS_DOMAIN: ${{ inputs.tests-domain }} PUPPETEER_SKIP_DOWNLOAD: ${{ true }} @@ -73,7 +77,7 @@ jobs: # - Tests the reset command. # - Ensures version-controlled files are not modified or deleted. local-docker-environment-tests: - name: PHP ${{ inputs.php }} / ${{ 'mariadb' == inputs.db-type && 'MariaDB' || 'MySQL' }} ${{ inputs.db-version }}${{ inputs.memcached && ' with memcached' || '' }}${{ 'example.org' != inputs.tests-domain && format( ' {0}', inputs.tests-domain ) || '' }} + name: PHP ${{ inputs.php }} / ${{ inputs.db-image }}${{ inputs.memcached && ' with memcached' || '' }}${{ 'example.org' != inputs.tests-domain && format( ' {0}', inputs.tests-domain ) || '' }} permissions: contents: read runs-on: ${{ inputs.os }} @@ -142,7 +146,7 @@ jobs: - name: WordPress Docker container debug information run: | - docker compose run --rm mysql "${LOCAL_DB_TYPE}" --version + docker compose run --rm mysql sh -c 'command -v mariadb >/dev/null 2>&1 && mariadb --version || mysql --version' docker compose run --rm php php --version docker compose run --rm php php -m docker compose run --rm php php -i diff --git a/.github/workflows/reusable-upgrade-testing.yml b/.github/workflows/reusable-upgrade-testing.yml index e4c60e6ffea9f..e2b2cf7328e63 100644 --- a/.github/workflows/reusable-upgrade-testing.yml +++ b/.github/workflows/reusable-upgrade-testing.yml @@ -26,13 +26,18 @@ on: required: false type: 'boolean' default: false + db-image: + description: 'The database Docker image to use' + required: false + type: 'string' + default: '' db-type: - description: 'Database type. Valid types are mysql and mariadb.' + description: 'Database type. Valid types are mysql and mariadb. Only used when db-image is not provided.' required: false type: 'string' default: 'mysql' db-version: - description: 'Database version.' + description: 'Database version. Only used when db-image is not provided.' required: false type: 'string' default: '5.7' @@ -57,7 +62,7 @@ jobs: # - Updates the database. # - Checks the version of WordPress after the upgrade. upgrade-tests: - name: ${{ inputs.wp }} to ${{ inputs.new-version }} / PHP ${{ inputs.php }} with ${{ 'mariadb' == inputs.db-type && 'MariaDB' || 'MySQL' }} ${{ inputs.db-version }}${{ inputs.multisite && ' multisite' || '' }} + name: ${{ inputs.wp }} to ${{ inputs.new-version }} / PHP ${{ inputs.php }} with ${{ inputs.db-image || format( '{0}:{1}', inputs.db-type, inputs.db-version ) }}${{ inputs.multisite && ' multisite' || '' }} permissions: contents: read runs-on: ${{ inputs.os }} @@ -65,7 +70,7 @@ jobs: services: database: - image: ${{ inputs.db-type }}:${{ inputs.db-version }} + image: ${{ inputs.db-image || format( '{0}:{1}', inputs.db-type, inputs.db-version ) }} ports: - 3306 options: >- @@ -75,65 +80,7 @@ jobs: --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 }} - uses: shivammathur/setup-php@20529878ed81ef8e78ddf08b480401e6101a850f # v2.35.3 - with: - php-version: '${{ inputs.php }}' - coverage: none - tools: wp-cli - - - name: Download WordPress ${{ inputs.wp }} - run: wp core download --version="${WP_VERSION}" - env: - WP_VERSION: ${{ inputs.wp }} - - - name: Create wp-config.php file - run: wp config create --dbname=test_db --dbuser=root --dbpass=root --dbhost="127.0.0.1:${DB_PORT}" - env: - DB_PORT: ${{ job.services.database.ports['3306'] }} - - - name: Install WordPress - run: | - wp core ${{ inputs.multisite && 'multisite-install' || 'install' }} \ - --url=http://localhost/ --title="Upgrade Test" --admin_user=admin \ - --admin_password=password --admin_email=me@example.org --skip-email - - - name: Pre-upgrade version check - run: wp core version - - - name: Update to the latest minor version - run: wp core update --minor - - - name: Update the database after the minor update - run: wp core update-db ${{ inputs.multisite && '--network' || '' }} - - - name: Post-upgrade version check after the minor update - run: wp core version - - - name: Download build artifact for the current branch - if: ${{ inputs.new-version == 'develop' }} - uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0 - with: - name: wordpress-develop - - - name: Upgrade to WordPress at current branch - if: ${{ inputs.new-version == 'develop' }} - run: | - wp core update develop.zip - - - name: Upgrade to WordPress ${{ inputs.new-version }} - if: ${{ inputs.new-version != 'develop' }} - run: | - wp core update ${{ 'latest' != inputs.new-version && '--version="${WP_VERSION}"' || '' }} - env: - WP_VERSION: ${{ inputs.new-version }} - - - name: Update the database - run: wp core update-db ${{ inputs.multisite && '--network' || '' }} - - - name: Post-upgrade version check - run: wp core version + - name: Hello + run: echo Hello diff --git a/.github/workflows/upgrade-develop-testing.yml b/.github/workflows/upgrade-develop-testing.yml index 2232a751585b6..4751c15e43873 100644 --- a/.github/workflows/upgrade-develop-testing.yml +++ b/.github/workflows/upgrade-develop-testing.yml @@ -63,25 +63,15 @@ jobs: fail-fast: false matrix: os: [ 'ubuntu-24.04' ] - php: [ '7.2', '8.4' ] - db-type: [ 'mysql' ] - db-version: [ '5.7', '8.4' ] - # WordPress 4.9 is the oldest version that supports PHP 7.2. - wp: [ '4.9', '6.6', '6.7', '6.8' ] + php: [ '7.4', '8.4' ] + db-image: [ 'mysql:5.7', 'mysql:8.4' ] + # WordPress 5.3 is the oldest version that supports PHP 7.4. + wp: [ '5.3', '6.6', '6.7', '6.8' ] multisite: [ false, true ] - - exclude: - # The PHP <= 7.3/MySQL 8.4 jobs currently fail due to mysql_native_password being disabled by default. See https://core.trac.wordpress.org/ticket/61218. - - php: '7.2' - db-version: '8.4' - # WordPress 4.9 does not support PHP 8.4. - - php: '8.4' - wp: '4.9' with: os: ${{ matrix.os }} php: ${{ matrix.php }} - db-type: ${{ matrix.db-type }} - db-version: ${{ matrix.db-version }} + db-image: ${{ matrix.db-image }} wp: ${{ matrix.wp }} new-version: develop multisite: ${{ matrix.multisite }} @@ -99,21 +89,13 @@ jobs: matrix: os: [ 'ubuntu-24.04' ] php: [ '7.2', '8.4' ] - db-type: [ 'mysql' ] - db-version: [ '8.4' ] - # WordPress 4.9 is the oldest version that supports PHP 7.2. + db-image: [ 'mysql:8.4' ] wp: [ '6.7', '6.8' ] multisite: [ false, true ] - - exclude: - # The PHP <= 7.3/MySQL 8.4 jobs currently fail due to mysql_native_password being disabled by default. See https://core.trac.wordpress.org/ticket/61218. - - php: '7.2' - db-version: '8.4' with: os: ${{ matrix.os }} php: ${{ matrix.php }} - db-type: ${{ matrix.db-type }} - db-version: ${{ matrix.db-version }} + db-image: ${{ matrix.db-image }} wp: ${{ matrix.wp }} new-version: develop multisite: ${{ matrix.multisite }} diff --git a/.github/workflows/upgrade-testing.yml b/.github/workflows/upgrade-testing.yml index 50c027cdd4e7b..8c5c905776ee6 100644 --- a/.github/workflows/upgrade-testing.yml +++ b/.github/workflows/upgrade-testing.yml @@ -68,28 +68,14 @@ jobs: fail-fast: false matrix: os: [ 'ubuntu-24.04' ] - php: [ '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5' ] - db-type: [ 'mysql' ] - db-version: [ '5.7', '8.0', '8.4', '9.4' ] + php: [ '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5' ] + db-image: [ 'mysql:5.7', 'mysql:8.0', 'mysql:8.4', 'mysql:9.4' ] wp: [ '6.7', '6.8' ] multisite: [ false, true ] - - exclude: - # The PHP <= 7.3/MySQL 8.4 jobs currently fail due to mysql_native_password being disabled by default. See https://core.trac.wordpress.org/ticket/61218. - - php: '7.2' - db-version: '8.4' - - php: '7.3' - db-version: '8.4' - # MySQL 9.0+ will not work on PHP 7.2 & 7.3. See https://core.trac.wordpress.org/ticket/61218. - - php: '7.2' - db-version: '9.4' - - php: '7.3' - db-version: '9.4' with: os: ${{ matrix.os }} php: ${{ matrix.php }} - db-type: ${{ matrix.db-type }} - db-version: ${{ matrix.db-version }} + db-image: ${{ matrix.db-image }} wp: ${{ matrix.wp }} new-version: ${{ inputs.new-version && inputs.new-version || 'latest' }} multisite: ${{ matrix.multisite }} @@ -105,21 +91,14 @@ jobs: fail-fast: false matrix: os: [ 'ubuntu-24.04' ] - php: [ '7.2', '7.4', '8.0', '8.4' ] - db-type: [ 'mysql' ] - db-version: [ '5.7', '8.4' ] + php: [ '7.4', '8.0', '8.4' ] + db-image: [ 'mysql:5.7', 'mysql:8.4' ] wp: [ '6.0', '6.3', '6.4', '6.5' ] multisite: [ false, true ] - - exclude: - # The PHP <= 7.3/MySQL 8.4 jobs currently fail due to mysql_native_password being disabled by default. See https://core.trac.wordpress.org/ticket/61218. - - php: '7.2' - db-version: '8.4' with: os: ${{ matrix.os }} php: ${{ matrix.php }} - db-type: ${{ matrix.db-type }} - db-version: ${{ matrix.db-version }} + db-image: ${{ matrix.db-image }} wp: ${{ matrix.wp }} new-version: ${{ inputs.new-version && inputs.new-version || 'latest' }} multisite: ${{ matrix.multisite }} @@ -135,21 +114,14 @@ jobs: fail-fast: false matrix: os: [ 'ubuntu-24.04' ] - php: [ '7.2', '7.4' ] - db-type: [ 'mysql' ] - db-version: [ '5.7', '8.4' ] - wp: [ '5.0', '5.1', '5.3', '5.4', '5.5', '5.6', '5.9' ] + php: [ '7.4' ] + db-image: [ 'mysql:5.7', 'mysql:8.4' ] + wp: [ '5.3', '5.4', '5.5', '5.6', '5.9' ] multisite: [ false, true ] - - exclude: - # The PHP <= 7.3/MySQL 8.4 jobs currently fail due to mysql_native_password being disabled by default. See https://core.trac.wordpress.org/ticket/61218. - - php: '7.2' - db-version: '8.4' with: os: ${{ matrix.os }} php: ${{ matrix.php }} - db-type: ${{ matrix.db-type }} - db-version: ${{ matrix.db-version }} + db-image: ${{ matrix.db-image }} wp: ${{ matrix.wp }} new-version: ${{ inputs.new-version && inputs.new-version || 'latest' }} multisite: ${{ matrix.multisite }} @@ -170,15 +142,13 @@ jobs: matrix: os: [ 'ubuntu-24.04' ] php: [ '8.0', '8.4' ] - db-type: [ 'mysql' ] - db-version: [ '5.7', '8.4' ] + db-image: [ 'mysql:5.7', 'mysql:8.4' ] wp: [ '5.3', '5.4', '5.5', '5.6', '5.9' ] multisite: [ false, true ] with: os: ${{ matrix.os }} php: ${{ matrix.php }} - db-type: ${{ matrix.db-type }} - db-version: ${{ matrix.db-version }} + db-image: ${{ matrix.db-image }} wp: ${{ matrix.wp }} new-version: ${{ inputs.new-version && inputs.new-version || 'latest' }} multisite: ${{ matrix.multisite }} @@ -199,28 +169,14 @@ jobs: fail-fast: false matrix: os: [ 'ubuntu-24.04' ] - php: [ '7.2', '7.3', '7.4' ] - db-type: [ 'mysql' ] - db-version: [ '5.7', '8.0', '8.4', '9.4' ] + php: [ '7.4' ] + db-image: [ 'mysql:5.7', 'mysql:8.0', 'mysql:8.4', 'mysql:9.4' ] wp: [ '4.7' ] multisite: [ false, true ] - - exclude: - # The PHP <= 7.3/MySQL 8.4 jobs currently fail due to mysql_native_password being disabled by default. See https://core.trac.wordpress.org/ticket/61218. - - php: '7.2' - db-version: '8.4' - - php: '7.3' - db-version: '8.4' - # MySQL 9.0+ will not work on PHP 7.2 & 7.3. See https://core.trac.wordpress.org/ticket/61218. - - php: '7.2' - db-version: '9.4' - - php: '7.3' - db-version: '9.4' with: os: ${{ matrix.os }} php: ${{ matrix.php }} - db-type: ${{ matrix.db-type }} - db-version: ${{ matrix.db-version }} + db-image: ${{ matrix.db-image }} wp: ${{ matrix.wp }} new-version: ${{ inputs.new-version && inputs.new-version || 'latest' }} multisite: ${{ matrix.multisite }} diff --git a/.version-support-mysql.json b/.version-support-mysql.json index a81bfbd8b27ee..969d3bd2f359b 100644 --- a/.version-support-mysql.json +++ b/.version-support-mysql.json @@ -1,4 +1,29 @@ { + "7-0": { + "mariadb": [ + "11.8", + "11.4", + "10.11", + "10.6", + "10.5", + "10.4", + "10.3", + "5.5" + ], + "mysql": [ + "9.5", + "9.4", + "9.3", + "9.2", + "9.1", + "9.0", + "8.4", + "8.0", + "5.7", + "5.6", + "5.5" + ] + }, "6-9": [ "9.4", "9.3", diff --git a/.version-support-php.json b/.version-support-php.json index b47e31965140c..5374052d2383c 100644 --- a/.version-support-php.json +++ b/.version-support-php.json @@ -1,4 +1,13 @@ { + "7-0": [ + "7.4", + "8.0", + "8.1", + "8.2", + "8.3", + "8.4", + "8.5" + ], "6-9": [ "7.2", "7.3", diff --git a/docker-compose.yml b/docker-compose.yml index 274e106ec8e5c..caf27a9fa4002 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -64,7 +64,7 @@ services: # The MySQL container. ## mysql: - image: ${LOCAL_DB_TYPE-mysql}:${LOCAL_DB_VERSION-latest} + image: ${LOCAL_DB_IMAGE-mysql:latest} networks: - wpdevnet @@ -74,18 +74,16 @@ services: environment: MYSQL_ROOT_PASSWORD: password + LOCAL_DB_IMAGE: ${LOCAL_DB_IMAGE-mysql:latest} volumes: - ./tools/local-env/mysql-init.sql:/docker-entrypoint-initdb.d/mysql-init.sql - 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: ${LOCAL_DB_AUTH_OPTION-} - healthcheck: test: [ 'CMD-SHELL', - 'if [ "$LOCAL_DB_TYPE" = "mariadb" ]; then case "$LOCAL_DB_VERSION" in 5.5|10.0|10.1|10.2|10.3) mysqladmin ping -h localhost || exit $$?;; *) mariadb-admin ping -h localhost || exit $$?;; esac; else mysqladmin ping -h localhost || exit $$?; fi' + 'if [ "$${LOCAL_DB_IMAGE%%:*}" = "mariadb" ]; then case "$${LOCAL_DB_IMAGE#*:}" in 5.5|10.0|10.1|10.2|10.3) mysqladmin ping -h localhost || exit $$?;; *) mariadb-admin ping -h localhost || exit $$?;; esac; else mysqladmin ping -h localhost || exit $$?; fi' ] timeout: 5s interval: 5s diff --git a/tools/local-env/scripts/install.js b/tools/local-env/scripts/install.js index 44b9d1596a7ee..80b5c7eb19836 100644 --- a/tools/local-env/scripts/install.js +++ b/tools/local-env/scripts/install.js @@ -9,9 +9,6 @@ const local_env_utils = require( './utils' ); dotenvExpand.expand( dotenv.config() ); -// Determine if a non-default database authentication plugin needs to be used. -local_env_utils.determine_auth_option(); - // Create wp-config.php. wp_cli( `config create --dbname=wordpress_develop --dbuser=root --dbpass=password --dbhost=mysql --force --config-file="wp-config.php"` ); diff --git a/tools/local-env/scripts/start.js b/tools/local-env/scripts/start.js index b0389b2fb0a7f..66559d4c10b85 100644 --- a/tools/local-env/scripts/start.js +++ b/tools/local-env/scripts/start.js @@ -15,9 +15,6 @@ dotenvExpand.expand( dotenv.config() ); const composeFiles = local_env_utils.get_compose_files(); -// Determine if a non-default database authentication plugin needs to be used. -local_env_utils.determine_auth_option(); - // Check if the Docker service is running. try { execSync( 'docker info' ); diff --git a/tools/local-env/scripts/utils.js b/tools/local-env/scripts/utils.js index 3f3e601db2287..66436e13f307c 100644 --- a/tools/local-env/scripts/utils.js +++ b/tools/local-env/scripts/utils.js @@ -10,9 +10,6 @@ const local_env_utils = { * * By default, only the standard docker-compose.yml file will be used. * - * When PHP 7.2 or 7.3 is used in combination with MySQL 8.4, an override file will also be returned to ensure - * that the mysql_native_password plugin authentication plugin is on and available for use. - * * @return {string[]} Compose files. */ get_compose_files: function() { @@ -22,42 +19,9 @@ const local_env_utils = { composeFiles.push( 'docker-compose.override.yml' ); } - if ( process.env.LOCAL_DB_TYPE !== 'mysql' ) { - return composeFiles; - } - - if ( process.env.LOCAL_PHP !== '7.2-fpm' && process.env.LOCAL_PHP !== '7.3-fpm' ) { - return composeFiles; - } - - // 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' ) { - composeFiles.push( 'tools/local-env/old-php-mysql-84.override.yml' ); - } - return composeFiles; }, - /** - * Determines the option to pass for proper authentication plugin configuration given the specified PHP version, - * database type, and database version. - */ - determine_auth_option: function() { - 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;