Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 40 additions & 4 deletions .github/workflows/L1-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,24 +31,60 @@ jobs:
run: |
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

- name: Run L1 Unit Tests inside container
run: docker exec -i native-platform /bin/bash -c "cd /mnt/L1_CONTAINER_SHARED_VOLUME/ && sh test/run_ut.sh"
- name: Run L1 Unit Tests inside container with coverage flags enabled
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 > /tmp/coverage_summary.txt"

- name: Copy coverage summary to runner
run: docker cp native-platform:/tmp/coverage_summary.txt /tmp/

- name: Copy L1 test results to runner
run: |
docker cp native-platform:/tmp/Gtest_Report /tmp/Gtest_Report
ls -l /tmp/Gtest_Report

- 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: Upload test results as artifact
uses: actions/upload-artifact@v4
with:
name: gtest-results
path: /tmp/Gtest_Report
retention-days: 1

upload-test-results:
name: Upload L1 test results to automatic test result management system
needs: execute-L1-tests-on-pr
runs-on: ubuntu-latest
container:
image: ghcr.io/rdkcentral/docker-rdk-ci:latest
volumes:
- /tmp/Gtest_Report:/tmp/Gtest_Report

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Download test results
uses: actions/download-artifact@v4
with:
name: gtest-results
path: /tmp/Gtest_Report

- name: Upload results
if: github.repository_owner == 'rdkcentral'
env:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/code-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Code Coverage

on:
pull_request:
branches: [ main]
branches: [ main ]

env:
AUTOMATICS_UNAME: ${{ secrets.AUTOMATICS_UNAME }}
Expand Down Expand Up @@ -32,7 +32,7 @@ jobs:
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

- name: Run unit tests with coverage flags enabled and Caculate the code coverage summary
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"
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 > /tmp/coverage_summary.txt"

- name: Copy coverage summary to runner
run: docker cp native-platform:/tmp/coverage_summary.txt /tmp/
Expand Down
3 changes: 3 additions & 0 deletions test/run_ut.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ autoreconf --install

make -C source/test

# Create test results directory
mkdir -p /tmp/Gtest_Report

Comment on lines +47 to +49
# List of 13 test binaries to run
tests="
./source/test/bulkdata/profile_gtest.bin
Expand Down
Loading