-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (44 loc) · 1.55 KB
/
code-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
name: Code Coverage
on:
pull_request:
branches: [ main ]
jobs:
execute-unit-code-coverage-report-on-release:
name: Test coverage report for release
runs-on: ubuntu-latest
container:
image: ghcr.io/rdkcentral/docker-rdk-ci:latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Run unit tests with coverage flags enabled
run: |
sh test/run_ut.sh --enable-cov
- name: Caculate the code coverage summary
run: |
lcov --list coverage.info | grep "Lines\|Total" > /tmp/coverage_summary.txt
- name: Update the coverage report to Pull request using actions
uses: actions/github-script@v4
with:
script: |
const fs = require('fs');
const lcov_result = fs.readFileSync('/tmp/coverage_summary.txt', 'utf8');
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body:
'## Code Coverage Summary \n' +
' ' +
'```' +
lcov_result +
'```'
});
- name: Generate the html report
run: |
genhtml coverage.info --output-directory /tmp/coverage_report
- name: Upload the coverage report to Pull request using actions
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: /tmp/coverage_report