From e10c4d02b7d3943ca63e04cd30c44bd7aa5b56f7 Mon Sep 17 00:00:00 2001 From: roxblnfk Date: Fri, 20 Nov 2026 17:26:18 +0400 Subject: [PATCH 01/12] ci(coverage): run a turbocov coverage job next to the Xdebug one Experiment for #442: turbocov in PCOV-impersonation mode, so the existing PCOV driver is exercised unchanged. Both jobs upload their clover report for comparison. Assisted-By: Claude Opus 5.5 --- .github/workflows/tests.yml | 61 +++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 4913040a..c7a97804 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -150,3 +150,64 @@ jobs: files: runtime/clover.xml disable_search: true token: ${{ secrets.CODECOV_TOKEN }} + + - name: Upload clover report + if: always() + uses: actions/upload-artifact@v4 + with: + name: clover-xdebug + path: runtime/clover.xml + + code-coverage-turbocov: + runs-on: ubuntu-latest + name: Code Coverage (turbocov) + concurrency: + group: code-coverage-turbocov-${{ github.ref }} + cancel-in-progress: true + + steps: + + - name: Checkout + uses: actions/checkout@v7 + + - name: Resolve root package version + run: echo "COMPOSER_ROOT_VERSION=$(jq -r '.["."]' resources/version.json)" >> "$GITHUB_ENV" + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: 8.4 + coverage: none + tools: pie + ini-values: opcache.enable_cli=0 + + # The impersonation mode registers turbocov as `pcov`, so Testo picks its PCOV driver unchanged. + # PIE cannot detect it under that name and leaves it disabled, hence the explicit ini file. + - name: Install turbocov + run: | + sudo pie install shipmonk/turbocov --enable-turbocov-impersonate-pcov + echo "extension=turbocov" | sudo tee "$(php -r 'echo PHP_CONFIG_FILE_SCAN_DIR;')/99-turbocov.ini" + php --ri pcov + + - name: Install Composer dependencies + uses: ramsey/composer-install@v3 + with: + dependency-versions: highest + + - name: Install bin tools + run: composer bin all install --ignore-platform-req=php + + # turbocov needs an explicit whitelist; finer excludes are applied by the driver. + - name: Run Tests with Coverage + env: + TESTO_CI: 1 + run: >- + time php -d pcov.directory="$GITHUB_WORKSPACE/core:$GITHUB_WORKSPACE/plugin:$GITHUB_WORKSPACE/bridge" + vendor/bin/testo --coverage --coverage-clover=runtime/clover.xml --type=!bench + + - name: Upload clover report + if: always() + uses: actions/upload-artifact@v4 + with: + name: clover-turbocov + path: runtime/clover.xml From f3acd80fb8e616a833c7cc6995930ce83e8490cf Mon Sep 17 00:00:00 2001 From: roxblnfk Date: Fri, 20 Nov 2026 17:41:28 +0400 Subject: [PATCH 02/12] ci(coverage): cache the turbocov build Building the extension with PIE costs ~13 s per run. The cache key pins the PHP patch version and the turbocov release, so a new release or PHP update triggers a rebuild. Assisted-By: Claude Opus 5.5 --- .github/workflows/tests.yml | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index c7a97804..a9b9c481 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -181,12 +181,31 @@ jobs: tools: pie ini-values: opcache.enable_cli=0 + - name: Resolve turbocov build key + id: turbocov + run: | + echo "version=$(curl -fsSL https://repo.packagist.org/p2/shipmonk/turbocov.json | jq -r '.packages["shipmonk/turbocov"][0].version')" >> "$GITHUB_OUTPUT" + echo "php=$(php -r 'echo PHP_VERSION;')" >> "$GITHUB_OUTPUT" + + - name: Cache turbocov build + id: turbocov-cache + uses: actions/cache@v4 + with: + path: ~/.turbocov + key: turbocov-${{ runner.os }}-php${{ steps.turbocov.outputs.php }}-${{ steps.turbocov.outputs.version }}-impersonate-pcov + # The impersonation mode registers turbocov as `pcov`, so Testo picks its PCOV driver unchanged. - # PIE cannot detect it under that name and leaves it disabled, hence the explicit ini file. - - name: Install turbocov + - name: Build turbocov + if: steps.turbocov-cache.outputs.cache-hit != 'true' + run: | + sudo pie install "shipmonk/turbocov:${{ steps.turbocov.outputs.version }}" --enable-turbocov-impersonate-pcov + mkdir -p ~/.turbocov + cp "$(php-config --extension-dir)/turbocov.so" ~/.turbocov/ + + # PIE cannot detect the extension under the `pcov` name and leaves it disabled. + - name: Enable turbocov run: | - sudo pie install shipmonk/turbocov --enable-turbocov-impersonate-pcov - echo "extension=turbocov" | sudo tee "$(php -r 'echo PHP_CONFIG_FILE_SCAN_DIR;')/99-turbocov.ini" + echo "extension=$HOME/.turbocov/turbocov.so" | sudo tee "$(php -r 'echo PHP_CONFIG_FILE_SCAN_DIR;')/99-turbocov.ini" php --ri pcov - name: Install Composer dependencies From 89175bd616fdb1c79f99f4baaa0d2e97b7deb762 Mon Sep 17 00:00:00 2001 From: roxblnfk Date: Fri, 20 Nov 2026 17:46:34 +0400 Subject: [PATCH 03/12] ci(coverage): add a PCOV coverage job for comparison Third baseline next to Xdebug and turbocov for #442, uploading its clover report as `clover-pcov`. Assisted-By: Claude Opus 5.5 --- .github/workflows/tests.yml | 44 +++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index a9b9c481..6aa1c8bf 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -158,6 +158,50 @@ jobs: name: clover-xdebug path: runtime/clover.xml + code-coverage-pcov: + runs-on: ubuntu-latest + name: Code Coverage (PCOV) + concurrency: + group: code-coverage-pcov-${{ github.ref }} + cancel-in-progress: true + + steps: + + - name: Checkout + uses: actions/checkout@v7 + + - name: Resolve root package version + run: echo "COMPOSER_ROOT_VERSION=$(jq -r '.["."]' resources/version.json)" >> "$GITHUB_ENV" + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: 8.4 + coverage: pcov + + - name: Install Composer dependencies + uses: ramsey/composer-install@v3 + with: + dependency-versions: highest + + - name: Install bin tools + run: composer bin all install --ignore-platform-req=php + + # PCOV takes a single root directory; vendor code is excluded to match the other drivers' whitelist. + - name: Run Tests with Coverage + env: + TESTO_CI: 1 + run: >- + time php -d pcov.directory="$GITHUB_WORKSPACE" -d pcov.exclude='~/vendor/~' + vendor/bin/testo --coverage --coverage-clover=runtime/clover.xml --type=!bench + + - name: Upload clover report + if: always() + uses: actions/upload-artifact@v4 + with: + name: clover-pcov + path: runtime/clover.xml + code-coverage-turbocov: runs-on: ubuntu-latest name: Code Coverage (turbocov) From ba7fc1d36a4e29ae3334c48fd02db49247df6bbc Mon Sep 17 00:00:00 2001 From: roxblnfk Date: Fri, 20 Nov 2026 18:00:00 +0400 Subject: [PATCH 04/12] ci(coverage): comment the per-line diff of the three coverage drivers on the PR The job renders every source line where Xdebug, PCOV and turbocov disagree and keeps it in a single PR comment, found by a marker and rewritten on each push. Assisted-By: Claude Opus 5.5 --- .github/scripts/coverage-diff.php | 152 ++++++++++++++++++++++++++++++ .github/workflows/tests.yml | 53 +++++++++++ 2 files changed, 205 insertions(+) create mode 100644 .github/scripts/coverage-diff.php diff --git a/.github/scripts/coverage-diff.php b/.github/scripts/coverage-diff.php new file mode 100644 index 00000000..1faf3989 --- /dev/null +++ b/.github/scripts/coverage-diff.php @@ -0,0 +1,152 @@ +