From e526bc3f9d8b860a8332821f714518ac99120207 Mon Sep 17 00:00:00 2001 From: Mohan Raj Date: Fri, 31 May 2024 15:40:09 +0100 Subject: [PATCH 01/10] add github workflow --- .github/workflows/php.yml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/php.yml diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml new file mode 100644 index 0000000..a23e2cd --- /dev/null +++ b/.github/workflows/php.yml @@ -0,0 +1,31 @@ +name: PHP + +on: [push, pull_request] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.2' + extensions: xdebug + coverage: xdebug + tools: composer:v2 + + - name: Validate composer.json and composer.lock + run: composer validate + + - name: Install dependencies + run: composer install --prefer-dist --no-progress + + - name: Run PHPCS Lint + run: composer lint + + - name: Run PHPUnit tests + run: composer test \ No newline at end of file From b0c9f1072a2bfebb18cfcc6cf0306314775b687e Mon Sep 17 00:00:00 2001 From: Mohan Raj Date: Fri, 31 May 2024 15:42:20 +0100 Subject: [PATCH 02/10] fix unit test dir --- phpunit.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpunit.xml b/phpunit.xml index 09b3621..3e737d4 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -2,7 +2,7 @@ - ./Tests/ + ./tests/ From 8fbdb847e3ec6a7b01ea6543e72a7b5690b9d1e4 Mon Sep 17 00:00:00 2001 From: Mohan Raj Date: Fri, 31 May 2024 15:46:43 +0100 Subject: [PATCH 03/10] add artifacts to github action --- .github/workflows/php.yml | 8 +++++++- composer.json | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index a23e2cd..5bab155 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -28,4 +28,10 @@ jobs: run: composer lint - name: Run PHPUnit tests - run: composer test \ No newline at end of file + run: composer test + + - name: Upload coverage report + uses: actions/upload-artifact@v2 + with: + name: coverage-report + path: coverage/ \ No newline at end of file diff --git a/composer.json b/composer.json index e8eebfa..76868f8 100644 --- a/composer.json +++ b/composer.json @@ -30,6 +30,6 @@ "scripts": { "lint": "phpcs --ignore=/vendor/* --standard=PSR12 .", "lint:fix": "phpcbf --ignore=/vendor/* --standard=PSR12 .", - "test": "phpunit --testdox --coverage-clover coverage/clover.xml --coverage-filter src/" + "test": "phpunit --testdox --coverage-clover coverage/clover.xml --coverage-html coverage --coverage-filter src/" } } From edd4845281d15630360a16365d4a93c3e6b11c45 Mon Sep 17 00:00:00 2001 From: Mohan Raj Date: Fri, 31 May 2024 15:49:19 +0100 Subject: [PATCH 04/10] use v4 actions --- .github/workflows/php.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 5bab155..594da72 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -3,12 +3,12 @@ name: PHP on: [push, pull_request] jobs: - build: + lint-test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 @@ -31,7 +31,7 @@ jobs: run: composer test - name: Upload coverage report - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: coverage-report path: coverage/ \ No newline at end of file From d28618fc99be4b3a0f9b6285a16c891888942189 Mon Sep 17 00:00:00 2001 From: Mohan Raj Date: Fri, 31 May 2024 15:53:31 +0100 Subject: [PATCH 05/10] add code owner --- .github/CODEOWNERS | 1 + 1 file changed, 1 insertion(+) create mode 100644 .github/CODEOWNERS diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..f92a3c8 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +* @m0hanraj \ No newline at end of file From b83e075eff51d65b09af8739e099dbc42c62b129 Mon Sep 17 00:00:00 2001 From: Mohan Raj Date: Fri, 31 May 2024 16:03:27 +0100 Subject: [PATCH 06/10] Update readme --- README.md | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 127dbe7..6214e84 100644 --- a/README.md +++ b/README.md @@ -6,18 +6,19 @@ CoverageBadge is a library for creating an SVG coverage badge from a Clover XML ## Installation -Composer - `composer require codebtech/coveragebadge --dev` ## Features -- Generate coverage badge from PHPUnit Clover XML file -- Generate coverage badge based on multiple Clover XML files, and it merges the coverage percentage automatically -- Can accept coverage name and the badge will be generated with the coverage name - +- Produces a code coverage badge utilizing a Clover coverage XML file +- Creates a code coverage badge from several Clover XML files, automatically incorporating the coverage percentages +- Accepts a coverage name as an input to include in the generated badge ## Usage - -1. Generate [XML Code Coverage](https://docs.phpunit.de/en/11.1/code-coverage.html) and generate [Clover](https://docs.phpunit.de/en/11.1/configuration.html#the-report-element) XML files. -2. Run `vendor/bin/coverage-badge /path/to/clover.xml /path/to/badge/destination.svg test-name` -3. To merge multiple clover files provide the input XML files `comma` separated run `vendor/bin/coverage-badge /path/to/clover.xml,/path/to/clover2.xml /path/to/badge/destination.svg test-name` +- Execute the command to generate badge for single Clover XML input +``` +vendor/bin/coverage-badge /path/to/clover.xml /path/to/badge/destination.svg test-name +``` +- To blend multiple Clover files, enumerate the XML inputs separated by commas and use the command +``` +vendor/bin/coverage-badge /path/to/clover.xml,/path/to/clover2.xml /path/to/badge/destination.svg test-name +``` \ No newline at end of file From e8631357dd54ea1e174d3eca5d93ab4515da1418 Mon Sep 17 00:00:00 2001 From: Mohan Raj Date: Fri, 31 May 2024 18:36:02 +0100 Subject: [PATCH 07/10] Add Dependabot config and update README --- .github/dependabot.yml | 11 +++++++++++ README.md | 8 ++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..40586f0 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,11 @@ +version: 2 +updates: + - package-ecosystem: 'composer' + directory: '/' + schedule: + interval: 'weekly' + + - package-ecosystem: 'docker' + directory: '/' + schedule: + interval: 'weekly' \ No newline at end of file diff --git a/README.md b/README.md index 6214e84..0b484df 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ ![](./badges/php.svg) -CoverageBadge is a library for creating an SVG coverage badge from a Clover XML file. +CoverageBadge is a library for creating SVG coverage badges from Clover XML files. ## Installation @@ -21,4 +21,8 @@ vendor/bin/coverage-badge /path/to/clover.xml /path/to/badge/destination.svg tes - To blend multiple Clover files, enumerate the XML inputs separated by commas and use the command ``` vendor/bin/coverage-badge /path/to/clover.xml,/path/to/clover2.xml /path/to/badge/destination.svg test-name -``` \ No newline at end of file +``` + +## Acknowledgements + +This library is inspired by [JASchilz/PHPCoverageBadge](https://github.com/JASchilz/PHPCoverageBadge) \ No newline at end of file From a577e57664ebe8e167d56b3788cdf304734ef746 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 31 May 2024 17:37:45 +0000 Subject: [PATCH 08/10] Bump php from 8.2-cli to 8.3-cli Bumps php from 8.2-cli to 8.3-cli. --- updated-dependencies: - dependency-name: php dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index fb84033..5ad3023 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Use the official PHP 8.2 image from Docker Hub -FROM php:8.2-cli +FROM php:8.3-cli # Install Xdebug extension RUN pecl install xdebug && docker-php-ext-enable xdebug From 91f7628d3bc72beaeefa88d60e1f941a8e264975 Mon Sep 17 00:00:00 2001 From: Mohan Raj Date: Fri, 31 May 2024 18:38:28 +0100 Subject: [PATCH 09/10] update readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0b484df..4534e00 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ ![](./badges/php.svg) -CoverageBadge is a library for creating SVG coverage badges from Clover XML files. +CoverageBadge is a PHP library for creating SVG coverage badges from Clover XML files. ## Installation From 54d10d6d2500bc442ce1c3e59f3ea89e5752b131 Mon Sep 17 00:00:00 2001 From: Mohan Raj Date: Fri, 31 May 2024 18:44:43 +0100 Subject: [PATCH 10/10] update readme with worflow badge --- .github/workflows/php.yml | 2 +- README.md | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 594da72..d9d688e 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -1,4 +1,4 @@ -name: PHP +name: PHP lint & test on: [push, pull_request] diff --git a/README.md b/README.md index 4534e00..4be704e 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # CoverageBadge -![](./badges/php.svg) +[![PHP lint & test](https://github.com/codebtech/coveragebadge/actions/workflows/php.yml/badge.svg)](https://github.com/codebtech/coveragebadge/actions/workflows/php.yml) ![](./badges/php.svg) + CoverageBadge is a PHP library for creating SVG coverage badges from Clover XML files.