Skip to content

Commit 8823a8e

Browse files
authored
Merge pull request #181 from wp-cli/fix/gha-functional-tests-update
2 parents 2870584 + b2265db commit 8823a8e

6 files changed

Lines changed: 62 additions & 31 deletions

File tree

.github/workflows/testing.yml

Lines changed: 44 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
fail-fast: false
1111
matrix:
1212
php: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0']
13-
runs-on: ubuntu-latest
13+
runs-on: ubuntu-20.04
1414

1515
steps:
1616
- name: Check out source code
@@ -58,35 +58,55 @@ jobs:
5858
run: composer phpunit
5959

6060
functional: #----------------------------------------------------------------------
61-
name: Functional - WP ${{ matrix.wp }} on PHP ${{ matrix.php }}
61+
name: Functional - WP ${{ matrix.wp }} on PHP ${{ matrix.php }} with MySQL ${{ matrix.mysql }}
6262
strategy:
6363
fail-fast: false
6464
matrix:
65-
php: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4']
65+
php: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0']
6666
wp: ['latest']
67+
mysql: ['8.0']
6768
test: ["composer behat || composer behat-rerun"]
6869
include:
6970
- php: '5.6'
7071
wp: 'trunk'
72+
mysql: '8.0'
73+
test: "composer behat || composer behat-rerun"
74+
- php: '5.6'
75+
wp: 'trunk'
76+
mysql: '5.7'
77+
test: "composer behat || composer behat-rerun"
78+
- php: '5.6'
79+
wp: 'trunk'
80+
mysql: '5.6'
7181
test: "composer behat || composer behat-rerun"
7282
- php: '7.4'
7383
wp: 'trunk'
84+
mysql: '8.0'
85+
test: "composer behat || composer behat-rerun"
86+
- php: '8.0'
87+
wp: 'trunk'
88+
mysql: '8.0'
89+
test: "composer behat || composer behat-rerun"
90+
- php: '8.0'
91+
wp: 'trunk'
92+
mysql: '5.7'
93+
test: "composer behat || composer behat-rerun"
94+
- php: '8.0'
95+
wp: 'trunk'
96+
mysql: '5.6'
7497
test: "composer behat || composer behat-rerun"
7598
- php: '5.6'
7699
wp: '3.7'
77-
test: "composer behat || composer behat-rerun || true"
78-
runs-on: ubuntu-latest
100+
mysql: '5.6'
101+
test: "composer behat || composer behat-rerun"
102+
runs-on: ubuntu-20.04
79103

80104
services:
81105
mysql:
82-
image: mysql:5.7
83-
env:
84-
MYSQL_DATABASE: wp_cli_test
85-
MYSQL_USER: root
86-
MYSQL_ROOT_PASSWORD: root
106+
image: mysql:${{ matrix.mysql }}
87107
ports:
88108
- 3306
89-
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
109+
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=wp_cli_test --entrypoint sh mysql:${{ matrix.mysql }} -c "exec docker-entrypoint.sh mysqld --default-authentication-plugin=mysql_native_password"
90110

91111
steps:
92112
- name: Check out source code
@@ -99,6 +119,7 @@ jobs:
99119
files: "composer.json, behat.yml"
100120

101121
- name: Set up PHP envirnoment
122+
if: steps.check_files.outputs.files_exists == 'true'
102123
uses: shivammathur/setup-php@v2
103124
with:
104125
php-version: '${{ matrix.php }}'
@@ -127,20 +148,25 @@ jobs:
127148

128149
- name: Start MySQL server
129150
if: steps.check_files.outputs.files_exists == 'true'
130-
run: sudo service mysql start
151+
run: sudo systemctl start mysql
131152

132-
- name: Prepare test database
153+
- name: Configure DB environment
133154
if: steps.check_files.outputs.files_exists == 'true'
134155
run: |
135-
export MYQSL_HOST=127.0.0.1
156+
export MYSQL_HOST=127.0.0.1
136157
export MYSQL_TCP_PORT=${{ job.services.mysql.ports['3306'] }}
137-
mysql -e 'CREATE DATABASE IF NOT EXISTS wp_cli_test;' -uroot -proot
138-
mysql -e 'GRANT ALL PRIVILEGES ON wp_cli_test.* TO "wp_cli_test"@"127.0.0.1" IDENTIFIED BY "password1"' -uroot -proot
139-
mysql -e 'GRANT ALL PRIVILEGES ON wp_cli_test_scaffold.* TO "wp_cli_test"@"127.0.0.1" IDENTIFIED BY "password1"' -uroot -proot
158+
echo "WP_CLI_TEST_DBROOTUSER=root" >> $GITHUB_ENV
159+
echo "WP_CLI_TEST_DBROOTPASS=root" >> $GITHUB_ENV
160+
echo "WP_CLI_TEST_DBUSER=wp_cli_test" >> $GITHUB_ENV
161+
echo "WP_CLI_TEST_DBPASS=password1" >> $GITHUB_ENV
162+
echo "WP_CLI_TEST_DBHOST=$MYSQL_HOST:$MYSQL_TCP_PORT" >> $GITHUB_ENV
163+
164+
- name: Prepare test database
165+
if: steps.check_files.outputs.files_exists == 'true'
166+
run: composer prepare-tests
140167

