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
28 changes: 27 additions & 1 deletion .github/workflows/reusable-upgrade-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,39 +79,63 @@ jobs:
-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: Compare versions
id: version_check
env:
OLD_VERSION: ${{ inputs.wp }}
NEW_VERSION: ${{ inputs.new-version }}
run: |
# Add .0 if version is X.Y format
[[ $OLD_VERSION =~ ^[0-9]+\.[0-9]+$ ]] && OLD_VERSION+=".0"
[[ $NEW_VERSION =~ ^[0-9]+\.[0-9]+$ ]] && NEW_VERSION+=".0"

if printf '%s\n%s\n' "$OLD_VERSION" "$NEW_VERSION" | sort -V -C; then
echo "valid=true" >> "$GITHUB_OUTPUT"
else
echo "valid=false" >> "$GITHUB_OUTPUT"
fi

- name: Set up PHP ${{ inputs.php }}
uses: shivammathur/setup-php@20529878ed81ef8e78ddf08b480401e6101a850f # v2.35.3
if: ${{ steps.version_check.outputs.valid == 'true' }}
with:
php-version: '${{ inputs.php }}'
coverage: none
tools: wp-cli

- name: Download WordPress ${{ inputs.wp }}
if: ${{ steps.version_check.outputs.valid == 'true' }}
run: wp core download --version="${WP_VERSION}"
env:
WP_VERSION: ${{ inputs.wp }}

- name: Create wp-config.php file
if: ${{ steps.version_check.outputs.valid == 'true' }}
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
if: ${{ steps.version_check.outputs.valid == 'true' }}
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
if: ${{ steps.version_check.outputs.valid == 'true' }}
run: wp core version

- name: Update to the latest minor version
if: ${{ steps.version_check.outputs.valid == 'true' }}
run: wp core update --minor

- name: Update the database after the minor update
if: ${{ steps.version_check.outputs.valid == 'true' }}
run: wp core update-db ${{ inputs.multisite && '--network' || '' }}

- name: Post-upgrade version check after the minor update
if: ${{ steps.version_check.outputs.valid == 'true' }}
run: wp core version

- name: Download build artifact for the current branch
Expand All @@ -126,14 +150,16 @@ jobs:
wp core update develop.zip

- name: Upgrade to WordPress ${{ inputs.new-version }}
if: ${{ inputs.new-version != 'develop' }}
if: ${{ inputs.new-version != 'develop' && steps.version_check.outputs.valid == 'true' }}
run: |
wp core update ${{ 'latest' != inputs.new-version && '--version="${WP_VERSION}"' || '' }}
env:
WP_VERSION: ${{ inputs.new-version }}

- name: Update the database
if: ${{ steps.version_check.outputs.valid == 'true' }}
run: wp core update-db ${{ inputs.multisite && '--network' || '' }}

- name: Post-upgrade version check
if: ${{ steps.version_check.outputs.valid == 'true' }}
run: wp core version
2 changes: 1 addition & 1 deletion .github/workflows/upgrade-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ jobs:
db-type: ${{ matrix.db-type }}
db-version: ${{ matrix.db-version }}
wp: ${{ matrix.wp }}
new-version: ${{ inputs.new-version && inputs.new-version || 'latest' }}
new-version: ${{ inputs.new-version && inputs.new-version || '6.6' }}
multisite: ${{ matrix.multisite }}

# Tests 6.x releases where the WordPress database version changed on the oldest and newest supported versions of PHP 7 & 8.
Expand Down
Loading