Skip to content

Commit 40de9d1

Browse files
authored
ci: improve coverage report (#6085)
* test: remove nullable return type as it can't happen * ci: uploads individual component coverage reports
1 parent 28ff0ac commit 40de9d1

File tree

3 files changed

+35
-2
lines changed

3 files changed

+35
-2
lines changed

.github/workflows/ci.yml

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,13 @@ jobs:
204204
- GraphQl
205205
- Serializer
206206
- Symfony
207+
include:
208+
- php: '8.1'
209+
coverage: true
210+
- php: '8.2'
211+
coverage: true
212+
- php: '8.3'
213+
coverage: true
207214
fail-fast: false
208215
steps:
209216
- name: Checkout
@@ -219,7 +226,32 @@ jobs:
219226
working-directory: src/${{ matrix.component }}
220227
run: |
221228
composer update
222-
vendor/bin/simple-phpunit
229+
vendor/bin/simple-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 }}-${{ matrix.component }}"
235+
path: 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: build/logs/phpunit
242+
name: "phpunit-php${{ matrix.php }}-${{ matrix.component }}"
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+
run: |
251+
composer global require --prefer-dist --no-interaction --no-progress --ansi php-coveralls/php-coveralls
252+
export PATH="$PATH:$HOME/.composer/vendor/bin"
253+
php-coveralls --coverage_clover "build/logs/phpunit/clover.xml"
254+
continue-on-error: true
223255

224256
behat:
225257
name: Behat (PHP ${{ matrix.php }})

phpunit.xml.dist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
<directory>features</directory>
2929
<directory>tests</directory>
3030
<directory>vendor</directory>
31+
<directory>src/**/Tests/</directory>
3132
<file>.php-cs-fixer.dist.php</file>
3233
</exclude>
3334
</coverage>

tests/State/RespondProcessorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public function testRedirectToOperation(): void
6767
$iriConverter = $this->prophesize(IriConverterInterface::class);
6868
$iriConverter
6969
->getIriFromResource(Argument::cetera())
70-
->will(static function (array $args): ?string {
70+
->will(static function (array $args): string {
7171
return ($args[2] ?? null)?->getUriTemplate() ?? '/default';
7272
});
7373

0 commit comments

Comments
 (0)