Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Install Testing Workflow More Flexible #5482

Closed
wants to merge 27 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
4fc0454
First pass at adding a dynamic matrix and MariaDB testing.
desrosj Oct 13, 2023
3314dce
Add versioning files.
desrosj Oct 13, 2023
1c65ff3
Some bug fixes and improvements.
desrosj Oct 13, 2023
35a1851
Remove MariaDB for now.
desrosj Oct 13, 2023
f7f8162
Merge remote-tracking branch 'upstream/trunk' into dynamic-install-te…
desrosj Oct 20, 2023
99c6d16
Rule out an older version of CLI.
desrosj Oct 20, 2023
9dbf393
Merge branch 'trunk' of https://github.com/WordPress/wordpress-develo…
desrosj Oct 20, 2023
968723a
Exclude PHP 5.3 for now.
desrosj Oct 20, 2023
1db9fc5
Exclude MySQL 8 on PHP 5.4 and 5.5.
desrosj Oct 20, 2023
ff50712
Update MySQL version testing.
desrosj Oct 23, 2023
223a227
Remove MySQL 5.5 from the version list.
desrosj Oct 25, 2023
85c17e3
Merge branch 'trunk' of https://github.com/WordPress/wordpress-develo…
desrosj Oct 25, 2023
d414c1a
Revert "Remove MySQL 5.5 from the version list."
desrosj Oct 31, 2023
8d7edae
Exclude testing MySQL 5.5 for now.
desrosj Oct 31, 2023
45ff713
Merge remote-tracking branch 'upstream/trunk' into dynamic-install-te…
desrosj Oct 31, 2023
981ec82
Improving inline docs.
desrosj Oct 31, 2023
a412458
Test against `nightly` by default.
desrosj Oct 31, 2023
f446bcf
Correct logic for storing WP version.
desrosj Oct 31, 2023
0678796
Correct else if syntax.
desrosj Oct 31, 2023
23838c5
Differentiate between the major version and the full version being pa…
desrosj Oct 31, 2023
989ef13
Some bugs related to switching to `nightly` as the default.
desrosj Oct 31, 2023
d8b8a14
Improve the concurrency group.
desrosj Oct 31, 2023
f25a901
Add a once a week schedule event.
desrosj Oct 31, 2023
5c0ed86
Merge remote-tracking branch 'upstream/trunk' into dynamic-install-te…
desrosj Dec 18, 2023
9566281
Merge remote-tracking branch 'upstream/trunk' into dynamic-install-te…
desrosj Dec 21, 2023
019da24
Add PHP 5.2 and MySQL 5.0, 5.1 to the supports file.
desrosj Dec 21, 2023
bf5708d
Make the support files hidden.
desrosj Dec 21, 2023
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
95 changes: 86 additions & 9 deletions .github/workflows/install-testing.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Confirms that installing WordPress using WP-CLI works successfully.
#
# This workflow is not meant to test wordpress-develop checkouts, but rather tagged versions officially available on WordPress.org.
name: Installation Tests

on:
Expand All @@ -11,25 +14,81 @@ on:
# Always test the workflow when changes are suggested.
paths:
- '.github/workflows/install-testing.yml'
schedule:
- cron: '0 0 * * 1'
workflow_dispatch:
inputs:
wp-version:
description: 'The version to test installing. Accepts major and minor versions, "latest", or "nightly". Major releases must not end with ".0".'
type: string
default: 'latest'
default: 'nightly'

# Cancels all previous workflow runs for pull requests that have not completed.
concurrency:
# The concurrency group contains the workflow name and the branch name for pull requests
# or the commit hash for any other events.
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
group: ${{ github.workflow }}-${{ inputs.wp-version || github.event_name == 'pull_request' && github.head_ref || github.sha }}
cancel-in-progress: true

# Disable permissions for all available scopes by default.
# Any needed permissions should be configured at the job level.
permissions: {}

