|
| 1 | +name: L1 Unit Tests for rdkNativeScript |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [topic/RDKEMW-5610] |
| 6 | + pull_request: |
| 7 | + branches: [topic/RDKEMW-5610] |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +env: |
| 11 | + AUTOMATICS_UNAME: ${{ secrets.AUTOMATICS_UNAME }} |
| 12 | + AUTOMATICS_PASSCODE: ${{ secrets.AUTOMATICS_PASSCODE }} |
| 13 | + |
| 14 | +jobs: |
| 15 | + build-and-test-l1: |
| 16 | + runs-on: ubuntu-latest |
| 17 | + |
| 18 | + steps: |
| 19 | + - name: Checkout source repository |
| 20 | + uses: actions/checkout@v3 |
| 21 | + |
| 22 | + - name: Checkout rdkNativeScript_tests repository |
| 23 | + uses: actions/checkout@v3 |
| 24 | + with: |
| 25 | + repository: rdk-e/rdkNativeScript_tests |
| 26 | + ref: topic/RDKEMW-5610 |
| 27 | + path: rdkNativeScript_tests |
| 28 | + token: ${{ secrets.GH_PAT }} |
| 29 | + |
| 30 | + - name: Install dependencies |
| 31 | + run: | |
| 32 | + sudo apt-get update && sudo apt-get install -y \ |
| 33 | + g++ \ |
| 34 | + cmake \ |
| 35 | + build-essential \ |
| 36 | + libcurl4-openssl-dev \ |
| 37 | + libcjson-dev \ |
| 38 | + libgtest-dev \ |
| 39 | + libssl-dev \ |
| 40 | + zlib1g-dev \ |
| 41 | + libuv1-dev \ |
| 42 | + lcov \ |
| 43 | + libglib2.0-dev |
| 44 | +
|
| 45 | + - name: Build Google Test and Google Mock |
| 46 | + run: | |
| 47 | + cd /usr/src/googletest |
| 48 | + sudo cmake -S . -B build |
| 49 | + sudo cmake --build build |
| 50 | + sudo cp build/lib/libgmock.a /usr/lib |
| 51 | + sudo cp build/lib/libgmock_main.a /usr/lib |
| 52 | + sudo cp build/lib/libgtest.a /usr/lib |
| 53 | + sudo cp build/lib/libgtest_main.a /usr/lib |
| 54 | +
|
| 55 | + - name: Configure and Build L1 |
| 56 | + run: | |
| 57 | + mkdir -p ../build_l1 |
| 58 | + cd ../build_l1 |
| 59 | + cmake -DCMAKE_BUILD_TYPE=Debug \ |
| 60 | + -DRUN_L1=ON \ |
| 61 | + -DRUN_L2=OFF \ |
| 62 | + -DENABLE_JSRUNTIME_ESSOS=ON \ |
| 63 | + -DENABLE_JSRUNTIME_PLAYER=ON \ |
| 64 | + -DENABLE_AAMP_JSBINDINGS=ON \ |
| 65 | + -DENABLE_AAMP_JSBINDINGS_DYNAMIC=ON \ |
| 66 | + -DENABLE_AAMP_JSBINDINGS_STATIC=OFF \ |
| 67 | + -DJSRUNTIME_ENGINE_NAME=jsc \ |
| 68 | + -Djsruntime_source=../rdkNativeScript ../rdkNativeScript/rdkNativeScript_tests |
| 69 | + make -j$(nproc) |
| 70 | +
|
| 71 | + - name: Run L1 Tests and Generate JUnit Results |
| 72 | + run: | |
| 73 | + set -e |
| 74 | + cd ../build_l1 |
| 75 | + ctest -R RunL1Tests --output-on-failure --no-compress-output -T Test || true |
| 76 | + # Convert CTest results to JUnit XML for reporting |
| 77 | + if [ -f Testing/*/Test.xml ]; then cp Testing/*/Test.xml ctest-results.xml; fi |
| 78 | +
|
| 79 | + - name: Publish L1 test results |
| 80 | + uses: dorny/test-reporter@v1 |
| 81 | + with: |
| 82 | + name: Unit Test Results |
| 83 | + path: ../build_l1/ctest-results.xml |
| 84 | + reporter: java-junit |
| 85 | + |
| 86 | + - name: Generate coverage report |
| 87 | + run: | |
| 88 | + cd ../build_l1 |
| 89 | + lcov --capture --directory . --output-file coverage.info |
| 90 | + genhtml coverage.info --output-directory html_coverage_report |
| 91 | +
|
| 92 | + - name: Upload test result file (JUnit XML) |
| 93 | + uses: actions/upload-artifact@v4 |
| 94 | + with: |
| 95 | + name: ctest-results-l1-${{ github.run_id }} |
| 96 | + path: ../build_l1/ctest-results.xml |
| 97 | + |
| 98 | + - name: Upload coverage report |
| 99 | + uses: actions/upload-artifact@v4 |
| 100 | + with: |
| 101 | + name: l1-html-coverage-report |
| 102 | + path: ../build_l1/html_coverage_report |
| 103 | + if-no-files-found: warn |
0 commit comments