From 69e42b768730b7a5b672dfe8ffb0d50fe3c09fd1 Mon Sep 17 00:00:00 2001 From: Adrian Moldovan <3854374+adimoldovan@users.noreply.github.com> Date: Thu, 19 Nov 2026 16:46:53 +0200 Subject: [PATCH 1/2] Build/Test Tools: Download the release zip once in Installation and Upgrade Tests. For about 20 minutes after a release goes up, some WordPress.org download servers do not have the new zip, so jobs that download it fail. Now one job downloads the zip with WP-CLI, retries for up to 45 minutes, and requires a verified md5 hash. Every job then uses that zip. Runs for latest, nightly and develop do not change. See #66744. --- .github/workflows/install-testing.yml | 31 +++++- .../reusable-download-wordpress-release.yml | 101 ++++++++++++++++++ .../workflows/reusable-upgrade-testing.yml | 28 ++++- .github/workflows/upgrade-testing.yml | 29 +++-- 4 files changed, 180 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/reusable-download-wordpress-release.yml diff --git a/.github/workflows/install-testing.yml b/.github/workflows/install-testing.yml index 4e1af59a308fd..d25669e7fc038 100644 --- a/.github/workflows/install-testing.yml +++ b/.github/workflows/install-testing.yml @@ -18,6 +18,7 @@ on: - '.github/workflows/install-testing.yml' - '.version-support-*.json' - '.github/workflows/reusable-support-json-reader-v1.yml' + - '.github/workflows/reusable-download-wordpress-release.yml' pull_request: # Always test the workflow when changes are suggested. paths: @@ -27,6 +28,7 @@ on: - '.version-support-*.json' - '.github/workflows/install-testing.yml' - '.github/workflows/reusable-support-json-reader-v1.yml' + - '.github/workflows/reusable-download-wordpress-release.yml' schedule: - cron: '0 0 * * 1' @@ -59,6 +61,16 @@ jobs: with: wp-version: ${{ inputs.wp-version }} + # Downloads a release zip once for every matrix job, waiting until WordPress.org serves it. + download-wordpress: + name: Download WordPress + uses: ./.github/workflows/reusable-download-wordpress-release.yml + permissions: + contents: read + if: ${{ github.repository == 'WordPress/wordpress-develop' }} + with: + version: ${{ inputs.wp-version || 'nightly' }} + # Test the WordPress installation process through WP-CLI. # # Performs the following steps: @@ -74,7 +86,7 @@ jobs: runs-on: ${{ matrix.os }} if: ${{ github.repository == 'WordPress/wordpress-develop' }} timeout-minutes: 15 - needs: [ build-test-matrix ] + needs: [ build-test-matrix, download-wordpress ] env: WP_ADMIN_USER: admin @@ -147,9 +159,24 @@ jobs: with: version: ${{ contains( fromJSON('["5.4", "5.5"]'), matrix.php ) && '2.4.0' || contains( fromJSON('["5.6", "7.0", "7.1"]'), matrix.php ) && '2.12.0' || 'latest' }} + - name: Download the WordPress release artifact + if: ${{ needs.download-wordpress.outputs.artifact != '' }} + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: ${{ needs.download-wordpress.outputs.artifact }} + path: ${{ runner.temp }} + + # WP-CLI 2.4.0 cannot install from a local zip, so unzip it. + - name: Extract WordPress + if: ${{ needs.download-wordpress.outputs.artifact != '' }} + run: | + unzip -q "${RUNNER_TEMP}/wordpress.zip" -d "${RUNNER_TEMP}" + mv "${RUNNER_TEMP}"/wordpress/* . + # WP-CLI 2.x extracts tarballs with PharData, which truncates paths longer than 100 characters. # Zip archives are not affected, so download the zip for every version. - name: Download WordPress + if: ${{ needs.download-wordpress.outputs.artifact == '' }} # WP-CLI requests WordPress from WordPress.org once, so a network error fails the job. # It extracts only after a complete download, so a retry starts from an empty directory. uses: $/.github/actions/run-with-retry @@ -187,7 +214,7 @@ jobs: permissions: actions: read contents: read - needs: [ install-tests-mysql ] + needs: [ download-wordpress, install-tests-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' }} diff --git a/.github/workflows/reusable-download-wordpress-release.yml b/.github/workflows/reusable-download-wordpress-release.yml new file mode 100644 index 0000000000000..85fa818584d2b --- /dev/null +++ b/.github/workflows/reusable-download-wordpress-release.yml @@ -0,0 +1,101 @@ +## +# A reusable workflow that downloads a WordPress release zip once and shares it as an artifact. +# +# For a while after a release is uploaded, some WordPress.org download servers do not have the new zip yet. +# This workflow waits until the zip downloads and passes its md5 check, so the jobs that use it do not each fail. +## +name: Download a WordPress release + +on: + workflow_call: + inputs: + version: + description: 'The WordPress version to download. "latest", "nightly", "trunk" and "develop" are not downloaded.' + type: string + required: true + outputs: + artifact: + description: 'The name of the artifact that holds wordpress.zip, or an empty string when nothing was downloaded.' + value: ${{ jobs.download.outputs.artifact }} + +# Disable permissions for all available scopes by default. +# Any needed permissions should be configured at the job level. +permissions: {} + +jobs: + # Downloads the release zip and uploads it as an artifact. + # + # Performs the following steps: + # - Sets up PHP and WP-CLI. + # - Downloads the release zip, retrying until it is available. + # - Uploads the zip as an artifact. + download: + name: Download WordPress ${{ inputs.version }} + permissions: + contents: read + runs-on: ubuntu-26.04 + timeout-minutes: 50 + outputs: + artifact: ${{ steps.upload.outcome == 'success' && 'wordpress-release' || '' }} + + steps: + - name: Check whether the version is a release + id: check + run: | + case "${WP_VERSION}" in + latest|nightly|trunk|develop) echo "release=false" >> "$GITHUB_OUTPUT" ;; + *) echo "release=true" >> "$GITHUB_OUTPUT" ;; + esac + env: + WP_VERSION: ${{ inputs.version }} + + - name: Set up PHP + if: ${{ steps.check.outputs.release == 'true' }} + uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # 2.37.2 + with: + php-version: '8.4' + coverage: none + + # This job does not check out the repository: `$/` fetches the action from this workflow's commit. + - name: Set up WP-CLI + if: ${{ steps.check.outputs.release == 'true' }} + uses: $/.github/actions/setup-wp-cli + + # A missing md5 checksum is only a warning in WP-CLI, so a try passes only when the hash was verified. + # The URL form always saves a zip; `--version` can save a tar.gz. + - name: Download WordPress ${{ inputs.version }} + if: ${{ steps.check.outputs.release == 'true' }} + run: | + until output=$(wp core download "https://wordpress.org/wordpress-${WP_VERSION}.zip" --no-extract --path="$DOWNLOAD_DIR" 2>&1) \ + && grep -q 'md5 hash verified' <<< "$output"; do + echo "$output" + + if (( SECONDS + RETRY_DELAY_SECONDS > MAX_WAIT_SECONDS )); then + echo "::error::WordPress ${WP_VERSION} could not be downloaded after ${SECONDS} seconds." + exit 1 + fi + + echo "Trying again in ${RETRY_DELAY_SECONDS} seconds." + sleep "$RETRY_DELAY_SECONDS" + rm -rf "$DOWNLOAD_DIR" + done + + echo "$output" + echo "Downloaded WordPress ${WP_VERSION} after waiting ${SECONDS} seconds." + mv "$DOWNLOAD_DIR"/wp_*.zip "$DOWNLOAD_DIR/wordpress.zip" + env: + WP_VERSION: ${{ inputs.version }} + DOWNLOAD_DIR: ${{ runner.temp }}/wordpress-release + MAX_WAIT_SECONDS: 2700 # 45 minutes. + RETRY_DELAY_SECONDS: 60 + + - name: Upload the release zip + id: upload + if: ${{ steps.check.outputs.release == 'true' }} + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: wordpress-release + path: ${{ runner.temp }}/wordpress-release/wordpress.zip + if-no-files-found: error + overwrite: true + retention-days: 1 diff --git a/.github/workflows/reusable-upgrade-testing.yml b/.github/workflows/reusable-upgrade-testing.yml index cc36c1a80587a..6510ba6818249 100644 --- a/.github/workflows/reusable-upgrade-testing.yml +++ b/.github/workflows/reusable-upgrade-testing.yml @@ -17,6 +17,11 @@ on: description: 'The version of WordPress to update to. Use "latest" to update to the latest version, "develop" to update to the current branch, or provide a specific version number to update to.' type: 'string' default: 'latest' + new-version-artifact: + description: 'Optional. The name of an artifact that holds the wordpress.zip of new-version. When set, the upgrade installs from it instead of downloading.' + required: false + type: 'string' + default: '' php: description: 'The version of PHP to use. Expected format: X.Y.' required: true @@ -137,8 +142,29 @@ jobs: run: | wp core update develop.zip + - name: Download the WordPress ${{ inputs.new-version }} artifact + if: ${{ inputs.new-version != 'develop' && inputs.new-version-artifact != '' }} + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: ${{ inputs.new-version-artifact }} + + # With a zip, WP-CLI does not stop a downgrade, and the minor update can already be past the target. + # `sort -V` orders 7.2 before 7.2-RC2, so compare the way WordPress does. + - name: Upgrade to WordPress ${{ inputs.new-version }} from the artifact + if: ${{ inputs.new-version != 'develop' && inputs.new-version-artifact != '' }} + run: | + current=$(wp core version) + if ! CURRENT="$current" php -r 'exit( version_compare( getenv( "CURRENT" ), getenv( "WP_VERSION" ), "<" ) ? 0 : 1 );'; then + echo "WordPress ${current} is not older than ${WP_VERSION}, so there is nothing to upgrade." + exit 0 + fi + + wp core update wordpress.zip --version="$WP_VERSION" + env: + WP_VERSION: ${{ inputs.new-version }} + - name: Upgrade to WordPress ${{ inputs.new-version }} - if: ${{ inputs.new-version != 'develop' }} + if: ${{ inputs.new-version != 'develop' && inputs.new-version-artifact == '' }} run: | wp core update ${{ 'latest' != inputs.new-version && '--version="${WP_VERSION}"' || '' }} env: diff --git a/.github/workflows/upgrade-testing.yml b/.github/workflows/upgrade-testing.yml index d4817522585d9..4b43906b3fcd3 100644 --- a/.github/workflows/upgrade-testing.yml +++ b/.github/workflows/upgrade-testing.yml @@ -14,6 +14,7 @@ on: - '.github/actions/smoke-check/**' - '.github/workflows/upgrade-testing.yml' - '.github/workflows/reusable-upgrade-testing.yml' + - '.github/workflows/reusable-download-wordpress-release.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: @@ -24,6 +25,7 @@ on: - '.github/actions/run-with-retry/**' - '.github/workflows/upgrade-testing.yml' - '.github/workflows/reusable-upgrade-testing.yml' + - '.github/workflows/reusable-download-wordpress-release.yml' workflow_dispatch: inputs: new-version: @@ -152,12 +154,22 @@ jobs: filter wp-5x-php-8x "$WP_5X_PHP_8X" filter oldest-wp "$OLDEST_WP" + # Downloads a release zip once for every matrix job, waiting until WordPress.org serves it. + download-wordpress: + name: Download WordPress + uses: ./.github/workflows/reusable-download-wordpress-release.yml + permissions: + contents: read + if: ${{ github.repository == 'WordPress/wordpress-develop' }} + with: + version: ${{ inputs.new-version && inputs.new-version || 'latest' }} + # 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 ] + needs: [ build-test-matrix, download-wordpress ] permissions: contents: read strategy: @@ -177,13 +189,14 @@ jobs: wp: ${{ matrix.wp }} new-version: ${{ inputs.new-version && inputs.new-version || 'latest' }} multisite: ${{ matrix.multisite }} + new-version-artifact: ${{ needs.download-wordpress.outputs.artifact }} # 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 ] + needs: [ build-test-matrix, download-wordpress ] permissions: contents: read strategy: @@ -203,13 +216,14 @@ jobs: wp: ${{ matrix.wp }} new-version: ${{ inputs.new-version && inputs.new-version || 'latest' }} multisite: ${{ matrix.multisite }} + new-version-artifact: ${{ needs.download-wordpress.outputs.artifact }} # 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 ] + needs: [ build-test-matrix, download-wordpress ] permissions: contents: read strategy: @@ -229,6 +243,7 @@ jobs: wp: ${{ matrix.wp }} new-version: ${{ inputs.new-version && inputs.new-version || 'latest' }} multisite: ${{ matrix.multisite }} + new-version-artifact: ${{ needs.download-wordpress.outputs.artifact }} # Tests 5.x releases where the WordPress database version changed on the oldest and newest supported versions of PHP 8. # @@ -239,7 +254,7 @@ jobs: 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 ] + needs: [ build-test-matrix, download-wordpress ] permissions: contents: read strategy: @@ -259,6 +274,7 @@ jobs: wp: ${{ matrix.wp }} new-version: ${{ inputs.new-version && inputs.new-version || 'latest' }} multisite: ${{ matrix.multisite }} + new-version-artifact: ${{ needs.download-wordpress.outputs.artifact }} # The oldest version of WordPress receiving security updates should always be tested against # the widest possible list of PHP/MySQL combinations. @@ -270,7 +286,7 @@ jobs: 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 ] + needs: [ build-test-matrix, download-wordpress ] permissions: contents: read strategy: @@ -290,6 +306,7 @@ jobs: wp: ${{ matrix.wp }} new-version: ${{ inputs.new-version && inputs.new-version || 'latest' }} multisite: ${{ matrix.multisite }} + new-version-artifact: ${{ needs.download-wordpress.outputs.artifact }} slack-notifications: name: Slack Notifications @@ -297,7 +314,7 @@ jobs: 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 ] + needs: [ build-test-matrix, download-wordpress, 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' }} From f6062af5da8cf1fa883a58206bd3e373bb6c527b Mon Sep 17 00:00:00 2001 From: Adrian Moldovan <3854374+adimoldovan@users.noreply.github.com> Date: Fri, 20 Nov 2026 13:28:55 +0200 Subject: [PATCH 2/2] Keep the release zip for 30 days and call the download workflow with the self-repository syntax. --- .github/actionlint.yaml | 1 + .github/workflows/install-testing.yml | 2 +- .github/workflows/reusable-download-wordpress-release.yml | 2 +- .github/workflows/upgrade-testing.yml | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/actionlint.yaml b/.github/actionlint.yaml index 9825166f0fb38..15d3c76f7da89 100644 --- a/.github/actionlint.yaml +++ b/.github/actionlint.yaml @@ -10,3 +10,4 @@ paths: .github/workflows/**/*.yml: ignore: - 'specifying action "\$/[^"]+" in invalid format because ref is missing' + - 'reusable workflow call "\$/[^"]+" at "uses" is not following the format' diff --git a/.github/workflows/install-testing.yml b/.github/workflows/install-testing.yml index d25669e7fc038..eb238338b3e87 100644 --- a/.github/workflows/install-testing.yml +++ b/.github/workflows/install-testing.yml @@ -64,7 +64,7 @@ jobs: # Downloads a release zip once for every matrix job, waiting until WordPress.org serves it. download-wordpress: name: Download WordPress - uses: ./.github/workflows/reusable-download-wordpress-release.yml + uses: $/.github/workflows/reusable-download-wordpress-release.yml permissions: contents: read if: ${{ github.repository == 'WordPress/wordpress-develop' }} diff --git a/.github/workflows/reusable-download-wordpress-release.yml b/.github/workflows/reusable-download-wordpress-release.yml index 85fa818584d2b..ec953abbfd58f 100644 --- a/.github/workflows/reusable-download-wordpress-release.yml +++ b/.github/workflows/reusable-download-wordpress-release.yml @@ -98,4 +98,4 @@ jobs: path: ${{ runner.temp }}/wordpress-release/wordpress.zip if-no-files-found: error overwrite: true - retention-days: 1 + retention-days: 30 diff --git a/.github/workflows/upgrade-testing.yml b/.github/workflows/upgrade-testing.yml index 4b43906b3fcd3..3765692707b16 100644 --- a/.github/workflows/upgrade-testing.yml +++ b/.github/workflows/upgrade-testing.yml @@ -157,7 +157,7 @@ jobs: # Downloads a release zip once for every matrix job, waiting until WordPress.org serves it. download-wordpress: name: Download WordPress - uses: ./.github/workflows/reusable-download-wordpress-release.yml + uses: $/.github/workflows/reusable-download-wordpress-release.yml permissions: contents: read if: ${{ github.repository == 'WordPress/wordpress-develop' }}