Skip to content

Commit 434ef23

Browse files
committed
Build/Test Tools: Make the install testing workflow more flexible.
In [56661], a new GitHub Actions workflow was introduced that focused on running some minimal installation tests for a version of WordPress for every PHP and MySQL combination. This workflow has tested well, but lacks flexibility and possesses one flaw: tests are only ever performed with currently supported versions, even if the version being tested had a different support policy. This updates the workflow to be more flexible, allowing all versions of WordPress currently receiving security fixes (back through 4.1) to be tested under the correct support policy. Additionally, the workflow can now run against the `nightly` build of WordPress. This replaces `latest` as the new default. This allows the tests to be run at any point during a release cycle without the need for an officially tagged version. Props jorbin, joemcgill, costdev. See #58977. git-svn-id: https://develop.svn.wordpress.org/trunk@57218 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 4525e0c commit 434ef23

3 files changed

Lines changed: 482 additions & 9 deletions

File tree

.github/workflows/install-testing.yml

Lines changed: 86 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Confirms that installing WordPress using WP-CLI works successfully.
2+
#
3+
# This workflow is not meant to test wordpress-develop checkouts, but rather tagged versions officially available on WordPress.org.
14
name: Installation Tests
25

36
on:
@@ -11,25 +14,81 @@ on:
1114
# Always test the workflow when changes are suggested.
1215
paths:
1316
- '.github/workflows/install-testing.yml'
17+
schedule:
18+
- cron: '0 0 * * 1'
1419
workflow_dispatch:
1520
inputs:
1621
wp-version:
1722
description: 'The version to test installing. Accepts major and minor versions, "latest", or "nightly". Major releases must not end with ".0".'
1823
type: string
19-
default: 'latest'
24+
default: 'nightly'
2025

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

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

