Skip to content

Commit 9841950

Browse files
author
Antoine
committed
Enhance coverage reporting in On Release workflow by merging reports and updating release description
1 parent d854722 commit 9841950

1 file changed

Lines changed: 39 additions & 7 deletions

File tree

.github/workflows/OnRelease.yml

Lines changed: 39 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,46 @@ jobs:
4747
include_passed: true
4848
check_name: Pytest Test Report (${{ matrix.python-version }})
4949

50-
- name: cobertura-report
50+
- name: Setup .NET Core # Required to execute ReportGenerator
5151
if: success() || failure()
52-
uses: 5monkeys/cobertura-action@v14
52+
uses: actions/setup-dotnet@v4
5353
with:
54-
path: tests_reports/**/coverage.xml
55-
minimum_coverage: 90
56-
fail_below_threshold: true
57-
report_name: Coverage Report (${{ matrix.python-version }})
54+
dotnet-version: 8.x
55+
dotnet-quality: 'ga'
56+
57+
- name: Merge coverage reports
58+
if: success() || failure()
59+
uses: danielpalme/ReportGenerator-GitHub-Action@v5
60+
with:
61+
reports: tests_reports/**/coverage.xml
62+
targetdir: coverage-report
63+
reporttypes: "cobertura"
64+
65+
66+
- name: coverage report
67+
if: success() || failure()
68+
uses: irongut/CodeCoverageSummary@v1.3.0
69+
with:
70+
filename: coverage-report/coverage-summary.xml
71+
fail_below_min: true
72+
thresholds: "90 100"
73+
format: markdown
74+
output: both
75+
76+
- name: add coverage to release description
77+
if: success() || failure()
78+
uses: actions/github-script@v6
79+
with:
80+
script: |
81+
const fs = require('fs');
82+
const coverage = fs.readFileSync('code-coverage-results.md', 'utf8');
83+
const releaseBody = `Python ${{ matrix.python-version }}\n${coverage}\n\n${context.payload.release.body}`;
84+
github.rest.repos.updateRelease({
85+
owner: context.repo.owner,
86+
repo: context.repo.repo,
87+
release_id: context.payload.release.id,
88+
body: releaseBody
89+
});
5890
5991
build:
6092
runs-on: ubuntu-latest
@@ -66,7 +98,7 @@ jobs:
6698
- name: Set up Python 3.10
6799
uses: actions/setup-python@v5
68100
with:
69-
python-version: 3.10
101+
python-version: "3.10"
70102

71103
- name: Install dependencies
72104
run: |

0 commit comments

Comments
 (0)