Skip to content

Commit 9395d76

Browse files
committed
Code coverage in GitHub Actions
1 parent 29be3a2 commit 9395d76

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

.github/workflows/build.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,42 @@ jobs:
123123
- name: "Tests"
124124
run: "vendor/bin/phing tests"
125125

126+
tests-code-coverage:
127+
name: "Tests with code coverage"
128+
129+
runs-on: "ubuntu-latest"
130+
131+
steps:
132+
- name: "Checkout"
133+
uses: "actions/[email protected]"
134+
135+
- name: "Install PHP"
136+
uses: "shivammathur/[email protected]"
137+
with:
138+
coverage: "pcov"
139+
php-version: "7.4"
140+
141+
- name: "Cache dependencies"
142+
uses: "actions/[email protected]"
143+
with:
144+
path: "~/.composer/cache"
145+
key: "php-${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.json') }}"
146+
restore-keys: "php-${{ matrix.php-version }}-composer-"
147+
148+
- name: "Install dependencies"
149+
run: "composer update --no-interaction --no-progress --no-suggest"
150+
151+
- name: "Tests"
152+
run: |
153+
composer require pcov/clobber --dev && \
154+
vendor/bin/pcov clobber && \
155+
php -dpcov.enabled=1 -dpcov.directory=. -dpcov.exclude="~vendor~" vendor/bin/phpunit -c tests/phpunit.xml tests
156+
157+
- name: "Codecov.io"
158+
env:
159+
CODECOV_TOKEN: "${{ secrets.CODECOV_TOKEN }}"
160+
run: "bash <(curl -s https://codecov.io/bash) -f tests/tmp/clover.xml"
161+
126162
tests-windows:
127163
name: "Tests on Windows"
128164

0 commit comments

Comments
 (0)