141168
- name: Run Behat
142169
if: steps.check_files.outputs.files_exists == 'true'
143170
env:
144171
WP_VERSION: '${{ matrix.wp }}'
145172
run: ${{ matrix.test }}
146-

behat.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
default:
2-
paths:
3-
features: features
4-
bootstrap: vendor/wp-cli/wp-cli-tests/features/bootstrap
2+
suites:
3+
default:
4+
contexts:
5+
- WP_CLI\Tests\Context\FeatureContext
6+
paths:
7+
- features

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@
1313
],
1414
"require": {
1515
"composer/semver": "^1.4 || ^2 || ^3",
16-
"wp-cli/wp-cli": "^2.4"
16+
"wp-cli/wp-cli": "^2.5",
17+
"wp-cli/wp-cli-tests": "^3.0.7"
1718
},
1819
"require-dev": {
1920
"wp-cli/checksum-command": "^1 || ^2",
2021
"wp-cli/db-command": "^1.3 || ^2",
2122
"wp-cli/entity-command": "^1.3 || ^2",
22-
"wp-cli/extension-command": "^1.2 || ^2",
23-
"wp-cli/wp-cli-tests": "^2.1"
23+
"wp-cli/extension-command": "^1.2 || ^2"
2424
},
2525
"config": {
2626
"process-timeout": 7200,

features/core-check-update.feature

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ Feature: Check for more recent versions
5151
"""
5252
And the return code should be 0
5353

54-
When I run `wp core check-update --minor`
54+
# WP core throws notice for PHP 8+.
55+
When I try `wp core check-update --minor`
5556
Then STDOUT should be a table containing rows:
5657
| version | update_type | package_url |
5758
| {WP_VERSION-4.0-latest} | minor | https://downloads.wordpress.org/release/wordpress-{WP_VERSION-4.0-latest}-partial-0.zip |

features/core-update.feature

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ Feature: Update WordPress core
3838
When I run `wp core download --version=3.7.9 --force`
3939
Then STDOUT should not be empty
4040

41-
When I run `wp core update --minor`
41+
# WP core throws notice for PHP 8+.
42+
When I try `wp core update --minor`
4243
Then STDOUT should contain:
4344
"""
4445
Updating to version {WP_VERSION-3.7-latest}
@@ -78,7 +79,7 @@ Feature: Update WordPress core
7879
"""
7980
And STDERR should contain:
8081
"""
81-
Notice: Undefined variable: base
82+
Undefined variable
8283
"""
8384
And the return code should be 0
8485

@@ -276,7 +277,7 @@ Feature: Update WordPress core
276277
Warning: Checksums not available for WordPress {WP_VERSION-4.0-latest}/es_ES. Please cleanup files manually.
277278
"""
278279
And the return code should be 0
279-
280+
280281
@require-php-5.6
281282
Scenario Outline: Use `--version=(nightly|trunk)` to update to the latest nightly version
282283
Given a WP install

features/core.feature

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -312,13 +312,13 @@ Feature: Manage WordPress installation
312312
define('DB_NAME', 'wp_cli_test');
313313
314314
/** MySQL database username */
315-
define('DB_USER', 'wp_cli_test');
315+
define('DB_USER', '{DB_USER}');
316316
317317
/** MySQL database password */
318-
define('DB_PASSWORD', 'password1');
318+
define('DB_PASSWORD', '{DB_PASSWORD}');
319319
320320
/** MySQL hostname */
321-
define('DB_HOST', '127.0.0.1');
321+
define('DB_HOST', '{DB_HOST}');
322322
323323
/** Database Charset to use in creating database tables. */
324324
define('DB_CHARSET', 'utf8');

0 commit comments

Comments
 (0)