wordpress-develop/.github/workflows/upgrade-testing-run.yml
Jonathan Desrosiers 5523bd276b Build/Test Tools: Introduce install and upgrade testing workflows.
This introduces GitHub Action workflows for testing the installation and upgrade process to ensure there are no unexpected issues. The goal of these workflows is to replicate some of the manual testing that happens during the release process. This does not replace that testing which is a fantastic, low barrier way for someone newer to contributing to get involved. Instead, it should serve as an additional sanity check to ensure no combinations are missed.

The installation workflow tests installing the latest or specified version of WordPress on all PHP and MySQL version combinations for both single and multisite.

The upgrade testing will test upgrading from each branch that still receives security updates to the latest or specified version on all PHP and MySQL version combinations for both single and multisite.

Both workflows confirm that no errors are encountered when using WP-CLI to install or upgrade WordPress. No test assertions of any type are currently performed, but adding some will be explored.

Props costdev, azaozz, ironprogrammer, desrosj.
See #58977.

git-svn-id: https://develop.svn.wordpress.org/trunk@56661 602fd350-edb4-49c9-b593-d223f7449a82
2023-09-22 17:41:11 +00:00

90 lines
3.3 KiB
YAML

# A callable workflow that runs WordPress upgrade testing under the conditions provided.
name: Upgrade Tests
on:
workflow_call:
inputs:
os:
description: 'Operating system to run tests on.'
required: false
type: 'string'
default: 'ubuntu-latest'
wp:
description: 'The version of WordPress to start with.'
required: true
type: 'string'
new-version:
description: 'The version of WordPress to update to.'
type: 'string'
default: 'latest'
php:
description: 'The version of PHP to use. Expected format: X.Y.'
required: true
type: 'string'
multisite:
description: 'Whether to run tests as multisite.'
required: false
type: 'boolean'
default: false
db-type:
description: 'Database type. Valid types are mysql and mariadb.'
required: false
type: 'string'
default: 'mysql'
db-version:
description: 'Database version.'
required: false
type: 'string'
default: '5.7'
jobs:
# Runs upgrade tests on a build of WordPress.
#
# Performs the following steps:
# - Sets up PHP.
# - Starts the database server.
# - Downloads the specified version of WordPress.
# - Creates a `wp-config.php` file.
# - Installs WordPress.
# - Updates to the latest minor version.
# - Updates to the version of WordPress being tested.
upgrade-tests:
name: ${{ inputs.wp }} to ${{ inputs.new-version }} / PHP ${{ inputs.php }} with ${{ 'mariadb' == inputs.db-type && 'MariaDB' || 'MySQL' }} ${{ inputs.db-version }}${{ inputs.multisite && ' multisite' || '' }}
runs-on: ${{ inputs.os }}
timeout-minutes: 20
services:
database:
image: ${{ inputs.db-type }}:${{ inputs.db-version }}
ports:
- 3306
options: --health-cmd="mysqladmin ping" --health-interval=30s --health-timeout=10s --health-retries=5 -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=test_db --entrypoint sh ${{ inputs.db-type }}:${{ inputs.db-version }} -c "exec docker-entrypoint.sh mysqld --default-authentication-plugin=mysql_native_password"
steps:
- name: Set up PHP ${{ inputs.php }}
uses: shivammathur/setup-php@7fdd3ece872ec7ec4c098ae5ab7637d5e0a96067 # v2.26.0
with:
php-version: '${{ inputs.php }}'
coverage: none
tools: wp-cli
- name: Start the database server
run: |
sudo systemctl start ${{ inputs.db-type }}
- name: Download WordPress ${{ inputs.wp }}
run: wp core download --version=${{ inputs.wp }}
- name: Create wp-config.php file
run: wp config create --dbname=test_db --dbuser=root --dbpass=root --dbhost=127.0.0.1:${{ job.services.database.ports['3306'] }}
- name: Install WordPress
run: wp core ${{ inputs.multisite && 'multisite-' || '' }}install --url=http://localhost/ --title="Upgrade Test" --admin_user=admin --admin_password=password --admin_email=me@example.org --skip-email
- name: Update to the latest minor version
run: wp core update --minor
- name: Upgrade to WordPress ${{ inputs.new-version }}
run: |
wp core update${{ 'latest' != inputs.new-version && format( ' --version={0}', inputs.new-version ) || '' }}