Skip to content

Commit 7d9f234

Browse files
authored
Merge pull request #156 from wp-cli/fix/gha-functional-tests-update
2 parents 4e4bb05 + db5b7cd commit 7d9f234

File tree

3 files changed

+53
-24
lines changed

3 files changed

+53
-24
lines changed

.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
@@ -12,13 +12,13 @@
1212
}
1313
],
1414
"require": {
15-
"wp-cli/wp-cli": "~2.5"
15+
"wp-cli/wp-cli": "^2.5",
16+
"wp-cli/wp-cli-tests": "^3.0.2"
1617
},
1718
"require-dev": {
1819
"wp-cli/db-command": "^1.3 || ^2",
1920
"wp-cli/entity-command": "^1.3 || ^2",
20-
"wp-cli/extension-command": "^1.2 || ^2",
21-
"wp-cli/wp-cli-tests": "^2.1"
21+
"wp-cli/extension-command": "^1.2 || ^2"
2222
},
2323
"config": {
2424
"process-timeout": 7200,

0 commit comments

Comments
 (0)