Skip to content

Commit e11f8e0

Browse files
committed
Add Clover XML coverage report for code coverage tracking
This commit adds a `clover.xml` file that contains detailed code coverage metrics, including classes, methods, and statements covered in the project. It will serve as a reference for coverage analysis, enabling better tracking of testing efforts and maintaining code quality.
1 parent f84d04e commit e11f8e0

File tree

4 files changed

+1432
-0
lines changed

4 files changed

+1432
-0
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: PhpUnit Coverage Percentage Badge
2+
on:
3+
push:
4+
branches:
5+
- main
6+
7+
jobs:
8+
build:
9+
10+
runs-on: ubuntu-latest
11+
if: "!contains(github.event.head_commit.message, '[ci]')"
12+
13+
strategy:
14+
matrix:
15+
operating-system: [ubuntu-latest]
16+
php-versions: [ '8.4' ]
17+
18+
name: P${{ matrix.php-versions }} - L${{ matrix.laravel }} - ${{ matrix.operating-system}}
19+
20+
steps:
21+
- uses: actions/checkout@v2
22+
23+
- name: Install PHP versions
24+
uses: shivammathur/setup-php@v2
25+
with:
26+
php-version: ${{ matrix.php-versions }}
27+
coverage: xdebug
28+
29+
- name: Install Dependencies
30+
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
31+
32+
- name: Show dir
33+
run: pwd
34+
35+
- name: PHP Version
36+
run: php --version
37+
38+
# Code quality
39+
40+
- name: Execute tests (Unit and Feature tests) via PestPHP
41+
# Set environment
42+
env:
43+
XDEBUG_MODE: coverage
44+
run: vendor/bin/phpunit --coverage-clover --testsuite=ci clover.xml
45+
46+
- name: Generate test coverage badge
47+
uses: timkrase/phpunit-coverage-badge@v1.2.1
48+
with:
49+
coverage_badge_path: 'badge-coverage.svg'
50+
push_badge: true
51+
repo_token: ${{ secrets.GITHUB_TOKEN }}

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
![GitHub License](https://img.shields.io/github/license/nuxtifyts/php-dto?style=for-the-badge)
44
![Packagist Version](https://img.shields.io/packagist/v/nuxtifyts/php-dto?style=for-the-badge)
55
![PhpStan Level](https://img.shields.io/badge/PHPStan-level%2010-brightgreen.svg?style=for-the-badge)
6+
[![Test Coverage](https://raw.githubusercontent.com/nuxtifyts/php-dto/main/badge-coverage.svg)](https://packagist.org/packages/nuxtifyts/phpdto)
67

78
This package enabled the creation of data objects which can be used in various ways.
89
Using modern PHP syntax, it allows you to hydrate data from arrays, objects, and other data sources.

0 commit comments

Comments
 (0)