Skip to content

Docs: Correct the WP_Block_Parser_Frame::leading_html_start type. #3

Docs: Correct the WP_Block_Parser_Frame::leading_html_start type.

Docs: Correct the WP_Block_Parser_Frame::leading_html_start type. #3

# Confirms that updating WordPress using WP-CLI works successfully.
#
# This workflow is not meant to test wordpress-develop checkouts, but rather tagged versions officially available on WordPress.org.
name: Upgrade Tests
on:
push:
branches:
- trunk
# Always test the workflow after it's updated.
paths:
- '.github/workflows/upgrade-testing.yml'
- '.github/workflows/reusable-upgrade-testing.yml'
pull_request:
# This workflow is only meant to run from trunk. Pull requests changing this file with different BASE branches should be ignored.
branches:
- trunk
# Always test the workflow when changes are suggested.
paths:
- '.github/workflows/upgrade-testing.yml'
- '.github/workflows/reusable-upgrade-testing.yml'
workflow_dispatch:
inputs:
new-version:
description: 'The version to test installing. Accepts major and minor versions, "latest", or "nightly". Major releases must not end with ".0".'
type: string
default: 'latest'
# Cancels all previous workflow runs for pull requests that have not completed.
concurrency:
# The concurrency group contains the workflow name and the branch name for pull requests
# or the commit hash for any other events.
group: ${{ github.workflow }}-${{ inputs.new-version || github.event_name == 'pull_request' && github.head_ref || github.sha }}
cancel-in-progress: true
# Disable permissions for all available scopes by default.
# Any needed permissions should be configured at the job level.
permissions: {}
# Because the number of jobs spawned can quickly balloon out of control, the following methodology is applied when
# building out the matrix below:
#
# - The two most recent releases of WordPress are tested against all PHP/MySQL LTS version combinations and the
# most recent innovation release.
# - The next 6 oldest versions of WordPress are tested against both the oldest and newest releases of PHP currently
# supported for both PHP 7 & 8 along with the oldest and newest MySQL LTS versions currently supported (no innovation
# releases). At the current 3 releases per year pace, this accounts for 2 additional years worth of releases.
# - Of the remaining versions of WordPress still receiving security updates, only test the ones where the database
# version was updated since the previous major release.
# - The oldest version of WordPress receiving security updates should always be tested against the same combinations as
# detailed for the two most recent releases.
# Notes about chosen MySQL versions:
# - Only the most recent innovation release should be included in testing.
# - Even though MySQL >= 5.5.5 is currently supported, there are no 5.5.x Docker containers available that work on
# modern architectures.
# - 5.6.x Docker containers are available and work, but 5.6 only accounts for ~2.3% of installs as of 12/6/2024.defaults:
# - 5.7.x accounts for ~20% of installs, so this is used below instead.
jobs:
# Builds the list of starting versions for each matrix below. Drops every version that is not older than the target
# version, because upgrading from one of those is a downgrade. A job whose list ends up empty is skipped.
#
# A major target (6.4 or 6.4.0) drops its own branch, because no upgrade would occur.
#
# A minor target (6.4.4) keeps its own branch, because 6.4 to 6.4.4 is a real upgrade. The called workflow runs
# `wp core update --minor` before the final upgrade step, so the minor update performs that upgrade and the final
# upgrade step is a no-op. When the target is not the newest release on its branch, the minor update overshoots
# the target and the target is never installed.
#
# "latest" and "nightly" drop nothing. Any other unrecognized target is treated the same way, with a warning.
build-test-matrix:
name: Build Test Matrix
runs-on: ubuntu-24.04
permissions: {}
if: ${{ github.repository == 'WordPress/wordpress-develop' }}
timeout-minutes: 5
outputs:
recent-releases: ${{ steps.versions.outputs.recent-releases }}
wp-6x: ${{ steps.versions.outputs.wp-6x }}
wp-5x-php-7x: ${{ steps.versions.outputs.wp-5x-php-7x }}
wp-5x-php-8x: ${{ steps.versions.outputs.wp-5x-php-8x }}
oldest-wp: ${{ steps.versions.outputs.oldest-wp }}
steps:
- name: Drop the versions that are not older than the version being tested
id: versions
env:
NEW_VERSION: ${{ inputs.new-version && inputs.new-version || 'latest' }}
# The versions each job below starts from. See the comment on the job for why those versions are tested.
RECENT_RELEASES: '7.0 7.1' # upgrade-tests-recent-releases
WP_6X: '6.0 6.3 6.4 6.5' # upgrade-tests-wp-6x-mysql
WP_5X_PHP_7X: '5.0 5.1 5.3 5.4 5.5 5.6 5.9' # upgrade-tests-wp-5x-php-7x-mysql
WP_5X_PHP_8X: '5.3 5.4 5.5 5.6 5.9' # upgrade-tests-wp-5x-php-8x-mysql
OLDEST_WP: '4.7' # upgrade-tests-oldest-wp-mysql
run: |
# Branches are compared as a single number so that 7.0 sorts above 6.9. The spacing leaves room for a
# pre-release to sort between its own branch and the one before it. The base is forced to 10 so that a
# version number with a leading zero is not read as an invalid octal value.
if [[ "$NEW_VERSION" =~ ^v?([0-9]+)\.([0-9]+)(\.([0-9]+))?$ ]]; then
target=$(( 10#${BASH_REMATCH[1]} * 10000 + 10#${BASH_REMATCH[2]} * 100 ))
# A version with no patch number, or a patch number of 0, is a major release: drop its own branch too.
if [[ -z "${BASH_REMATCH[4]}" || "${BASH_REMATCH[4]}" == "0" ]]; then
target=$(( target - 1 ))
fi
else
# Sorts above every version in the lists above, so nothing is dropped.
target=999999
if [[ "$NEW_VERSION" != 'latest' && "$NEW_VERSION" != 'nightly' ]]; then
echo "::warning::\"${NEW_VERSION}\" was not read as a version number, so every version will be tested."
fi
fi
# Writes the versions of $2 that are older than the target to the $1 output, as a JSON array.
filter() {
local kept='' wp branch
local -a versions
# Guards against a list being renamed in the environment above without updating the call below, which
# would otherwise skip the whole job in silence.
[[ -n "$2" ]] || { echo "::error::No versions are listed for the ${1} matrix."; exit 1; }
read -ra versions <<< "$2"
for wp in "${versions[@]}"; do
[[ "$wp" =~ ^([0-9]+)\.([0-9]+) ]] || continue
branch=$(( 10#${BASH_REMATCH[1]} * 10000 + 10#${BASH_REMATCH[2]} * 100 ))
# A pre-release sorts just below its own branch, so 7.1-RC2 is tested against a target of 7.1 but
# not against 7.0.1.
if [[ "$wp" == *-* ]]; then
branch=$(( branch - 1 ))
fi
if (( branch <= target )); then
kept+="\"${wp}\","
fi
done
echo "$1=[${kept%,}]" >> "$GITHUB_OUTPUT"
}
filter recent-releases "$RECENT_RELEASES"
filter wp-6x "$WP_6X"
filter wp-5x-php-7x "$WP_5X_PHP_7X"
filter wp-5x-php-8x "$WP_5X_PHP_8X"
filter oldest-wp "$OLDEST_WP"
# Tests the full list of PHP/MySQL combinations for the two most recent versions of WordPress.
upgrade-tests-recent-releases:
name: ${{ matrix.wp }} to ${{ inputs.new-version && inputs.new-version || 'latest' }}
uses: ./.github/workflows/reusable-upgrade-testing.yml
if: ${{ github.repository == 'WordPress/wordpress-develop' && needs.build-test-matrix.outputs.recent-releases != '[]' }}
needs: [ build-test-matrix ]
permissions:
contents: read
strategy:
fail-fast: false
matrix:
os: [ 'ubuntu-24.04' ]
php: [ '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.7' ]
wp: ${{ fromJSON( needs.build-test-matrix.outputs.recent-releases ) }}
multisite: [ false, true ]
with:
os: ${{ matrix.os }}
php: ${{ matrix.php }}
db-type: ${{ matrix.db-type }}
db-version: ${{ matrix.db-version }}
wp: ${{ matrix.wp }}
new-version: ${{ inputs.new-version && inputs.new-version || 'latest' }}
multisite: ${{ matrix.multisite }}
# Tests 6.x releases where the WordPress database version changed on the oldest and newest supported versions of PHP 7 & 8.
upgrade-tests-wp-6x-mysql:
name: ${{ matrix.wp }} to ${{ inputs.new-version && inputs.new-version || 'latest' }}
uses: ./.github/workflows/reusable-upgrade-testing.yml
if: ${{ github.repository == 'WordPress/wordpress-develop' && needs.build-test-matrix.outputs.wp-6x != '[]' }}
needs: [ build-test-matrix ]
permissions:
contents: read
strategy:
fail-fast: false
matrix:
os: [ 'ubuntu-24.04' ]
php: [ '7.4', '8.0', '8.4' ]
db-type: [ 'mysql' ]
db-version: [ '5.7', '8.4' ]
wp: ${{ fromJSON( needs.build-test-matrix.outputs.wp-6x ) }}
multisite: [ false, true ]
with:
os: ${{ matrix.os }}
php: ${{ matrix.php }}
db-type: ${{ matrix.db-type }}
db-version: ${{ matrix.db-version }}
wp: ${{ matrix.wp }}
new-version: ${{ inputs.new-version && inputs.new-version || 'latest' }}
multisite: ${{ matrix.multisite }}
# Tests 5.x releases where the WordPress database version changed on the only supported version of PHP 7.
upgrade-tests-wp-5x-php-7x-mysql:
name: ${{ matrix.wp }} to ${{ inputs.new-version && inputs.new-version || 'latest' }}
uses: ./.github/workflows/reusable-upgrade-testing.yml
if: ${{ github.repository == 'WordPress/wordpress-develop' && needs.build-test-matrix.outputs.wp-5x-php-7x != '[]' }}
needs: [ build-test-matrix ]
permissions:
contents: read
strategy:
fail-fast: false
matrix:
os: [ 'ubuntu-24.04' ]
php: [ '7.4' ]
db-type: [ 'mysql' ]
db-version: [ '5.7', '8.4' ]
wp: ${{ fromJSON( needs.build-test-matrix.outputs.wp-5x-php-7x ) }}
multisite: [ false, true ]
with:
os: ${{ matrix.os }}
php: ${{ matrix.php }}
db-type: ${{ matrix.db-type }}
db-version: ${{ matrix.db-version }}
wp: ${{ matrix.wp }}
new-version: ${{ inputs.new-version && inputs.new-version || 'latest' }}
multisite: ${{ matrix.multisite }}
# Tests 5.x releases where the WordPress database version changed on the oldest and newest supported versions of PHP 8.
#
# WordPress 5.0-5.2 are excluded from PHP 8+ testing because of the following fatal errors:
# - Use of __autoload().
# - 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: ./.github/workflows/reusable-upgrade-testing.yml
if: ${{ github.repository == 'WordPress/wordpress-develop' && needs.build-test-matrix.outputs.wp-5x-php-8x != '[]' }}
needs: [ build-test-matrix ]
permissions:
contents: read
strategy:
fail-fast: false
matrix:
os: [ 'ubuntu-24.04' ]
php: [ '8.0', '8.4' ]
db-type: [ 'mysql' ]
db-version: [ '5.7', '8.4' ]
wp: ${{ fromJSON( needs.build-test-matrix.outputs.wp-5x-php-8x ) }}
multisite: [ false, true ]
with:
os: ${{ matrix.os }}
php: ${{ matrix.php }}
db-type: ${{ matrix.db-type }}
db-version: ${{ matrix.db-version }}
wp: ${{ matrix.wp }}
new-version: ${{ inputs.new-version && inputs.new-version || 'latest' }}
multisite: ${{ matrix.multisite }}
# The oldest version of WordPress receiving security updates should always be tested against
# the widest possible list of PHP/MySQL combinations.
#
# WordPress 4.7 is excluded from PHP 8+ testing because of the following fatal errors:
# - Use of __autoload().
# - array/string offset with curly braces.
upgrade-tests-oldest-wp-mysql:
name: ${{ matrix.wp }} to ${{ inputs.new-version && inputs.new-version || 'latest' }}
uses: ./.github/workflows/reusable-upgrade-testing.yml
if: ${{ github.repository == 'WordPress/wordpress-develop' && needs.build-test-matrix.outputs.oldest-wp != '[]' }}
needs: [ build-test-matrix ]
permissions:
contents: read
strategy:
fail-fast: false
matrix:
os: [ 'ubuntu-24.04' ]
php: [ '7.4' ]
db-type: [ 'mysql' ]
db-version: [ '5.7', '8.0', '8.4', '9.7' ]
wp: ${{ fromJSON( needs.build-test-matrix.outputs.oldest-wp ) }}
multisite: [ false, true ]
with:
os: ${{ matrix.os }}
php: ${{ matrix.php }}
db-type: ${{ matrix.db-type }}
db-version: ${{ matrix.db-version }}
wp: ${{ matrix.wp }}
new-version: ${{ inputs.new-version && inputs.new-version || 'latest' }}
multisite: ${{ matrix.multisite }}
slack-notifications:
name: Slack Notifications
uses: ./.github/workflows/slack-notifications.yml
permissions:
actions: read
contents: read
needs: [ build-test-matrix, upgrade-tests-recent-releases, upgrade-tests-wp-6x-mysql, upgrade-tests-wp-5x-php-7x-mysql, upgrade-tests-wp-5x-php-8x-mysql, upgrade-tests-oldest-wp-mysql ]
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' }}
secrets:
SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
SLACK_GHA_CANCELLED_WEBHOOK: ${{ secrets.SLACK_GHA_CANCELLED_WEBHOOK }}
SLACK_GHA_FIXED_WEBHOOK: ${{ secrets.SLACK_GHA_FIXED_WEBHOOK }}
SLACK_GHA_FAILURE_WEBHOOK: ${{ secrets.SLACK_GHA_FAILURE_WEBHOOK }}
failed-workflow:
name: Failed workflow tasks
runs-on: ubuntu-24.04
permissions:
actions: write
needs: [ slack-notifications ]
if: |
always() &&
github.repository == 'WordPress/wordpress-develop' &&
github.event_name != 'pull_request' &&
github.run_attempt < 2 &&
(
contains( needs.*.result, 'cancelled' ) ||
contains( needs.*.result, 'failure' )
)
steps:
- name: Dispatch workflow run
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
retries: 2
retry-exempt-status-codes: 418
script: |
github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'failed-workflow.yml',
ref: 'trunk',
inputs: {
run_id: `${context.runId}`,
}
});