@@ -2,7 +2,7 @@ name: Code Coverage
22
33on :
44 pull_request :
5- branches : [ main, develop ]
5+ branches : [ main]
66
77env :
88 AUTOMATICS_UNAME : ${{ secrets.AUTOMATICS_UNAME }}
@@ -31,32 +31,18 @@ jobs:
3131 run : |
3232 docker run -d --name native-platform -v ${{ github.workspace }}:/mnt/L1_CONTAINER_SHARED_VOLUME ghcr.io/rdkcentral/docker-device-mgt-service-test/native-platform:latest
3333
34- - name : Run unit tests with coverage flags enabled
35- run : docker exec -i native-platform /bin/bash -c "cd /mnt/L1_CONTAINER_SHARED_VOLUME/ && sh test/run_ut.sh --enable-cov"
34+ - name : Run unit tests with coverage flags enabled and Caculate the code coverage summary
35+ run : docker exec -i native-platform /bin/bash -c "cd /mnt/L1_CONTAINER_SHARED_VOLUME/ && sh test/run_ut.sh --enable-cov && lcov --list coverage.info | grep 'Lines\|Total' > /tmp/coverage_summary.txt "
3636
37- - name : Caculate the code coverage summary
38- run : |
39- lcov --list coverage.info | grep "Lines\|Total" > /tmp/Gtest_Report/coverage_summary.txt
40-
41- - name : Copy the code coverage to runner
42- run : |
43- docker cp native-platform:/tmp/Gtest_Report/ /tmp/Gtest_Report/
37+ - name : Copy coverage summary to runner
38+ run : docker cp native-platform:/tmp/coverage_summary.txt /tmp/
4439
45- upload-test-results :
46- name : Upload L1 coverage reports
47- needs : execute-unit-code-coverage-report-on-release
48- runs-on : ubuntu-latest
49- container :
50- image : ghcr.io/rdkcentral/docker-rdk-ci:latest
51- volumes :
52- - /tmp/Gtest_Report:/tmp/Gtest_Report
53- steps :
5440 - name : Update the coverage report to Pull request using actions
5541 uses : actions/github-script@v4
5642 with :
5743 script : |
5844 const fs = require('fs');
59- const lcov_result = fs.readFileSync('/tmp/Gtest_Report/ coverage_summary.txt', 'utf8');
45+ const lcov_result = fs.readFileSync('/tmp/coverage_summary.txt', 'utf8');
6046
6147 github.issues.createComment({
6248 issue_number: context.issue.number,
@@ -71,12 +57,13 @@ jobs:
7157 });
7258
7359 - name : Generate the html report
74- run : |
75- genhtml coverage.info --output-directory /tmp/coverage_report
60+ run : docker exec -i native-platform /bin/bash -c " cd /mnt/L1_CONTAINER_SHARED_VOLUME/ && genhtml coverage.info --output-directory /tmp/coverage_report"
61+
62+ - name : Copy html report to runner
63+ run : docker cp native-platform:/tmp/coverage_report /tmp/
7664
7765 - name : Upload the coverage report to Pull request using actions
7866 uses : actions/upload-artifact@v4
7967 with :
8068 name : coverage-report
8169 path : /tmp/coverage_report
82-
0 commit comments