-
-
Notifications
You must be signed in to change notification settings - Fork 54
73 lines (62 loc) · 2.25 KB
/
ci-tests-coverage.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# 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 }}