From f5c50de9388f05aff7eac3aaae060708d86bbd18 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Mon, 21 Oct 2024 10:50:41 +0200 Subject: [PATCH] Switch to xdebug for code coverage reports --- .github/workflows/ci.yml | 2 ++ CHANGELOG.md | 17 +++++++++++++++++ Dockerfile | 7 ++++--- composer.json | 10 ++++++++-- 4 files changed, 31 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7aa46b0..9a8ed85 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,3 +10,5 @@ on: jobs: ci: uses: shlinkio/github-actions/.github/workflows/php-lib-ci.yml@main + with: + coverage-driver: 'xdebug' diff --git a/CHANGELOG.md b/CHANGELOG.md index c8d22ea..e6201f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,23 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com), and this project adheres to [Semantic Versioning](https://semver.org). +## [Unreleased] +### Added +* *Nothing* + +### Changed +* Switch to xdebug for code coverage reports, as pcov is not marking functions as covered + +### Deprecated +* *Nothing* + +### Removed +* *Nothing* + +### Fixed +* *Nothing* + + ## [9.2.0] - 2024-08-11 ### Added * Add `ROBOTS_ALLOW_ALL_SHORT_URLS` config option. diff --git a/Dockerfile b/Dockerfile index 5dcd3a3..11300e4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,7 @@ FROM composer:2 -RUN apk add --no-cache --virtual .phpize-deps ${PHPIZE_DEPS} && \ - pecl install pcov && \ - docker-php-ext-enable pcov && \ +RUN apk add --update linux-headers && \ + apk add --no-cache --virtual .phpize-deps ${PHPIZE_DEPS} && \ + pecl install xdebug && \ + docker-php-ext-enable xdebug && \ apk del .phpize-deps diff --git a/composer.json b/composer.json index 62b003d..08cbc13 100644 --- a/composer.json +++ b/composer.json @@ -51,8 +51,14 @@ "cs:fix": "phpcbf", "stan": "phpstan analyse", "test": "phpunit --order-by=random --testdox --testdox-summary", - "test:ci": "@test --coverage-clover=build/clover.xml", - "test:pretty": "@test --coverage-html=build/coverage-html" + "test:ci": [ + "@putenv XDEBUG_MODE=coverage", + "@test --coverage-clover=build/clover.xml" + ], + "test:pretty": [ + "@putenv XDEBUG_MODE=coverage", + "@test --coverage-html=build/coverage-html" + ] }, "scripts-descriptions": { "ci": "Alias for \"cs\", \"stan\" and \"test:ci\"",