-
Notifications
You must be signed in to change notification settings - Fork 14
457 lines (406 loc) · 17.2 KB
/
tests.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
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
name: Tests
env:
EXTNAME: phpbb/skeleton # Your extension vendor/package name
SNIFF: 1 # Run code sniffer on your code? 1 or 0
IMAGE_ICC: 1 # Run icc profile sniffer on your images? 1 or 0
EPV: 1 # Run EPV (Extension Pre Validator) on your code? 1 or 0
EXECUTABLE_FILES: 1 # Run check for executable files? 1 or 0
PHPBB_BRANCH: 3.3.x # The phpBB branch to run tests on
on:
push:
branches: # Run tests when commits are pushed to these branches in your repo
- master
- develop
pull_request: # Run tests when pull requests are made on these branches in your repo
branches:
- master
- develop
jobs:
# START Basic Checks Job (EPV, code sniffer, images check, etc.)
basic-checks:
runs-on: ubuntu-22.04
strategy:
matrix:
include:
- php: '7.2'
db: "none"
NOTESTS: 1
name: PHP ${{ matrix.php }} - ${{ matrix.db }}
steps:
- name: Checkout phpBB
uses: actions/checkout@v4
with:
repository: phpbb/phpbb
ref: ${{ env.PHPBB_BRANCH }}
path: phpBB3
- name: Checkout extension
uses: actions/checkout@v4
with:
path: phpBB3/phpBB/ext/${{ env.EXTNAME }}
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, mysqli, sqlite, pdo_sqlite, intl, gd, exif, iconv, sqlsrv, pdo_sqlsrv, ldap
coverage: none
- name: Setup environment for phpBB
env:
DB: ${{ matrix.db }}
PHP_VERSION: ${{ matrix.php }}
NOTESTS: '1'
run: .github/setup-phpbb.sh $DB $PHP_VERSION $NOTESTS
working-directory: ./phpBB3
- name: Setup EPV
if: ${{ env.EPV != 0 }}
run: composer require phpbb/epv:dev-master --dev --no-interaction --ignore-platform-reqs
working-directory: ./phpBB3/phpBB
- name: Run code sniffer
if: ${{ env.SNIFF != 0 }}
env:
NOTESTS: '1'
run: .github/ext-sniff.sh $EXTNAME $NOTESTS
working-directory: ./phpBB3
- name: Check image ICC profiles
if: ${{ env.IMAGE_ICC != 0 }}
run: .github/check-image-icc-profiles.sh
working-directory: ./phpBB3
- name: Check executable files
if: ${{ env.EXECUTABLE_FILES != 0 }}
run: .github/ext-check-executable-files.sh ./ $EXTNAME
working-directory: ./phpBB3
- name: Run EPV
if: ${{ env.EPV != 0 }}
run: phpBB/vendor/bin/EPV.php run --dir="phpBB/ext/$EXTNAME/"
working-directory: ./phpBB3
# END Basic Checks Job
# START MySQL and MariaDB Job
mysql-tests:
runs-on: ubuntu-22.04
strategy:
matrix:
include:
- php: '7.2'
db: "mariadb:10.1"
- php: '7.2'
db: "mariadb:10.2"
- php: '7.2'
db: "mariadb:10.3"
- php: '7.2'
db: "mariadb:10.4"
- php: '7.2'
db: "mariadb:10.5"
- php: '7.2'
db: "mysql:5.6"
db_alias: "MyISAM Tests"
MYISAM: 1
- php: '7.2'
db: "mysql:5.6"
- php: '7.2'
db: "mysql:5.7"
COVERAGE: 1
db_alias: "mysql:5.7 with Coverage"
- php: '7.3'
db: "mysql:5.7"
- php: '7.4'
db: "mysql:5.7"
- php: '7.4'
db: "mysql:8.0"
- php: '8.0'
db: "mysql:5.7"
- php: '8.1'
db: "mysql:5.7"
- php: '8.2'
db: "mysql:5.7"
- php: '8.3'
db: "mysql:5.7"
- php: '8.4'
db: "mysql:5.7"
name: PHP ${{ matrix.php }} - ${{ matrix.db_alias != '' && matrix.db_alias || matrix.db }}
services:
mysql:
image: ${{ matrix.db }}
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: phpbb_tests
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3
redis:
image: redis
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379
steps:
- name: Checkout phpBB
uses: actions/checkout@v4
with:
repository: phpbb/phpbb
ref: ${{ env.PHPBB_BRANCH }}
path: phpBB3
- name: Checkout extension
uses: actions/checkout@v4
with:
path: phpBB3/phpBB/ext/${{ env.EXTNAME }}
- id: database-type
env:
MATRIX_DB: ${{ matrix.db }}
run: |
db=$(echo "${MATRIX_DB%%:*}")
echo "db=$db" >> $GITHUB_OUTPUT
- name: Setup PHP
if: ${{ matrix.COVERAGE != 1 }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, mysqli, sqlite, pdo_sqlite, intl, gd, exif, iconv, sqlsrv, pdo_sqlsrv, ldap
coverage: none
- name: Setup PHP with Coverage
if: ${{ matrix.COVERAGE == 1 }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, mysqli, sqlite, pdo_sqlite, intl, gd, exif, iconv, sqlsrv, pdo_sqlsrv, ldap
coverage: xdebug
- name: Setup environment for phpBB
env:
DB: ${{steps.database-type.outputs.db}}
PHP_VERSION: ${{ matrix.php }}
NOTESTS: '0'
run: .github/setup-phpbb.sh $DB $PHP_VERSION ${NOTESTS:-0}
working-directory: ./phpBB3
- name: Setup database
env:
DB: ${{steps.database-type.outputs.db}}
MYISAM: ${{ matrix.MYISAM != 1 && '0' || '1' }}
run: .github/setup-database.sh $DB $MYISAM
working-directory: ./phpBB3
- name: Setup PHPUnit files
env:
DB: ${{steps.database-type.outputs.db}}
COVERAGE: ${{ matrix.COVERAGE != 1 && '0' || '1' }}
run: |
if [ $COVERAGE == '1' ]
then
sed -n '1h;1!H;${;g;s/<\/php>/<\/php>\n\t<filter>\n\t\t<whitelist>\n\t\t\t<directory>..\/<\/directory>\n\t\t\t<exclude>\n\t\t\t\t<directory>..\/tests\/<\/directory>\n\t\t\t\t<directory>..\/language\/<\/directory>\n\t\t\t\t<directory>..\/migrations\/<\/directory>\n\t\t\t<\/exclude>\n\t\t<\/whitelist>\n\t<\/filter>/g;p;}' .github/phpunit-$DB-github.xml &> phpBB/ext/$EXTNAME/.github/phpunit-$DB-github.xml
else
mkdir -p phpBB/ext/$EXTNAME/.github && cp .github/phpunit* $_
fi
working-directory: ./phpBB3
- name: Run unit tests
env:
DB: ${{steps.database-type.outputs.db}}
COVERAGE: ${{ matrix.COVERAGE != 1 && '0' || '1' }}
run: |
if [ $COVERAGE == '1' ]
then
phpBB/vendor/bin/phpunit --configuration phpBB/ext/$EXTNAME/.github/phpunit-$DB-github.xml --bootstrap ./tests/bootstrap.php --coverage-clover build/logs/clover.xml
else
phpBB/vendor/bin/phpunit --configuration phpBB/ext/$EXTNAME/.github/phpunit-$DB-github.xml --bootstrap ./tests/bootstrap.php
fi
working-directory: ./phpBB3
- name: Send code coverage
if: ${{ matrix.COVERAGE == 1 }}
uses: codecov/codecov-action@v3
with:
files: ./phpBB3/build/logs/clover.xml
# END MySQL and MariaDB Job
# START PostgreSQL Job
postgres-tests:
runs-on: ubuntu-22.04
strategy:
matrix:
include:
- php: '7.2'
db: "postgres:9.5"
- php: '7.2'
db: "postgres:9.6"
- php: '7.2'
db: "postgres:10"
- php: '7.2'
db: "postgres:11"
- php: '7.2'
db: "postgres:12"
- php: '7.2'
db: "postgres:13"
- php: '7.3'
db: "postgres:13"
- php: '7.4'
db: "postgres:13"
- php: '8.0'
db: "postgres:12"
- php: '8.0'
db: "postgres:13"
- php: '8.1'
db: "postgres:14"
- php: '8.2'
db: "postgres:14"
- php: '8.3'
db: "postgres:14"
- php: '8.4'
db: "postgres:14"
name: PHP ${{ matrix.php }} - ${{ matrix.db }}
services:
postgres:
image: ${{ matrix.db != 'postgres:9.5' && matrix.db != 'postgres:9.6' && matrix.db != 'postgres:10' && matrix.db != 'postgres:11' && matrix.db != 'postgres:12' && matrix.db != 'postgres:13' && 'postgres:10' || matrix.db }}
env:
POSTGRES_HOST: localhost
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
options: >-
-v /var/run/postgresql:/var/run/postgresql
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: redis
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379
steps:
- name: Checkout phpBB
uses: actions/checkout@v4
with:
repository: phpbb/phpbb
ref: ${{ env.PHPBB_BRANCH }}
path: phpBB3
- name: Checkout extension
uses: actions/checkout@v4
with:
path: phpBB3/phpBB/ext/${{ env.EXTNAME }}
- id: database-type
env:
MATRIX_DB: ${{ matrix.db }}
run: |
db=$(echo "${MATRIX_DB%%:*}")
echo "db=$db" >> $GITHUB_OUTPUT
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, mysqli, sqlite, pdo_sqlite, intl, gd, exif, iconv, sqlsrv, pdo_sqlsrv, ldap
coverage: none
- name: Setup environment for phpBB
env:
DB: ${{steps.database-type.outputs.db}}
PHP_VERSION: ${{ matrix.php }}
NOTESTS: '0'
run: .github/setup-phpbb.sh $DB $PHP_VERSION ${NOTESTS:-0}
working-directory: ./phpBB3
- name: Setup database
env:
DB: ${{steps.database-type.outputs.db}}
MYISAM: '0'
run: .github/setup-database.sh $DB $MYISAM
working-directory: ./phpBB3
- name: Setup PHPUnit files
run: mkdir -p phpBB/ext/$EXTNAME/.github && cp .github/phpunit* $_
working-directory: ./phpBB3
- name: Run unit tests
env:
DB: ${{steps.database-type.outputs.db}}
run: phpBB/vendor/bin/phpunit --configuration phpBB/ext/$EXTNAME/.github/phpunit-$DB-github.xml --bootstrap ./tests/bootstrap.php
working-directory: ./phpBB3
# END PostgreSQL Job
# START Other Tests Job (SQLite 3 and mssql)
other-tests:
runs-on: ubuntu-20.04 # TODO: Change back to 'ubuntu-22.04' when https://github.com/microsoft/mssql-docker/issues/899 resolved.
strategy:
matrix:
include:
- php: '7.2'
db: "sqlite3"
- php: '7.2'
db: "mcr.microsoft.com/mssql/server:2017-latest"
db_alias: 'MSSQL 2017'
- php: '7.2'
db: "mcr.microsoft.com/mssql/server:2019-CU27-ubuntu-20.04"
db_alias: 'MSSQL 2019'
name: PHP ${{ matrix.php }} - ${{ matrix.db_alias != '' && matrix.db_alias || matrix.db }}
services:
mssql:
image: ${{ matrix.db != 'mcr.microsoft.com/mssql/server:2017-latest' && matrix.db != 'mcr.microsoft.com/mssql/server:2019-CU27-ubuntu-20.04' && 'mcr.microsoft.com/mssql/server:2017-latest' || matrix.db }}
env:
SA_PASSWORD: "Pssw0rd_12"
ACCEPT_EULA: "y"
ports:
- 1433:1433
options: >-
--health-cmd="/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P 'Pssw0rd_12' -Q \"Use [master]; CREATE DATABASE [phpbb_tests] COLLATE Latin1_General_CI_AS\" || exit 1"
--health-interval 10s
--health-timeout 5s
--health-retries 5
--health-start-period 10s
redis:
image: redis
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379
steps:
- name: Checkout phpBB
uses: actions/checkout@v4
with:
repository: phpbb/phpbb
ref: ${{ env.PHPBB_BRANCH }}
path: phpBB3
- name: Checkout extension
uses: actions/checkout@v4
with:
path: phpBB3/phpBB/ext/${{ env.EXTNAME }}
- id: database-type
env:
MATRIX_DB: ${{ matrix.db }}
run: |
if [ $MATRIX_DB == 'mcr.microsoft.com/mssql/server:2017-latest' ] || [ $MATRIX_DB == 'mcr.microsoft.com/mssql/server:2019-CU27-ubuntu-20.04' ]
then
db='mssql'
else
db=$(echo "${MATRIX_DB%%:*}")
fi
echo "db=$db" >> $GITHUB_OUTPUT
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, mysqli, sqlite, pdo_sqlite, intl, gd, exif, iconv, sqlsrv, pdo_sqlsrv, ldap
coverage: none
- name: Setup environment for phpBB
env:
DB: ${{steps.database-type.outputs.db}}
PHP_VERSION: ${{ matrix.php }}
NOTESTS: '0'
run: .github/setup-phpbb.sh $DB $PHP_VERSION ${NOTESTS:-0}
working-directory: ./phpBB3
- name: Setup database
env:
DB: ${{steps.database-type.outputs.db}}
MYISAM: '0'
run: .github/setup-database.sh $DB $MYISAM
working-directory: ./phpBB3
- name: Setup PHPUnit files
run: mkdir -p phpBB/ext/$EXTNAME/.github && cp .github/phpunit* $_
working-directory: ./phpBB3
- name: Run unit tests
env:
DB: ${{steps.database-type.outputs.db}}
run: phpBB/vendor/bin/phpunit --configuration phpBB/ext/$EXTNAME/.github/phpunit-$DB-github.xml --bootstrap ./tests/bootstrap.php
working-directory: ./phpBB3
# END Other Tests Job