3237
jobs:
38+
# Determines the appropriate values for PHP and database versions based on the WordPress version being tested.
39+
#
40+
# Performs the following steps:
41+
# - Checks out the repository.
42+
# - Fetches the versions of PHP to test.
43+
# - Fetches the versions of MySQL to test.
44+
build-matrix:
45+
name: Determine PHP Versions to test
46+
runs-on: ubuntu-latest
47+
timeout-minutes: 5
48+
outputs:
49+
major-wp-version: ${{ steps.major-wp-version.outputs.version }}
50+
php-versions: ${{ steps.php-versions.outputs.versions }}
51+
mysql-versions: ${{ steps.mysql-versions.outputs.versions }}
52+
53+
steps:
54+
- name: Checkout repository
55+
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
56+
with:
57+
show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}
58+
59+
- name: Determine the major WordPress version
60+
id: major-wp-version
61+
run: |
62+
if [ "${{ inputs.wp-version }}" ] && [ "${{ inputs.wp-version }}" != "nightly" ] && [ "${{ inputs.wp-version }}" != "latest" ]; then
63+
echo "version=$(echo "${{ inputs.wp-version }}" | tr '.' '-' | cut -d '-' -f1-2)" >> $GITHUB_OUTPUT
64+
elif [ "${{ inputs.wp-version }}" ]; then
65+
echo "version=$(echo "${{ inputs.wp-version }}")" >> $GITHUB_OUTPUT
66+
else
67+
echo "version=nightly" >> $GITHUB_OUTPUT
68+
fi
69+
70+
# Look up the major version's specific PHP support policy when a version is provided.
71+
# Otherwise, use the current PHP support policy.
72+
- name: Get supported PHP versions
73+
id: php-versions
74+
run: |
75+
if [ "${{ steps.major-wp-version.outputs.version }}" != "latest" ] && [ "${{ steps.major-wp-version.outputs.version }}" != "nightly" ]; then
76+
echo "versions=$(jq -r '.["${{ steps.major-wp-version.outputs.version }}"] | @json' .version-support-php.json)" >> $GITHUB_OUTPUT
77+
else
78+
echo "versions=$(jq -r '.[ (keys[-1]) ] | @json' .version-support-php.json)" >> $GITHUB_OUTPUT
79+
fi
80+
81+
# Look up the major version's specific MySQL support policy when a version is provided.
82+
# Otherwise, use the current MySQL support policy.
83+
- name: Get supported MySQL versions
84+
id: mysql-versions
85+
run: |
86+
if [ "${{ steps.major-wp-version.outputs.version }}" != "latest" ] && [ "${{ steps.major-wp-version.outputs.version }}" != "nightly" ]; then
87+
echo "versions=$(jq -r '.["${{ steps.major-wp-version.outputs.version }}"] | @json' .version-support-mysql.json)" >> $GITHUB_OUTPUT
88+
else
89+
echo "versions=$(jq -r '.[ (keys[-1]) ] | @json' .version-support-mysql.json)" >> $GITHUB_OUTPUT
90+
fi
91+
3392
# Test the WordPress installation process through WP-CLI.
3493
#
3594
# Performs the following steps:
@@ -39,41 +98,59 @@ jobs:
3998
# - Creates a `wp-config.php` file.
4099
# - Installs WordPress.
41100
install-tests-mysql:
42-
name: WP ${{ inputs.wp-version || 'latest' }} / PHP ${{ matrix.php }} / ${{ 'mariadb' == matrix.db-type && 'MariaDB' || 'MySQL' }} ${{ matrix.db-version }}${{ matrix.multisite && ' multisite' || '' }}
101+
name: WP ${{ inputs.wp-version || 'nightly' }} / PHP ${{ matrix.php }} / ${{ 'mariadb' == matrix.db-type && 'MariaDB' || 'MySQL' }} ${{ matrix.db-version }}${{ matrix.multisite && ' multisite' || '' }}
43102
permissions:
44103
contents: read
45-
runs-on: ubuntu-latest
104+
runs-on: ${{ matrix.os }}
46105
timeout-minutes: 10
106+
needs: [ build-matrix ]
47107
strategy:
48108
fail-fast: false
49109
matrix:
50110
os: [ ubuntu-latest ]
51-
php: [ '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3' ]
111+
php: ${{ fromJSON( needs.build-matrix.outputs.php-versions ) }}
52112
db-type: [ 'mysql' ]
53-
db-version: [ '5.7', '8.0' ]
113+
db-version: ${{ fromJSON( needs.build-matrix.outputs.mysql-versions ) }}
54114
multisite: [ false, true ]
115+
memcached: [ false ]
116+
117+
# Exclude some PHP and MySQL versions that cannot currently be tested with Docker containers.
118+
exclude:
119+
- php: '5.2'
120+
- php: '5.3'
121+
- db-version: '5.0'
122+
- db-version: '5.1'
123+
- db-version: '5.5'
55124

56125
services:
57126
database:
58127
image: ${{ matrix.db-type }}:${{ matrix.db-version }}
59128
ports:
60129
- 3306
61-
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"
130+
options: >-
131+
--health-cmd="mysqladmin ping"
132+
--health-interval=30s
133+
--health-timeout=10s
134+
--health-retries=5
135+
-e MYSQL_ROOT_PASSWORD=root
136+
-e MYSQL_DATABASE=test_db
137+
--entrypoint sh ${{ matrix.db-type }}:${{ matrix.db-version }}
138+
-c "exec docker-entrypoint.sh mysqld${{ matrix.db-version != '5.5' && ' --default-authentication-plugin=mysql_native_password"' || '' }}
62139
63140
steps:
64141
- name: Set up PHP ${{ matrix.php }}
65142
uses: shivammathur/setup-php@e6f75134d35752277f093989e72e140eaa222f35 # v2.28.0
66143
with:
67144
php-version: '${{ matrix.php }}'
68145
coverage: none
69-
tools: wp-cli
146+
tools: wp-cli${{ contains( fromJSON('["5.4", "5.5"]'), matrix.php ) && ':2.4.0' || '' }}
70147

71148
- name: Start the database server
72149
run: |
73150
sudo systemctl start ${{ matrix.db-type }}
74151
75152
- name: Download WordPress
76-
run: wp core download ${{ inputs.wp-version && 'latest' != inputs.wp-version && format( '--version={0}', inputs.wp-version ) || '' }}
153+
run: wp core download ${{ inputs.wp-version && format( '--version={0}', inputs.wp-version ) || '--version=nightly' }}
77154

78155
- name: Create wp-config.php file
79156
run: wp config create --dbname=test_db --dbuser=root --dbpass=root --dbhost=127.0.0.1:${{ job.services.database.ports['3306'] }}

