From fa6ac8ac724d30bc01ba5a1b46ea1162c21fa1e3 Mon Sep 17 00:00:00 2001 From: Brian Schubert Date: Fri, 22 Aug 2025 15:31:27 -0400 Subject: [PATCH 1/5] Coverage: add detailed report to job summary --- .github/workflows/ci.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2e4bb783..d84da847 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -180,6 +180,8 @@ jobs: echo "Creating coverage report..." # Create xml file for further processing; Create even if below minimum coverage xml --fail-under=0 + # Write markdown report to job summary + coverage report --format=markdown -m >> $GITHUB_STEP_SUMMARY # For future use in case we want to add a PR comment for 3rd party PRs which requires # a workflow with elevated PR write permissions. Move below steps into a separate job. @@ -210,6 +212,11 @@ jobs: # Note: it appears fail below min is one off, use fail_under -1 here thresholds: '95 98' + - name: Add link to report badge + run: | + run_url=${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}?pr=${{ github.event.pull_request.number }} + sed -i "1s|^\(!.*\)$|[\1]($run_url)|" code-coverage-results.md + - name: Add Coverage PR Comment uses: marocchino/sticky-pull-request-comment@52423e01640425a022ef5fd42c6fb5f633a02728 # v2.9.3 # Create PR comment when the branch is on the repo, otherwise we lack PR write permissions From 37bbc655ada88e09aa582fc3d7c4532266692584 Mon Sep 17 00:00:00 2001 From: Brian Schubert Date: Fri, 22 Aug 2025 16:27:16 -0400 Subject: [PATCH 2/5] shellcheck lints --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d84da847..8bc67a8e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -181,7 +181,7 @@ jobs: # Create xml file for further processing; Create even if below minimum coverage xml --fail-under=0 # Write markdown report to job summary - coverage report --format=markdown -m >> $GITHUB_STEP_SUMMARY + coverage report --format=markdown -m >> "$GITHUB_STEP_SUMMARY" # For future use in case we want to add a PR comment for 3rd party PRs which requires # a workflow with elevated PR write permissions. Move below steps into a separate job. @@ -214,7 +214,7 @@ jobs: - name: Add link to report badge run: | - run_url=${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}?pr=${{ github.event.pull_request.number }} + run_url="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}?pr=${{ github.event.pull_request.number }}" sed -i "1s|^\(!.*\)$|[\1]($run_url)|" code-coverage-results.md - name: Add Coverage PR Comment From 3ae20e0db31b98e75151d39b2e9b2e13c3c24293 Mon Sep 17 00:00:00 2001 From: Brian Schubert Date: Fri, 22 Aug 2025 16:33:53 -0400 Subject: [PATCH 3/5] Move markdown report to before --fail-under=0 --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8bc67a8e..9c202e61 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -178,10 +178,10 @@ jobs: ls -aR .coverage* coverage combine .coverage* echo "Creating coverage report..." - # Create xml file for further processing; Create even if below minimum - coverage xml --fail-under=0 # Write markdown report to job summary coverage report --format=markdown -m >> "$GITHUB_STEP_SUMMARY" + # Create xml file for further processing; Create even if below minimum + coverage xml --fail-under=0 # For future use in case we want to add a PR comment for 3rd party PRs which requires # a workflow with elevated PR write permissions. Move below steps into a separate job. From 15f1325a506de0bb9e1f0f0731ef5d992aaffdd2 Mon Sep 17 00:00:00 2001 From: Brian Schubert Date: Fri, 22 Aug 2025 16:38:56 -0400 Subject: [PATCH 4/5] Fix --fail-under --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9c202e61..6d960f20 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -178,10 +178,10 @@ jobs: ls -aR .coverage* coverage combine .coverage* echo "Creating coverage report..." - # Write markdown report to job summary - coverage report --format=markdown -m >> "$GITHUB_STEP_SUMMARY" # Create xml file for further processing; Create even if below minimum coverage xml --fail-under=0 + # Write markdown report to job summary + coverage report --fail-under=0 --format=markdown -m >> "$GITHUB_STEP_SUMMARY" # For future use in case we want to add a PR comment for 3rd party PRs which requires # a workflow with elevated PR write permissions. Move below steps into a separate job. From 8f99e5f6646bf24d8e8468c33569b6f4e706ed9b Mon Sep 17 00:00:00 2001 From: Brian Schubert Date: Fri, 22 Aug 2025 18:02:02 -0400 Subject: [PATCH 5/5] Update .github/workflows/ci.yml Co-authored-by: Daniel Sperber --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6d960f20..1059f458 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -213,6 +213,7 @@ jobs: thresholds: '95 98' - name: Add link to report badge + if: ${{ always() && steps.cov_xml_upload.outputs.artifact-id != '' }} run: | run_url="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}?pr=${{ github.event.pull_request.number }}" sed -i "1s|^\(!.*\)$|[\1]($run_url)|" code-coverage-results.md