Release/1.3.0 #2
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |