Skip to content

Commit a96220c

Browse files
soyukaaegypius
andauthored
ci: merge components coverage (#6108)
* ci: merge components coverage * chore: phpunit bridge assert deprecations * ci: improve coverage report (#6085) * test: remove nullable return type as it can't happen * ci: uploads individual component coverage reports --------- Co-authored-by: Nicolas LAURENT <[email protected]>
1 parent 6120b12 commit a96220c

File tree

3 files changed

+42
-2
lines changed

3 files changed

+42
-2
lines changed

.github/workflows/ci.yml

+37-2
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,14 @@ jobs:
202202
- RamseyUuid
203203
- GraphQl
204204
- Serializer
205+
- Symfony
206+
include:
207+
- php: '8.1'
208+
coverage: true
209+
- php: '8.2'
210+
coverage: true
211+
- php: '8.3'
212+
coverage: true
205213
fail-fast: false
206214
steps:
207215
- name: Checkout
@@ -216,8 +224,35 @@ jobs:
216224
- name: Run ${{ matrix.component }} tests
217225
working-directory: src/${{ matrix.component }}
218226
run: |
219-
composer update
220-
vendor/bin/simple-phpunit
227+
composer update
228+
mkdir -p build/logs/phpunit
229+
vendor/bin/phpunit --log-junit "build/logs/phpunit/junit.xml" ${{ matrix.coverage && '--coverage-clover build/logs/phpunit/clover.xml' || '' }}
230+
- name: Upload test artifacts
231+
if: always()
232+
uses: actions/upload-artifact@v3
233+
with:
234+
name: phpunit-logs-php${{ matrix.php }}
235+
path: src/${{ matrix.component }}/build/logs/phpunit
236+
continue-on-error: true
237+
- name: Upload coverage results to Codecov
238+
if: matrix.coverage
239+
uses: codecov/codecov-action@v3
240+
with:
241+
directory: src/${{ matrix.component }}/build/logs/phpunit
242+
name: phpunit-php${{ matrix.php }}
243+
flags: phpunit
244+
fail_ci_if_error: true
245+
continue-on-error: true
246+
- name: Upload coverage results to Coveralls
247+
if: matrix.coverage
248+
env:
249+
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
250+
working-directory: src/${{ matrix.component }}
251+
run: |
252+
composer global require --prefer-dist --no-interaction --no-progress --ansi php-coveralls/php-coveralls
253+
export PATH="$PATH:$HOME/.composer/vendor/bin"
254+
php-coveralls --coverage_clover=build/logs/phpunit/clover.xml
255+
continue-on-error: true
221256

222257
behat:
223258
name: Behat (PHP ${{ matrix.php }})

phpunit.xml.dist

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
<directory>features</directory>
3030
<directory>tests</directory>
3131
<directory>vendor</directory>
32+
<directory>src/**/Tests/</directory>
3233
<file>.php-cs-fixer.dist.php</file>
3334
</exclude>
3435
</coverage>

src/Metadata/phpunit.xml.dist

+4
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@
1818
</testsuite>
1919
</testsuites>
2020

21+
<listeners>
22+
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener" />
23+
</listeners>
24+
2125
<coverage>
2226
<include>
2327
<directory>./</directory>

0 commit comments

Comments
 (0)