jobs:
# Determines the appropriate values for PHP and database versions based on the WordPress version being tested.
#
# Performs the following steps:
# - Checks out the repository.
# - Fetches the versions of PHP to test.
# - Fetches the versions of MySQL to test.
build-matrix:
name: Determine PHP Versions to test
runs-on: ubuntu-latest
timeout-minutes: 5
outputs:
major-wp-version: ${{ steps.major-wp-version.outputs.version }}
php-versions: ${{ steps.php-versions.outputs.versions }}
mysql-versions: ${{ steps.mysql-versions.outputs.versions }}

steps:
- name: Checkout repository
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
with:
show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}

- name: Determine the major WordPress version
id: major-wp-version
run: |
if [ "${{ inputs.wp-version }}" ] && [ "${{ inputs.wp-version }}" != "nightly" ] && [ "${{ inputs.wp-version }}" != "latest" ]; then
echo "version=$(echo "${{ inputs.wp-version }}" | tr '.' '-' | cut -d '-' -f1-2)" >> $GITHUB_OUTPUT
elif [ "${{ inputs.wp-version }}" ]; then
echo "version=$(echo "${{ inputs.wp-version }}")" >> $GITHUB_OUTPUT
else
echo "version=nightly" >> $GITHUB_OUTPUT
fi

# Look up the major version's specific PHP support policy when a version is provided.
# Otherwise, use the current PHP support policy.
- name: Get supported PHP versions
id: php-versions
run: |
if [ "${{ steps.major-wp-version.outputs.version }}" != "latest" ] && [ "${{ steps.major-wp-version.outputs.version }}" != "nightly" ]; then
echo "versions=$(jq -r '.["${{ steps.major-wp-version.outputs.version }}"] | @json' .version-support-php.json)" >> $GITHUB_OUTPUT
else
echo "versions=$(jq -r '.[ (keys[-1]) ] | @json' .version-support-php.json)" >> $GITHUB_OUTPUT
fi

# Look up the major version's specific MySQL support policy when a version is provided.
# Otherwise, use the current MySQL support policy.
- name: Get supported MySQL versions
id: mysql-versions
run: |
if [ "${{ steps.major-wp-version.outputs.version }}" != "latest" ] && [ "${{ steps.major-wp-version.outputs.version }}" != "nightly" ]; then
echo "versions=$(jq -r '.["${{ steps.major-wp-version.outputs.version }}"] | @json' .version-support-mysql.json)" >> $GITHUB_OUTPUT
else
echo "versions=$(jq -r '.[ (keys[-1]) ] | @json' .version-support-mysql.json)" >> $GITHUB_OUTPUT
fi

# Test the WordPress installation process through WP-CLI.
#
# Performs the following steps:
Expand All @@ -39,41 +98,59 @@ jobs:
# - Creates a `wp-config.php` file.
# - Installs WordPress.
install-tests-mysql:
name: WP ${{ inputs.wp-version || 'latest' }} / PHP ${{ matrix.php }} / ${{ 'mariadb' == matrix.db-type && 'MariaDB' || 'MySQL' }} ${{ matrix.db-version }}${{ matrix.multisite && ' multisite' || '' }}
name: WP ${{ inputs.wp-version || 'nightly' }} / PHP ${{ matrix.php }} / ${{ 'mariadb' == matrix.db-type && 'MariaDB' || 'MySQL' }} ${{ matrix.db-version }}${{ matrix.multisite && ' multisite' || '' }}
permissions:
contents: read
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
timeout-minutes: 10
needs: [ build-matrix ]
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest ]
php: [ '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3' ]
php: ${{ fromJSON( needs.build-matrix.outputs.php-versions ) }}
db-type: [ 'mysql' ]
db-version: [ '5.7', '8.0' ]
db-version: ${{ fromJSON( needs.build-matrix.outputs.mysql-versions ) }}
multisite: [ false, true ]
memcached: [ false ]

# Exclude some PHP and MySQL versions that cannot currently be tested with Docker containers.
exclude:
- php: '5.2'
- php: '5.3'
- db-version: '5.0'
- db-version: '5.1'
- db-version: '5.5'

