Skip to content

Commit 171e0ff

Browse files
authored
Merge pull request #353 from iMattPro/updates
Update test suite and add code coverage
2 parents a1e9a2f + 1848b2e commit 171e0ff

2 files changed

Lines changed: 50 additions & 19 deletions

File tree

.github/codecov.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
fixes:
2+
- "/phpBB3/phpBB/ext/phpbb/boardrules/::"

.github/workflows/tests.yml

Lines changed: 48 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -93,26 +93,26 @@ jobs:
9393
strategy:
9494
matrix:
9595
include:
96-
- php: '7.1'
96+
- php: '7.2'
9797
db: "mariadb:10.1"
98-
- php: '7.1'
98+
- php: '7.2'
9999
db: "mariadb:10.2"
100-
- php: '7.1'
100+
- php: '7.2'
101101
db: "mariadb:10.3"
102-
- php: '7.1'
102+
- php: '7.2'
103103
db: "mariadb:10.4"
104-
- php: '7.1'
104+
- php: '7.2'
105105
db: "mariadb:10.5"
106-
- php: '7.1'
106+
- php: '7.2'
107107
db: "mysql:5.6"
108108
db_alias: "MyISAM Tests"
109109
MYISAM: 1
110-
- php: '7.1'
110+
- php: '7.2'
111111
db: "mysql:5.6"
112-
- php: '7.1'
113-
db: "mysql:5.7"
114112
- php: '7.2'
115113
db: "mysql:5.7"
114+
COVERAGE: 1
115+
db_alias: "mysql:5.7 with Coverage"
116116
- php: '7.3'
117117
db: "mysql:5.7"
118118
- php: '7.4'
@@ -173,12 +173,21 @@ jobs:
173173
echo "db=$db" >> $GITHUB_OUTPUT
174174
175175
- name: Setup PHP
176+
if: ${{ matrix.COVERAGE != 1 }}
176177
uses: shivammathur/setup-php@v2
177178
with:
178179
php-version: ${{ matrix.php }}
179180
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, mysqli, sqlite, pdo_sqlite, intl, gd, exif, iconv, sqlsrv, pdo_sqlsrv, ldap
180181
coverage: none
181182

183+
- name: Setup PHP with Coverage
184+
if: ${{ matrix.COVERAGE == 1 }}
185+
uses: shivammathur/setup-php@v2
186+
with:
187+
php-version: ${{ matrix.php }}
188+
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, mysqli, sqlite, pdo_sqlite, intl, gd, exif, iconv, sqlsrv, pdo_sqlsrv, ldap
189+
coverage: xdebug
190+
182191
- name: Setup environment for phpBB
183192
env:
184193
DB: ${{steps.database-type.outputs.db}}
@@ -195,14 +204,36 @@ jobs:
195204
working-directory: ./phpBB3
196205

197206
- name: Setup PHPUnit files
198-
run: mkdir -p phpBB/ext/$EXTNAME/.github && cp .github/phpunit* $_
207+
env:
208+
DB: ${{steps.database-type.outputs.db}}
209+
COVERAGE: ${{ matrix.COVERAGE != 1 && '0' || '1' }}
210+
run: |
211+
if [ $COVERAGE == '1' ]
212+
then
213+
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
214+
else
215+
mkdir -p phpBB/ext/$EXTNAME/.github && cp .github/phpunit* $_
216+
fi
199217
working-directory: ./phpBB3
200218

201219
- name: Run unit tests
202220
env:
203221
DB: ${{steps.database-type.outputs.db}}
204-
run: phpBB/vendor/bin/phpunit --configuration phpBB/ext/$EXTNAME/.github/phpunit-$DB-github.xml --bootstrap ./tests/bootstrap.php
222+
COVERAGE: ${{ matrix.COVERAGE != 1 && '0' || '1' }}
223+
run: |
224+
if [ $COVERAGE == '1' ]
225+
then
226+
phpBB/vendor/bin/phpunit --configuration phpBB/ext/$EXTNAME/.github/phpunit-$DB-github.xml --bootstrap ./tests/bootstrap.php --coverage-clover build/logs/clover.xml
227+
else
228+
phpBB/vendor/bin/phpunit --configuration phpBB/ext/$EXTNAME/.github/phpunit-$DB-github.xml --bootstrap ./tests/bootstrap.php
229+
fi
205230
working-directory: ./phpBB3
231+
232+
- name: Send code coverage
233+
if: ${{ matrix.COVERAGE == 1 }}
234+
uses: codecov/codecov-action@v3
235+
with:
236+
files: ./phpBB3/build/logs/clover.xml
206237
# END MySQL and MariaDB Job
207238

208239
# START PostgreSQL Job
@@ -211,18 +242,16 @@ jobs:
211242
strategy:
212243
matrix:
213244
include:
214-
- php: '7.1'
245+
- php: '7.2'
215246
db: "postgres:9.5"
216-
- php: '7.1'
247+
- php: '7.2'
217248
db: "postgres:9.6"
218-
- php: '7.1'
249+
- php: '7.2'
219250
db: "postgres:10"
220-
- php: '7.1'
251+
- php: '7.2'
221252
db: "postgres:11"
222-
- php: '7.1'
253+
- php: '7.2'
223254
db: "postgres:12"
224-
- php: '7.1'
225-
db: "postgres:13"
226255
- php: '7.2'
227256
db: "postgres:13"
228257
- php: '7.3'
@@ -325,7 +354,7 @@ jobs:
325354
strategy:
326355
matrix:
327356
include:
328-
- php: '7.1'
357+
- php: '7.2'
329358
db: "sqlite3"
330359
- php: '7.2'
331360
db: "mcr.microsoft.com/mssql/server:2017-latest"

0 commit comments

Comments
 (0)