Skip to content

📊 CI Tests Coverage #303

📊 CI Tests Coverage

📊 CI Tests Coverage #303

# Tests coverage report generator using test results published by CI Sonar Scan workflow
# https://github.com/irongut/CodeCoverageSummary
name: '📊 CI Tests Coverage'
on:
workflow_run:
workflows: [ '🎯 CI Sonar Scan' ]
types:
- completed
jobs:
coverage-report:
name: ${{ matrix.name }} Coverage Report
if: ${{ github.repository == 'MethanePowered/MethaneKit' }}
strategy:
fail-fast: false
matrix:
include:
- name: "Win64_DX_SonarScan"
- name: "Ubuntu_VK_SonarScan"
- name: "MacOS_MTL_SonarScan"
runs-on: ubuntu-latest
steps:
- name: Download coverage results artifact
uses: dawidd6/action-download-artifact@v2
with:
name: MethaneKit_${{ matrix.name }}_CoverageResults
path: CoverageResults
workflow: ci-sonar-scan.yml
run_id: ${{ github.event.workflow_run.id }}
- name: Generate Code Coverage Report
uses: irongut/[email protected]
with:
filename: CoverageResults/Cobertura.xml
badge: true
fail_below_min: false
format: markdown
hide_branch_rate: false
hide_complexity: true
indicators: true
output: both
thresholds: '10 80'
- name: Add Code Coverage PR Comment
uses: marocchino/sticky-pull-request-comment@v2
if: ${{ github.event.workflow_run.event == 'pull_request' }}
with:
number: ${{ github.event.workflow_run.pull_requests[0].number }}
header: ${{ matrix.name }} Tests Code Coverage
path: code-coverage-results.md
recreate: true
- name: Read Code Coverage file contents
if: ${{ github.event.workflow_run.event == 'push' }}
id: read_coverage_file
uses: andstor/file-reader-action@v1
with:
path: code-coverage-results.md
- name: Add commit comment with coverage report
if: ${{ github.event.workflow_run.event == 'push' }}
uses: peter-evans/commit-comment@v2
with:
sha: ${{ github.event.workflow_run.head_sha }}
body: |
# ${{ matrix.name }} Tests Code Coverage
${{ steps.read_coverage_file.outputs.contents }}