@@ -102,12 +102,19 @@ jobs:
102102 with :
103103 wp-version : ${{ inputs.new-version }}
104104
105- # Determines the list of WordPress versions to upgrade from when testing an older branch.
105+ # Determines the lists of WordPress versions to upgrade from when testing an older branch.
106106 #
107- # Generates a JSON array of all branches from OLDEST_SECURITY_BRANCH up to, but not
108- # including, the target branch. For example, when the target is 5.0, this produces
109- # ["4.7", "4.8", "4.9"]. WordPress branches are versioned as X.Y, where Y increments
110- # from 0 to 9 before X increments and Y resets to 0.
107+ # Produces two lists:
108+ # - recent-from-versions: the preceding branch and the target branch itself. These are tested
109+ # against the full PHP and database version matrix.
110+ # - older-from-versions: all branches from OLDEST_SECURITY_BRANCH up to, but not including,
111+ # the preceding branch. These are tested against a reduced PHP matrix.
112+ #
113+ # Also computes reduced-php-versions from the target branch's supported PHP versions, keeping
114+ # only the oldest and newest version of each major (e.g. 7.0 and 7.4 from a 7.x range).
115+ #
116+ # WordPress branches are versioned as X.Y, where Y increments from 0 to 9 before X
117+ # increments and Y resets to 0.
111118 #
112119 # Only runs when testing an older branch.
113120 determine-from-versions :
@@ -116,14 +123,17 @@ jobs:
116123 timeout-minutes : 5
117124 needs : [ determine-workflow-type, build-test-matrix ]
118125 outputs :
119- from-versions : ${{ steps.from-versions.outputs.from-versions }}
126+ recent-from-versions : ${{ steps.from-versions.outputs.recent-from-versions }}
127+ older-from-versions : ${{ steps.from-versions.outputs.older-from-versions }}
128+ reduced-php-versions : ${{ steps.from-versions.outputs.reduced-php-versions }}
120129
121130 steps :
122131 - name : Determine the FROM WordPress versions
123132 id : from-versions
124133 env :
125134 OLDEST_SECURITY_BRANCH : ${{ env.OLDEST_SECURITY_BRANCH }}
126135 MAJOR_WP_VERSION : ${{ needs.build-test-matrix.outputs.major-wp-version }}
136+ PHP_VERSIONS : ${{ needs.build-test-matrix.outputs.php-versions }}
127137 run : |
128138 OLDEST_MAJOR=$(echo "$OLDEST_SECURITY_BRANCH" | cut -d'.' -f1)
129139 OLDEST_MINOR=$(echo "$OLDEST_SECURITY_BRANCH" | cut -d'.' -f2)
@@ -133,22 +143,47 @@ jobs:
133143 TARGET_MAJOR=$(echo "$TARGET" | cut -d'.' -f1)
134144 TARGET_MINOR=$(echo "$TARGET" | cut -d'.' -f2)
135145
136- # Build a JSON array of all branches from OLDEST_SECURITY_BRANCH up to, but not
137- # including, the target branch. Y increments 0–9, then X increments and Y resets to 0.
138- VERSIONS=""
146+ # Determine the branch immediately preceding the target.
147+ # Y decrements, rolling over from 0 to 9 and decrementing X.
148+ if [ "$TARGET_MINOR" -eq 0 ]; then
149+ PREV_MAJOR=$((TARGET_MAJOR - 1))
150+ PREV_MINOR=9
151+ else
152+ PREV_MAJOR=$TARGET_MAJOR
153+ PREV_MINOR=$((TARGET_MINOR - 1))
154+ fi
155+
156+ # Clamp the preceding branch to OLDEST_SECURITY_BRANCH.
157+ if [ "$PREV_MAJOR" -lt "$OLDEST_MAJOR" ] || \
158+ { [ "$PREV_MAJOR" -eq "$OLDEST_MAJOR" ] && [ "$PREV_MINOR" -lt "$OLDEST_MINOR" ]; }; then
159+ PREV_MAJOR=$OLDEST_MAJOR
160+ PREV_MINOR=$OLDEST_MINOR
161+ fi
162+
163+ # "recent" FROM versions: the preceding branch and the target branch. These are tested
164+ # against the full PHP and database version matrix.
165+ RECENT_VERSIONS="\"${PREV_MAJOR}.${PREV_MINOR}\""
166+ if [ "$PREV_MAJOR" != "$TARGET_MAJOR" ] || [ "$PREV_MINOR" != "$TARGET_MINOR" ]; then
167+ RECENT_VERSIONS="${RECENT_VERSIONS},\"${TARGET_MAJOR}.${TARGET_MINOR}\""
168+ fi
169+ echo "recent-from-versions=[${RECENT_VERSIONS}]" >> "$GITHUB_OUTPUT"
170+
171+ # "older" FROM versions: all branches from OLDEST_SECURITY_BRANCH up to, but not
172+ # including, the preceding branch. Y increments 0–9, then X increments and Y resets to 0.
173+ OLDER_VERSIONS=""
139174 CURRENT_MAJOR=$OLDEST_MAJOR
140175 CURRENT_MINOR=$OLDEST_MINOR
141176
142177 while true; do
143- if [ "$CURRENT_MAJOR" -gt "$TARGET_MAJOR " ] || \
144- { [ "$CURRENT_MAJOR" -eq "$TARGET_MAJOR " ] && [ "$CURRENT_MINOR" -ge "$TARGET_MINOR " ]; }; then
178+ if [ "$CURRENT_MAJOR" -gt "$PREV_MAJOR " ] || \
179+ { [ "$CURRENT_MAJOR" -eq "$PREV_MAJOR " ] && [ "$CURRENT_MINOR" -ge "$PREV_MINOR " ]; }; then
145180 break
146181 fi
147182
148- if [ -n "$VERSIONS " ]; then
149- VERSIONS ="${VERSIONS },"
183+ if [ -n "$OLDER_VERSIONS " ]; then
184+ OLDER_VERSIONS ="${OLDER_VERSIONS },"
150185 fi
151- VERSIONS ="${VERSIONS }\"${CURRENT_MAJOR}.${CURRENT_MINOR}\""
186+ OLDER_VERSIONS ="${OLDER_VERSIONS }\"${CURRENT_MAJOR}.${CURRENT_MINOR}\""
152187
153188 if [ "$CURRENT_MINOR" -eq 9 ]; then
154189 CURRENT_MAJOR=$((CURRENT_MAJOR + 1))
@@ -158,7 +193,35 @@ jobs:
158193 fi
159194 done
160195
161- echo "from-versions=[${VERSIONS}]" >> "$GITHUB_OUTPUT"
196+ echo "older-from-versions=[${OLDER_VERSIONS}]" >> "$GITHUB_OUTPUT"
197+
198+ # Reduced PHP versions: the oldest and newest version of each major PHP version,
199+ # for use when testing older FROM branches.
200+ declare -A OLDEST_PHP
201+ declare -A NEWEST_PHP
202+
203+ for version in $(echo "$PHP_VERSIONS" | tr -d '[]"' | tr ',' ' '); do
204+ MAJOR=$(echo "$version" | cut -d'.' -f1)
205+ if [ -z "${OLDEST_PHP[$MAJOR]}" ]; then
206+ OLDEST_PHP[$MAJOR]=$version
207+ fi
208+ NEWEST_PHP[$MAJOR]=$version
209+ done
210+
211+ REDUCED_PHP=""
212+ for MAJOR in $(printf '%s\n' "${!OLDEST_PHP[@]}" | sort -n); do
213+ OLDEST=${OLDEST_PHP[$MAJOR]}
214+ NEWEST=${NEWEST_PHP[$MAJOR]}
215+ if [ -n "$REDUCED_PHP" ]; then
216+ REDUCED_PHP="${REDUCED_PHP},"
217+ fi
218+ REDUCED_PHP="${REDUCED_PHP}\"${OLDEST}\""
219+ if [ "$OLDEST" != "$NEWEST" ]; then
220+ REDUCED_PHP="${REDUCED_PHP},\"${NEWEST}\""
221+ fi
222+ done
223+
224+ echo "reduced-php-versions=[${REDUCED_PHP}]" >> "$GITHUB_OUTPUT"
162225
163226 # Tests the full list of PHP/MySQL combinations for the two most recent versions of WordPress.
164227 #
@@ -309,16 +372,11 @@ jobs:
309372 new-version : ${{ inputs.new-version && inputs.new-version || 'latest' }}
310373 multisite : ${{ matrix.multisite }}
311374
312- # Tests an older WordPress branch against all PHP and database versions it supports, as
313- # documented in the version support JSON files .
375+ # Tests the two most recent FROM branches (the target branch and the one immediately before it)
376+ # against the full PHP and database version matrix supported by the target branch .
314377 #
315- # Uses the X.Y initial release of the branch as the FROM version to test the within-branch
316- # upgrade path. PHP and database versions unsupported by Docker are excluded, as are MySQL
317- # innovation releases other than the most recent.
318- #
319- # Only runs when testing an older branch (i.e. new-version is not empty, 'latest', 'nightly',
320- # or a version of the currently supported branch).
321- upgrade-tests-older-branch-mysql :
378+ # Only runs when testing an older branch.
379+ upgrade-tests-older-branch-recent-mysql :
322380 name : WP ${{ matrix.wp }} to ${{ inputs.new-version }} / PHP ${{ matrix.php }} / MySQL ${{ matrix.db-version }}${{ matrix.multisite && ' multisite' || '' }}
323381 uses : ./.github/workflows/reusable-upgrade-testing.yml
324382 needs : [ build-test-matrix, determine-from-versions ]
@@ -331,7 +389,62 @@ jobs:
331389 php : ${{ fromJSON( needs.build-test-matrix.outputs.php-versions ) }}
332390 db-type : [ 'mysql' ]
333391 db-version : ${{ fromJSON( needs.build-test-matrix.outputs.mysql-versions ) }}
334- wp : ${{ fromJSON( needs.determine-from-versions.outputs.from-versions ) }}
392+ wp : ${{ fromJSON( needs.determine-from-versions.outputs.recent-from-versions ) }}
393+ multisite : [ false, true ]
394+ exclude :
395+ # There are no local WordPress Docker environment containers for PHP <= 5.3.
396+ - php : ' 5.2'
397+ - php : ' 5.3'
398+ # MySQL containers <= 5.5 do not exist or fail to start properly.
399+ - db-version : ' 5.0'
400+ - db-version : ' 5.1'
401+ - db-version : ' 5.5'
402+ # 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.
403+ - php : ' 7.2'
404+ db-version : ' 8.4'
405+ - php : ' 7.3'
406+ db-version : ' 8.4'
407+ # Only test the latest innovation release.
408+ - db-version : ' 9.0'
409+ - db-version : ' 9.1'
410+ - db-version : ' 9.2'
411+ - db-version : ' 9.3'
412+ - db-version : ' 9.4'
413+ - db-version : ' 9.5'
414+ # MySQL 9.0+ will not work on PHP 7.2 & 7.3. See https://core.trac.wordpress.org/ticket/61218.
415+ - php : ' 7.2'
416+ db-version : ' 9.6'
417+ - php : ' 7.3'
418+ db-version : ' 9.6'
419+ with :
420+ os : ${{ matrix.os }}
421+ php : ${{ matrix.php }}
422+ db-type : ${{ matrix.db-type }}
423+ db-version : ${{ matrix.db-version }}
424+ wp : ${{ matrix.wp }}
425+ new-version : ${{ inputs.new-version }}
426+ multisite : ${{ matrix.multisite }}
427+
428+ # Tests all remaining older FROM branches against a reduced PHP matrix: only the oldest and
429+ # newest version of each major PHP version supported by the target branch.
430+ #
431+ # Only runs when testing an older branch and the target is more than one branch ahead of
432+ # OLDEST_SECURITY_BRANCH (i.e. there are older FROM branches beyond the two most recent).
433+ upgrade-tests-older-branch-older-mysql :
434+ name : WP ${{ matrix.wp }} to ${{ inputs.new-version }} / PHP ${{ matrix.php }} / MySQL ${{ matrix.db-version }}${{ matrix.multisite && ' multisite' || '' }}
435+ uses : ./.github/workflows/reusable-upgrade-testing.yml
436+ needs : [ build-test-matrix, determine-from-versions ]
437+ if : ${{ needs.determine-from-versions.outputs.older-from-versions != '[]' }}
438+ permissions :
439+ contents : read
440+ strategy :
441+ fail-fast : false
442+ matrix :
443+ os : [ 'ubuntu-24.04' ]
444+ php : ${{ fromJSON( needs.determine-from-versions.outputs.reduced-php-versions ) }}
445+ db-type : [ 'mysql' ]
446+ db-version : ${{ fromJSON( needs.build-test-matrix.outputs.mysql-versions ) }}
447+ wp : ${{ fromJSON( needs.determine-from-versions.outputs.older-from-versions ) }}
335448 multisite : [ false, true ]
336449 exclude :
337450 # There are no local WordPress Docker environment containers for PHP <= 5.3.
@@ -373,7 +486,7 @@ jobs:
373486 permissions :
374487 actions : read
375488 contents : read
376- needs : [ 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, upgrade-tests-older-branch-mysql ]
489+ needs : [ 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, upgrade-tests-older-branch-recent-mysql, upgrade-tests-older-branch-older- mysql ]
377490 if : ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
378491 with :
379492 calling_status : ${{ contains( needs.*.result, 'cancelled' ) && 'cancelled' || contains( needs.*.result, 'failure' ) && 'failure' || 'success' }}
0 commit comments