Skip to content

Commit 6491641

Browse files
authored
Make codecov an option
1 parent 1958e21 commit 6491641

1 file changed

Lines changed: 19 additions & 23 deletions

File tree

.github/workflows/tests.yml

Lines changed: 19 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,21 @@ on:
1818
EXECUTABLE_FILES:
1919
required: true
2020
type: string
21+
CODECOV:
22+
required: false
23+
default: '0'
24+
type: string
2125
PHPBB_BRANCH:
2226
required: true
2327
type: string
2428

2529
env:
2630
EXTNAME: ${{ inputs.EXTNAME }}
27-
SNIFF: ${{ inputs.SNIFF }}
28-
IMAGE_ICC: ${{ inputs.IMAGE_ICC }}
29-
EPV: ${{ inputs.EPV }}
30-
EXECUTABLE_FILES: ${{ inputs.EXECUTABLE_FILES }}
31+
SNIFF: ${{ inputs.SNIFF == '1' && '1' || '0' }}
32+
IMAGE_ICC: ${{ inputs.IMAGE_ICC == '1' && '1' || '0' }}
33+
EPV: ${{ inputs.EPV == '1' && '1' || '0' }}
34+
EXECUTABLE_FILES: ${{ inputs.EXECUTABLE_FILES == '1' && '1' || '0' }}
35+
CODECOV: ${{ inputs.CODECOV == '1' && '1' || '0' }}
3136
PHPBB_BRANCH: ${{ inputs.PHPBB_BRANCH }}
3237

3338
jobs:
@@ -72,29 +77,29 @@ jobs:
7277
working-directory: ./phpBB3
7378

7479
- name: Setup EPV
75-
if: ${{ env.EPV != 0 }}
80+
if: ${{ env.EPV != '0' }}
7681
run: composer require phpbb/epv:dev-master --dev --no-interaction --ignore-platform-reqs
7782
working-directory: ./phpBB3/phpBB
7883

7984
- name: Run code sniffer
80-
if: ${{ env.SNIFF != 0 }}
85+
if: ${{ env.SNIFF != '0' }}
8186
env:
8287
NOTESTS: '1'
8388
run: .github/ext-sniff.sh $EXTNAME $NOTESTS
8489
working-directory: ./phpBB3
8590

8691
- name: Check image ICC profiles
87-
if: ${{ env.IMAGE_ICC != 0 }}
92+
if: ${{ env.IMAGE_ICC != '0' }}
8893
run: .github/check-image-icc-profiles.sh
8994
working-directory: ./phpBB3
9095

9196
- name: Check executable files
92-
if: ${{ env.EXECUTABLE_FILES != 0 }}
97+
if: ${{ env.EXECUTABLE_FILES != '0' }}
9398
run: .github/ext-check-executable-files.sh ./ $EXTNAME
9499
working-directory: ./phpBB3
95100

96101
- name: Run EPV
97-
if: ${{ env.EPV != 0 }}
102+
if: ${{ env.EPV != '0' }}
98103
run: phpBB/vendor/bin/EPV.php run --dir="phpBB/ext/$EXTNAME/"
99104
working-directory: ./phpBB3
100105
# END Basic Checks Job
@@ -189,20 +194,11 @@ jobs:
189194
echo "db=$db" >> $GITHUB_OUTPUT
190195
191196
- name: Setup PHP
192-
if: ${{ matrix.COVERAGE != 1 }}
193-
uses: shivammathur/setup-php@v2
194-
with:
195-
php-version: ${{ matrix.php }}
196-
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, mysqli, sqlite, pdo_sqlite, intl, gd, exif, iconv, sqlsrv, pdo_sqlsrv, ldap
197-
coverage: none
198-
199-
- name: Setup PHP with Coverage
200-
if: ${{ matrix.COVERAGE == 1 }}
201197
uses: shivammathur/setup-php@v2
202198
with:
203199
php-version: ${{ matrix.php }}
204200
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, mysqli, sqlite, pdo_sqlite, intl, gd, exif, iconv, sqlsrv, pdo_sqlsrv, ldap
205-
coverage: xdebug
201+
coverage: ${{ matrix.COVERAGE == 1 && env.CODECOV == '1' && 'xdebug' || 'none' }}
206202

207203
- name: Setup environment for phpBB
208204
env:
@@ -222,7 +218,7 @@ jobs:
222218
- name: Setup PHPUnit files
223219
env:
224220
DB: ${{steps.database-type.outputs.db}}
225-
COVERAGE: ${{ matrix.COVERAGE != 1 && '0' || '1' }}
221+
COVERAGE: ${{ matrix.COVERAGE == 1 && env.CODECOV == '1' }}
226222
run: |
227223
if [ $COVERAGE == '1' ]
228224
then
@@ -235,18 +231,18 @@ jobs:
235231
- name: Run unit tests
236232
env:
237233
DB: ${{steps.database-type.outputs.db}}
238-
COVERAGE: ${{ matrix.COVERAGE != 1 && '0' || '1' }}
234+
COVERAGE: ${{ matrix.COVERAGE == 1 && env.CODECOV == '1' }}
239235
run: |
240236
if [ $COVERAGE == '1' ]
241237
then
242-
phpBB/vendor/bin/phpunit --configuration phpBB/ext/$EXTNAME/.github/phpunit-$DB-github.xml --bootstrap ./tests/bootstrap.php --coverage-clover build/logs/clover.xml --testsuite 'phpBB Test Suite'
238+
phpBB/vendor/bin/phpunit --configuration phpBB/ext/$EXTNAME/.github/phpunit-$DB-github.xml --bootstrap ./tests/bootstrap.php --coverage-clover build/logs/clover.xml
243239
else
244240
phpBB/vendor/bin/phpunit --configuration phpBB/ext/$EXTNAME/.github/phpunit-$DB-github.xml --bootstrap ./tests/bootstrap.php
245241
fi
246242
working-directory: ./phpBB3
247243

248244
- name: Send code coverage
249-
if: ${{ matrix.COVERAGE == 1 }}
245+
if: ${{ matrix.COVERAGE == 1 && env.CODECOV == '1' }}
250246
uses: codecov/codecov-action@v3
251247
with:
252248
files: ./phpBB3/build/logs/clover.xml

0 commit comments

Comments
 (0)