Skip to content

Commit

Permalink
Merge pull request #880 from Yozhef/codecovCoverage
Browse files Browse the repository at this point in the history
feat(CodeCov) add Codecov phpunit code coverage.
  • Loading branch information
ramunasd committed Feb 18, 2021
2 parents c4ef057 + d74a1fa commit 46d8632
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
22 changes: 21 additions & 1 deletion .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ jobs:
fail-fast: false
max-parallel: 4
matrix:
coverage: ['none']
include:
- php: '7.0'
phpseclib: '^2.0'
Expand All @@ -20,6 +21,7 @@ jobs:
phpseclib: '^3.0'
- php: '7.4'
phpseclib: '^3.0'
coverage: 'xdebug'
services:
rabbitmq:
image: rabbitmq:3-management
Expand All @@ -40,21 +42,39 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: composer:v1
extensions: bcmath, curl, dom, mbstring, pcntl, sockets, xml
coverage: none
coverage: ${{ matrix.coverage }}

- name: Check PHP info
run: php tests/phpinfo.php

- name: Start broker service
run: docker start ${{ job.services.rabbitmq.id }}

- name: Composer install
run: composer require --prefer-dist --no-progress --no-suggest phpseclib/phpseclib ${{ matrix.phpseclib }}

- name: Wait for broker service
run: php ./tests/wait_broker.php

- name: PHPUnit tests
run: ./vendor/bin/phpunit --exclude-group proxy
if: matrix.coverage == 'none'

- name: PHPUnit tests and Log Code coverage
run: ./vendor/bin/phpunit --exclude-group proxy --coverage-clover=coverage.xml
if: matrix.coverage == 'xdebug'

- name: Run codecov
uses: codecov/codecov-action@v1
if: matrix.coverage == 'xdebug'
with:
file: './coverage.xml'
fail_ci_if_error: true

3 changes: 3 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
<directory suffix="Test.php" phpVersionOperator=">=">tests/Functional</directory>
</testsuite>
</testsuites>
<logging>
<log type="coverage-clover" target="clover.xml"/>
</logging>
<filter>
<whitelist>
<directory suffix=".php">PhpAmqpLib/</directory>
Expand Down

0 comments on commit 46d8632

Please sign in to comment.