chore: migrate benchmarks to PHPBench with performance regression guards #161
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # SPDX-FileCopyrightText: 2026 LibreSign | |
| # SPDX-License-Identifier: AGPL-3.0-or-later | |
| name: coverage | |
| on: | |
| pull_request: | |
| env: | |
| COVERAGE_THRESHOLDS: '95 95' | |
| jobs: | |
| coverage: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Detect minimum PHP from composer.json | |
| id: php_min | |
| run: | | |
| php_version=$(grep -Po '"php"\s*:\s*"\K[^"]+' composer.json | grep -Eo '[0-9]+\.[0-9]+' | head -n1) | |
| [[ -n "$php_version" ]] || { echo "Could not determine minimum PHP version"; exit 1; } | |
| echo "version=$php_version" >> "$GITHUB_OUTPUT" | |
| - uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ steps.php_min.outputs.version }} | |
| coverage: xdebug | |
| - run: composer install --no-interaction --prefer-dist | |
| - run: composer bin phpunit install --no-interaction --prefer-dist | |
| - name: Generate coverage reports | |
| run: XDEBUG_MODE=coverage vendor-bin/phpunit/vendor/phpunit/phpunit/phpunit --coverage-text --coverage-clover=build/coverage/clover.xml --coverage-cobertura=build/coverage/cobertura.xml --coverage-html=build/coverage/html | |
| - name: Store temporary coverage cache | |
| uses: actions/cache/save@v4 | |
| with: | |
| path: build/coverage | |
| key: coverage-${{ github.event.pull_request.number }}-${{ github.sha }} | |
| - name: Upload temporary coverage artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-report-${{ github.event.pull_request.number }}-${{ github.sha }} | |
| path: build/coverage | |
| retention-days: 7 | |
| - name: Validate minimum line coverage | |
| uses: irongut/CodeCoverageSummary@v1.3.0 | |
| with: | |
| filename: build/coverage/cobertura.xml | |
| fail_below_min: true | |
| format: text | |
| hide_branch_rate: false | |
| hide_complexity: true | |
| indicators: true | |
| output: console | |
| thresholds: ${{ env.COVERAGE_THRESHOLDS }} |