wordpress-develop/.github/workflows/upgrade-testing-run.yml
Jonathan Desrosiers d7d91b8f90 Build/Test Tools: Update third-party GitHub Actions.
This updates the following third-party GitHub Actions to their latest versions:

- `actions/setup-node` from `3.8.1` to `4.0.1`
- `actions/upload-artifact` from `3.1.2` to `4.3.0`
- `shivammathur/setup-php` from `2.28.0` to `2.29.0`
- `actions/cache` from `3.3.2` to `4.0.0`
- `codecov/codecov-action` from `3.1.4` to `3.1.5`

Most notably, these updates silence newly encountered notices as a result of GitHub beginning to transition away from Node.js 16 to Node.js 20 (see https://github.blog/changelog/2023-09-22-github-actions-transitioning-from-node-16-to-node-20/).

Props swissspidy.
See #59805.

git-svn-id: https://develop.svn.wordpress.org/trunk@57362 602fd350-edb4-49c9-b593-d223f7449a82
2024-01-26 13:48:01 +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@6d7209f44a25a59e904b1ee9f3b0c33ab2cd888d # v2.29.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 ) || '' }}