services:
database:
image: ${{ matrix.db-type }}:${{ matrix.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 ${{ matrix.db-type }}:${{ matrix.db-version }} -c "exec docker-entrypoint.sh mysqld --default-authentication-plugin=mysql_native_password"
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 ${{ matrix.db-type }}:${{ matrix.db-version }}
-c "exec docker-entrypoint.sh mysqld${{ matrix.db-version != '5.5' && ' --default-authentication-plugin=mysql_native_password"' || '' }}

steps:
- name: Set up PHP ${{ matrix.php }}
uses: shivammathur/setup-php@e6f75134d35752277f093989e72e140eaa222f35 # v2.28.0
with:
php-version: '${{ matrix.php }}'
coverage: none
tools: wp-cli
tools: wp-cli${{ contains( fromJSON('["5.4", "5.5"]'), matrix.php ) && ':2.4.0' || '' }}

- name: Start the database server
run: |
sudo systemctl start ${{ matrix.db-type }}

- name: Download WordPress
run: wp core download ${{ inputs.wp-version && 'latest' != inputs.wp-version && format( '--version={0}', inputs.wp-version ) || '' }}
run: wp core download ${{ inputs.wp-version && format( '--version={0}', inputs.wp-version ) || '--version=nightly' }}

- 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'] }}
Expand Down
188 changes: 188 additions & 0 deletions .version-support-mysql.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
{
"6-5": [
"8.2",
"8.0",
"5.7",
"5.6",
"5.5"
],
"6-4": [
"8.0",
"5.7",
"5.6",
"5.5",
"5.1",
"5.0"
],
"6-3": [
"8.0",
"5.7",
"5.6",
"5.5",
"5.1",
"5.0"
],
"6-2": [
"8.0",
"5.7",
"5.6",
"5.5",
"5.1",
"5.0"
],
"6-1": [
"8.0",
"5.7",
"5.6",
"5.5",
"5.1",
"5.0"
],
"6-0": [
"8.0",
"5.7",
"5.6",
"5.5",
"5.1",
"5.0"
],
"5-9": [
"8.0",
"5.7",
"5.6",
"5.5",
"5.1",
"5.0"
],
"5-8": [
"8.0",
"5.7",
"5.6",
"5.5",
"5.1",
"5.0"
],
"5-7": [
"8.0",
"5.7",
"5.6",
"5.5",
"5.1",
"5.0"
],
"5-6": [
"8.0",
"5.7",
"5.6",
"5.5",
"5.1",
"5.0"
],
"5-5": [
"8.0",
"5.7",
"5.6",
"5.5",
"5.1",
"5.0"
],
"5-4": [
"8.0",
"5.7",
"5.6",
"5.5",
"5.1",
"5.0"
],
"5-3": [
"8.0",
"5.7",
"5.6",
"5.5",
"5.1",
"5.0"
],
"5-2": [
"8.0",
"5.7",
"5.6",
"5.5",
"5.1",
"5.0"
],
"5-1": [
"5.7",
"5.6",
"5.5"
],
"5-0": [
"5.7",
"5.6",
"5.5",
"5.1",
"5.0"
],
"4-9": [
"5.7",
"5.6",
"5.5",
"5.1",
"5.0"
],
"4-8": [
"5.7",
"5.6",
"5.5",
"5.1",
"5.0"
],
"4-7": [
"5.7",
"5.6",
"5.5",
"5.1",
"5.0"
],
"4-6": [
"5.7",
"5.6",
"5.5",
"5.1",
"5.0"
],
"4-5": [
"5.7",
"5.6",
"5.5",
"5.1",
"5.0"
],
"4-4": [
"5.7",
"5.6",
"5.5",
"5.1",
"5.0"
],
"4-3": [
"5.7",
"5.6",
"5.5",
"5.1",
"5.0"
],
"4-2": [
"5.7",
"5.6",
"5.5",
"5.1",
"5.0"
],
"4-1": [
"5.7",
"5.6",
"5.5",
"5.1",
"5.0"
]
}
Loading
Loading