-
Notifications
You must be signed in to change notification settings - Fork 62
Open
Description
What about implementing a code coverage badge to the README, so that everyone can see how much code is covered by the tests?
Codecov for example provides a Github action, so we could simply generate the coverage report using a Github workflow and upload it to Coverage: https://github.com/marketplace/actions/codecov
But therefore, somebody with enough permissions to this repository is required:
- We need to authorize Codecov to access this repository (I don't have these permissions - already checked)
- We need to add the Codecov secret here: https://github.com/planetteamspeak/ts3phpframework/settings/secrets/actions
Example workflow file:
# .github/workflows/codecov.yml
name: "Codecov"
on:
push:
branches:
- master
- main
- dev
pull_request:
schedule:
- cron: '0 15 * * 2'
jobs:
phpunit-coverage:
strategy:
fail-fast: false
matrix:
php_versions: [
'8.0',
'8.1',
'8.2',
]
name: PHP ${{ matrix.php_versions }}
runs-on: ubuntu-latest
steps:
- name: checkout repository
uses: actions/checkout@v3
- name: install php ${{ matrix.php_versions }} with extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php_versions }}
extensions: json ctype openssl ssh2
coverage: none
tools: none
- name: install dependencies
uses: php-actions/composer@v6
with:
dev: yes
php_version: ${{ matrix.php_versions }}
php_extensions: json ctype openssl ssh2
- name: generate phpunit coverage report
run: ./vendor/bin/phpunit --coverage-clover=coverage.xml
- name: upload coverage report to codecov
uses: codecov/codecov-action@v3
with:
files: ./coverage.xmlAnd in the README something like this:
[](https://codecov.io/gh/planetteamspeak/ts3phpframework)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels