Skip to content

Commit

Permalink
Code coverage in GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Feb 27, 2020
1 parent 29be3a2 commit 0786c63
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/build.yml
Expand Up @@ -123,6 +123,42 @@ jobs:
- name: "Tests"
run: "vendor/bin/phing tests"

tests-code-coverage:
name: "Tests with code coverage"

runs-on: "ubuntu-latest"

steps:
- name: "Checkout"
uses: "actions/checkout@v2.0.0"

- name: "Install PHP"
uses: "shivammathur/setup-php@1.8.2"
with:
coverage: "pcov"
php-version: "7.4"

- name: "Cache dependencies"
uses: "actions/cache@v1.1.2"
with:
path: "~/.composer/cache"
key: "php-${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.json') }}"
restore-keys: "php-${{ matrix.php-version }}-composer-"

- name: "Install dependencies"
run: "composer update --no-interaction --no-progress --no-suggest"

- name: "Tests"
run: |
composer require pcov/clobber --dev && \
vendor/bin/pcov clobber && \
php -dpcov.enabled=1 -dpcov.directory=. -dpcov.exclude="~vendor~" vendor/bin/phpunit -c tests/phpunit.xml tests
- name: "Codecov.io"
env:
CODECOV_TOKEN: "${{ secrets.CODECOV_TOKEN }}"
run: "bash <(curl -s https://codecov.io/bash) -f tests/tmp/clover.xml"

tests-windows:
name: "Tests on Windows"

Expand Down

0 comments on commit 0786c63

Please sign in to comment.