-
Notifications
You must be signed in to change notification settings - Fork 11
331 lines (314 loc) · 10 KB
/
testing.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
name: Testing
on:
workflow_dispatch:
push:
branches:
- main
- master
pull_request:
schedule:
- cron: '0 0 * * *' # Run every day at midnight.
jobs:
functional: #----------------------------------------------------------------------
name: ${{ matrix.test-package }} (Phar ${{ matrix.use-phar }} / WP ${{ matrix.wp }} / PHP ${{ matrix.php }})
strategy:
fail-fast: false
matrix:
php: ['7.0', '8.1']
wp: ['latest']
mysql: ['8.0']
use-phar: [true]
test-package:
- wp-cli-bundle
- wp-cli
- cache-command
- checksum-command
- config-command
- core-command
- cron-command
- db-command
- embed-command
- entity-command
- eval-command
- export-command
- extension-command
- i18n-command
- import-command
- language-command
- maintenance-mode-command
- media-command
- package-command
- rewrite-command
- role-command
- scaffold-command
- search-replace-command
- server-command
- shell-command
- super-admin-command
- widget-command
include:
- php: '7.0'
wp: 'latest'
mysql: '8.0'
use-phar: true
test-package: 'wp-cli-bundle'
- php: '7.1'
wp: 'latest'
mysql: '8.0'
use-phar: true
test-package: 'wp-cli-bundle'
- php: '7.2'
wp: 'latest'
mysql: '8.0'
use-phar: true
test-package: 'wp-cli-bundle'
- php: '7.3'
wp: 'latest'
mysql: '8.0'
use-phar: true
test-package: 'wp-cli-bundle'
- php: '7.4'
wp: 'latest'
mysql: '8.0'
use-phar: true
test-package: 'wp-cli-bundle'
- php: '7.2'
wp: 'trunk'
mysql: '8.0'
use-phar: true
test-package: 'wp-cli-bundle'
- php: '7.3'
wp: 'trunk'
mysql: '8.0'
use-phar: true
test-package: 'wp-cli-bundle'
- php: '7.4'
wp: 'trunk'
mysql: '8.0'
use-phar: true
test-package: 'wp-cli-bundle'
- php: '8.0'
wp: 'trunk'
mysql: '8.0'
use-phar: true
test-package: 'wp-cli-bundle'
- php: '8.1'
wp: 'trunk'
mysql: '8.0'
use-phar: true
test-package: 'wp-cli-bundle'
- php: '8.1'
wp: 'trunk'
mysql: '8.0'
use-phar: false
test-package: wp-cli-bundle
- php: '8.1'
wp: 'trunk'
mysql: '8.0'
use-phar: false
test-package: wp-cli
- php: '8.1'
wp: 'trunk'
mysql: '8.0'
use-phar: false
test-package: cache-command
# Checksums are not available for trunk versions of Core.
# - php: '8.0'
# wp: 'trunk'
# mysql: '8.0'
# use-phar: false
# test-package: checksum-command
- php: '8.1'
wp: 'trunk'
mysql: '8.0'
use-phar: false
test-package: config-command
- php: '8.1'
wp: 'trunk'
mysql: '8.0'
use-phar: false
test-package: core-command
- php: '8.1'
wp: 'trunk'
mysql: '8.0'
use-phar: false
test-package: cron-command
- php: '8.1'
wp: 'trunk'
mysql: '8.0'
use-phar: false
test-package: db-command
- php: '8.1'
wp: 'trunk'
mysql: '8.0'
use-phar: false
test-package: embed-command
- php: '8.1'
wp: 'trunk'
mysql: '8.0'
use-phar: false
test-package: entity-command
- php: '8.1'
wp: 'trunk'
mysql: '8.0'
use-phar: false
test-package: eval-command
- php: '8.1'
wp: 'trunk'
mysql: '8.0'
use-phar: false
test-package: export-command
- php: '8.1'
wp: 'trunk'
mysql: '8.0'
use-phar: false
test-package: extension-command
- php: '8.1'
wp: 'trunk'
mysql: '8.0'
use-phar: false
test-package: i18n-command
- php: '8.1'
wp: 'trunk'
mysql: '8.0'
use-phar: false
test-package: import-command
- php: '8.1'
wp: 'trunk'
mysql: '8.0'
use-phar: false
test-package: language-command
- php: '8.1'
wp: 'trunk'
mysql: '8.0'
use-phar: false
test-package: maintenance-mode-command
- php: '8.1'
wp: 'trunk'
mysql: '8.0'
use-phar: false
test-package: media-command
- php: '8.1'
wp: 'trunk'
mysql: '8.0'
use-phar: false
test-package: package-command
- php: '8.1'
wp: 'trunk'
mysql: '8.0'
use-phar: false
test-package: rewrite-command
- php: '8.1'
wp: 'trunk'
mysql: '8.0'
use-phar: false
test-package: role-command
- php: '8.1'
wp: 'trunk'
mysql: '8.0'
use-phar: false
test-package: scaffold-command
- php: '8.1'
wp: 'trunk'
mysql: '8.0'
use-phar: false
test-package: search-replace-command
- php: '8.1'
wp: 'trunk'
mysql: '8.0'
use-phar: false
test-package: server-command
- php: '8.1'
wp: 'trunk'
mysql: '8.0'
use-phar: false
test-package: shell-command
- php: '8.1'
wp: 'trunk'
mysql: '8.0'
use-phar: false
test-package: super-admin-command
- php: '8.1'
wp: 'trunk'
mysql: '8.0'
use-phar: false
test-package: widget-command
runs-on: ubuntu-20.04
services:
mysql:
image: mysql:${{ matrix.mysql }}
ports:
- 3306
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"
steps:
- name: Check out source code
uses: actions/checkout@v4
- name: Check existence of composer.json & behat.yml files
id: check_files
uses: andstor/file-existence-action@v3
with:
files: "composer.json, behat.yml"
- name: Install Ghostscript
if: steps.check_files.outputs.files_exists == 'true'
run: |
sudo apt-get update
sudo apt-get install ghostscript -y
- name: Set up PHP envirnoment
if: steps.check_files.outputs.files_exists == 'true'
uses: shivammathur/setup-php@v2
with:
php-version: '${{ matrix.php }}'
extensions: gd, imagick, mysql, zip
coverage: none
tools: composer
- name: Install Composer dependencies & cache dependencies
if: steps.check_files.outputs.files_exists == 'true'
uses: "ramsey/composer-install@v3"
env:
COMPOSER_ROOT_VERSION: dev-${{ github.event.repository.default_branch }}
- name: Change ImageMagick policy to allow pdf->png conversion.
if: steps.check_files.outputs.files_exists == 'true'
run: |
sudo sed -i 's/^.*policy.*coder.*none.*PDF.*//' /etc/ImageMagick-6/policy.xml
- name: Setup MySQL Server
id: setup-mysql
if: ${{ matrix.dbtype != 'sqlite' }}
uses: shogo82148/actions-setup-mysql@v1
with:
mysql-version: ${{ matrix.mysql }}
auto-start: true
root-password: root
user: wp_cli_test
password: password1
my-cnf: |
default_authentication_plugin=mysql_native_password
- name: Configure DB environment
if: ${{ matrix.dbtype != 'sqlite' }}
run: |
echo "MYSQL_HOST=127.0.0.1" >> $GITHUB_ENV
echo "MYSQL_TCP_PORT=3306" >> $GITHUB_ENV
echo "WP_CLI_TEST_DBROOTUSER=root" >> $GITHUB_ENV
echo "WP_CLI_TEST_DBROOTPASS=root" >> $GITHUB_ENV
echo "WP_CLI_TEST_DBNAME=wp_cli_test" >> $GITHUB_ENV
echo "WP_CLI_TEST_DBUSER=wp_cli_test" >> $GITHUB_ENV
echo "WP_CLI_TEST_DBPASS=password1" >> $GITHUB_ENV
echo "WP_CLI_TEST_DBHOST=127.0.0.1:3306" >> $GITHUB_ENV
- name: Prepare test database
if: steps.check_files.outputs.files_exists == 'true'
run: composer prepare-tests
- name: Conditionally use Phar instead of source
if: steps.check_files.outputs.files_exists == 'true' && matrix.use-phar == true
run: echo "TEST_PHAR=nightly" >> $GITHUB_ENV
- name: Check Behat environment
if: steps.check_files.outputs.files_exists == 'true'
env:
WP_VERSION: '${{ matrix.wp }}'
WP_CLI_TEST_DBSOCKET: '${{ steps.setup-mysql.outputs.base-dir }}/tmp/mysql.sock'
run: WP_CLI_TEST_DEBUG_BEHAT_ENV=1 composer behat
- name: Run Behat
if: steps.check_files.outputs.files_exists == 'true'
env:
WP_VERSION: '${{ matrix.wp }}'
TEST_PACKAGE: 'wp-cli/${{ matrix.test-package }}'
WP_CLI_TEST_DBSOCKET: '${{ steps.setup-mysql.outputs.base-dir }}/tmp/mysql.sock'
run: composer test