From bbe4cc3926ea04b2691fb632fec7799b1fea2428 Mon Sep 17 00:00:00 2001 From: Richard McDaniel Date: Fri, 24 Oct 2025 00:03:58 +0000 Subject: [PATCH 1/6] Remove scrutinizer/ocular and add local coverage badge generation - Remove scrutinizer/ocular from composer dependencies - Update GitHub Actions workflow to generate coverage badge locally - Replace Scrutinizer coverage badge with GitHub-hosted badge in README - Add automatic badge commit and push on master branch --- .github/workflows/php.yml | 34 ++++++++++++++++++++++++++++++++-- README.md | 2 +- composer.json | 1 - 3 files changed, 33 insertions(+), 4 deletions(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 6fde9ae4..8c9c9c63 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -105,11 +105,41 @@ jobs: - name: Code Coverage run: | - vendor/bin/phpunit --testdox --coverage-clover=coverage.clover --testsuite unit - vendor/bin/ocular code-coverage:upload --format=php-clover coverage.clover + vendor/bin/phpunit --testdox --coverage-clover=coverage.xml --testsuite unit env: APP_KEY: base64:i3g6f+dV8FfsIkcxqd7gbiPn2oXk5r00sTmdD6V5utI= DB_CONNECTION: sqlite DB_DATABASE: testbench.sqlite QUEUE_CONNECTION: sync XDEBUG_MODE: coverage + + - name: Generate Coverage Badge + uses: cicirello/jacoco-badge-generator@v2 + with: + badges-directory: .github/badges + generate-branches-badge: false + generate-summary: true + coverage-badge-filename: coverage.svg + coverage-label: coverage + + - name: Log Coverage Percentage + run: | + if [ -f .github/badges/coverage.svg ]; then + COVERAGE=$(grep -oP 'coverage: \K[0-9.]+' .github/badges/coverage.svg || echo "unknown") + echo "Coverage: $COVERAGE%" + fi + + - name: Commit Badge + if: github.event_name == 'push' && github.ref == 'refs/heads/master' + run: | + git config --local user.email "github-actions[bot]@users.noreply.github.com" + git config --local user.name "github-actions[bot]" + git add .github/badges/coverage.svg || true + git diff --staged --quiet || git commit -m "Update coverage badge [skip ci]" + + - name: Push Badge + if: github.event_name == 'push' && github.ref == 'refs/heads/master' + uses: ad-m/github-push-action@master + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + branch: ${{ github.ref }} diff --git a/README.md b/README.md index 95023e0e..0ce8434f 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@

logo

-

GitHub Workflow Status Scrutinizer coverage (GitHub/BitBucket) Packagist Downloads (custom server) +

GitHub Workflow Status Code Coverage Packagist Downloads (custom server) Docs Packagist License

Laravel Workflow is a package for the Laravel web framework that provides tools for defining and managing workflows and activities. A workflow is a series of interconnected activities that are executed in a specific order to achieve a desired result. Activities are individual tasks or pieces of logic that are executed as part of a workflow. diff --git a/composer.json b/composer.json index 7cdc83c7..3523a1c4 100644 --- a/composer.json +++ b/composer.json @@ -54,7 +54,6 @@ "require-dev": { "orchestra/testbench": "^8.0", "phpstan/phpstan": "^2.0", - "scrutinizer/ocular": "dev-master", "symplify/easy-coding-standard": "^11.0" }, "extra": { From 8b7584dfe20e191a8d4cc1f545f284fe82bbf221 Mon Sep 17 00:00:00 2001 From: Richard McDaniel Date: Fri, 24 Oct 2025 00:12:37 +0000 Subject: [PATCH 2/6] Fix coverage badge generation to use PHPUnit-compatible action Replace cicirello/jacoco-badge-generator (Java/JaCoCo) with timkrase/phpunit-coverage-badge (PHP/Clover) to properly parse PHPUnit coverage reports --- .github/workflows/php.yml | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 8c9c9c63..3c3dcc29 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -114,32 +114,24 @@ jobs: XDEBUG_MODE: coverage - name: Generate Coverage Badge - uses: cicirello/jacoco-badge-generator@v2 + uses: timkrase/phpunit-coverage-badge@v1.2.1 with: - badges-directory: .github/badges - generate-branches-badge: false - generate-summary: true - coverage-badge-filename: coverage.svg - coverage-label: coverage + coverage_badge_path: .github/badges/coverage.svg + push_badge: false + repo_token: ${{ secrets.GITHUB_TOKEN }} - name: Log Coverage Percentage run: | if [ -f .github/badges/coverage.svg ]; then - COVERAGE=$(grep -oP 'coverage: \K[0-9.]+' .github/badges/coverage.svg || echo "unknown") - echo "Coverage: $COVERAGE%" + COVERAGE=$(grep -oP '\d+%' .github/badges/coverage.svg | head -1) + echo "Code Coverage: $COVERAGE" fi - - name: Commit Badge + - name: Commit and Push Badge if: github.event_name == 'push' && github.ref == 'refs/heads/master' run: | git config --local user.email "github-actions[bot]@users.noreply.github.com" git config --local user.name "github-actions[bot]" git add .github/badges/coverage.svg || true git diff --staged --quiet || git commit -m "Update coverage badge [skip ci]" - - - name: Push Badge - if: github.event_name == 'push' && github.ref == 'refs/heads/master' - uses: ad-m/github-push-action@master - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - branch: ${{ github.ref }} + git push From 3849e9b9c475bd6e1873f3b870f8930ff26181cc Mon Sep 17 00:00:00 2001 From: Richard McDaniel Date: Fri, 24 Oct 2025 00:21:50 +0000 Subject: [PATCH 3/6] Specify coverage report path for badge generation --- .github/workflows/php.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 3c3dcc29..3e89d496 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -119,6 +119,7 @@ jobs: coverage_badge_path: .github/badges/coverage.svg push_badge: false repo_token: ${{ secrets.GITHUB_TOKEN }} + report: coverage.xml - name: Log Coverage Percentage run: | From f08136edda1fd1a7d06bd041be4f5d8fa6eb8773 Mon Sep 17 00:00:00 2001 From: Richard McDaniel Date: Fri, 24 Oct 2025 00:35:04 +0000 Subject: [PATCH 4/6] Remove redundant badge upload artifact step Badge is committed to branch, so artifact upload is unnecessary --- .github/workflows/php.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 3e89d496..2435589e 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -129,7 +129,7 @@ jobs: fi - name: Commit and Push Badge - if: github.event_name == 'push' && github.ref == 'refs/heads/master' + if: github.event_name == 'push' run: | git config --local user.email "github-actions[bot]@users.noreply.github.com" git config --local user.name "github-actions[bot]" From 015cbafd1f8a115af8db9f9f6a09a634b4695f77 Mon Sep 17 00:00:00 2001 From: Richard McDaniel Date: Fri, 24 Oct 2025 00:44:56 +0000 Subject: [PATCH 5/6] Always commit and push coverage badge, not just on push events Badge is generated on all workflow runs (push and PR), so it should be committed every time --- .github/workflows/php.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 2435589e..41467df9 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -129,7 +129,6 @@ jobs: fi - name: Commit and Push Badge - if: github.event_name == 'push' run: | git config --local user.email "github-actions[bot]@users.noreply.github.com" git config --local user.name "github-actions[bot]" From 3320c7fd98ab38a9f4327f5139b39ecfe8bec2ba Mon Sep 17 00:00:00 2001 From: Richard McDaniel Date: Fri, 24 Oct 2025 01:00:52 +0000 Subject: [PATCH 6/6] Switch to Codecov for coverage badge and reporting - Remove local badge generation and automatic commits - Use Codecov service to host coverage badge externally - Update README badge to point to Codecov - Requires CODECOV_TOKEN secret to be configured in GitHub --- .github/workflows/php.yml | 26 +++++--------------------- README.md | 2 +- 2 files changed, 6 insertions(+), 22 deletions(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 41467df9..8013dfe1 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -113,25 +113,9 @@ jobs: QUEUE_CONNECTION: sync XDEBUG_MODE: coverage - - name: Generate Coverage Badge - uses: timkrase/phpunit-coverage-badge@v1.2.1 + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v5 with: - coverage_badge_path: .github/badges/coverage.svg - push_badge: false - repo_token: ${{ secrets.GITHUB_TOKEN }} - report: coverage.xml - - - name: Log Coverage Percentage - run: | - if [ -f .github/badges/coverage.svg ]; then - COVERAGE=$(grep -oP '\d+%' .github/badges/coverage.svg | head -1) - echo "Code Coverage: $COVERAGE" - fi - - - name: Commit and Push Badge - run: | - git config --local user.email "github-actions[bot]@users.noreply.github.com" - git config --local user.name "github-actions[bot]" - git add .github/badges/coverage.svg || true - git diff --staged --quiet || git commit -m "Update coverage badge [skip ci]" - git push + files: ./coverage.xml + fail_ci_if_error: false + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/README.md b/README.md index 0ce8434f..8ed62198 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@

logo

-

GitHub Workflow Status Code Coverage Packagist Downloads (custom server) +

GitHub Workflow Status Code Coverage Packagist Downloads (custom server) Docs Packagist License

Laravel Workflow is a package for the Laravel web framework that provides tools for defining and managing workflows and activities. A workflow is a series of interconnected activities that are executed in a specific order to achieve a desired result. Activities are individual tasks or pieces of logic that are executed as part of a workflow.