.version-support-mysql.json

Lines changed: 188 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,188 @@
1+
{
2+
"6-5": [
3+
"8.2",
4+
"8.0",
5+
"5.7",
6+
"5.6",
7+
"5.5"
8+
],
9+
"6-4": [
10+
"8.0",
11+
"5.7",
12+
"5.6",
13+
"5.5",
14+
"5.1",
15+
"5.0"
16+
],
17+
"6-3": [
18+
"8.0",
19+
"5.7",
20+
"5.6",
21+
"5.5",
22+
"5.1",
23+
"5.0"
24+
],
25+
"6-2": [
26+
"8.0",
27+
"5.7",
28+
"5.6",
29+
"5.5",
30+
"5.1",
31+
"5.0"
32+
],
33+
"6-1": [
34+
"8.0",
35+
"5.7",
36+
"5.6",
37+
"5.5",
38+
"5.1",
39+
"5.0"
40+
],
41+
"6-0": [
42+
"8.0",
43+
"5.7",
44+
"5.6",
45+
"5.5",
46+
"5.1",
47+
"5.0"
48+
],
49+
"5-9": [
50+
"8.0",
51+
"5.7",
52+
"5.6",
53+
"5.5",
54+
"5.1",
55+
"5.0"
56+
],
57+
"5-8": [
58+
"8.0",
59+
"5.7",
60+
"5.6",
61+
"5.5",
62+
"5.1",
63+
"5.0"
64+
],
65+
"5-7": [
66+
"8.0",
67+
"5.7",
68+
"5.6",
69+
"5.5",
70+
"5.1",
71+
"5.0"
72+
],
73+
"5-6": [
74+
"8.0",
75+
"5.7",
76+
"5.6",
77+
"5.5",
78+
"5.1",
79+
"5.0"
80+
],
81+
"5-5": [
82+
"8.0",
83+
"5.7",
84+
"5.6",
85+
"5.5",
86+
"5.1",
87+
"5.0"
88+
],
89+
"5-4": [
90+
"8.0",
91+
"5.7",
92+
"5.6",
93+
"5.5",
94+
"5.1",
95+
"5.0"
96+
],
97+
"5-3": [
98+
"8.0",
99+
"5.7",
100+
"5.6",
101+
"5.5",
102+
"5.1",
103+
"5.0"
104+
],
105+
"5-2": [
106+
"8.0",
107+
"5.7",
108+
"5.6",
109+
"5.5",
110+
"5.1",
111+
"5.0"
112+
],
113+
"5-1": [
114+
"5.7",
115+
"5.6",
116+
"5.5"
117+
],
118+
"5-0": [
119+
"5.7",
120+
"5.6",
121+
"5.5",
122+
"5.1",
123+
"5.0"
124+
],
125+
"4-9": [
126+
"5.7",
127+
"5.6",
128+
"5.5",
129+
"5.1",
130+
"5.0"
131+
],
132+
"4-8": [
133+
"5.7",
134+
"5.6",
135+
"5.5",
136+
"5.1",
137+
"5.0"
138+
],
139+
"4-7": [
140+
"5.7",
141+
"5.6",
142+
"5.5",
143+
"5.1",
144+
"5.0"
145+
],
146+
"4-6": [
147+
"5.7",
148+
"5.6",
149+
"5.5",
150+
"5.1",
151+
"5.0"
152+
],
153+
"4-5": [
154+
"5.7",
155+
"5.6",
156+
"5.5",
157+
"5.1",
158+
"5.0"
159+
],
160+
"4-4": [
161+
"5.7",
162+
"5.6",
163+
"5.5",
164+
"5.1",
165+
"5.0"
166+
],
167+
"4-3": [
168+
"5.7",
169+
"5.6",
170+
"5.5",
171+
"5.1",
172+
"5.0"
173+
],
174+
"4-2": [
175+
"5.7",
176+
"5.6",
177+
"5.5",
178+
"5.1",
179+
"5.0"
180+
],
181+
"4-1": [
182+
"5.7",
183+
"5.6",
184+
"5.5",
185+
"5.1",
186+
"5.0"
187+
]
188+
}

0 commit comments

Comments
 (0)