Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions .github/actionlint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
31 changes: 29 additions & 2 deletions .github/workflows/install-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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'
Expand Down Expand Up @@ -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:
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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' }}
Expand Down
101 changes: 101 additions & 0 deletions .github/workflows/reusable-download-wordpress-release.yml
Original file line number Diff line number Diff line change
@@ -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: 30
28 changes: 27 additions & 1 deletion .github/workflows/reusable-upgrade-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
29 changes: 23 additions & 6 deletions .github/workflows/upgrade-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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.
#
Expand All @@ -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:
Expand All @@ -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.
Expand All @@ -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:
Expand All @@ -290,14 +306,15 @@ 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
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 ]
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' }}
Expand Down
Loading