From d81c548fec1d2da38620c9443491eb5ef533ef81 Mon Sep 17 00:00:00 2001 From: nlaksh787 Date: Thu, 14 Sep 2023 15:29:26 +0530 Subject: [PATCH] Added github workflow --- .github/scripts/rtrouted.sh | 12 +++++ .github/workflows/push.yml | 92 +++++++++++++++++++++++++++++++++++++ 2 files changed, 104 insertions(+) create mode 100755 .github/scripts/rtrouted.sh create mode 100644 .github/workflows/push.yml diff --git a/.github/scripts/rtrouted.sh b/.github/scripts/rtrouted.sh new file mode 100755 index 00000000..b75289ea --- /dev/null +++ b/.github/scripts/rtrouted.sh @@ -0,0 +1,12 @@ +#!/bin/bash +export RBUS_ROOT=${HOME}/rbus +export RBUS_INSTALL_DIR=${RBUS_ROOT}/install +export RBUS_BRANCH=main +mkdir -p $RBUS_INSTALL_DIR +cd $RBUS_ROOT +git clone https://github.com/rdkcentral/rbus +cmake -Hrbus -Bbuild/rbus -DCMAKE_INSTALL_PREFIX=${RBUS_INSTALL_DIR}/usr -DBUILD_FOR_DESKTOP=ON -DCMAKE_BUILD_TYPE=Debug +make -C build/rbus && make -C build/rbus install +export PATH=${RBUS_INSTALL_DIR}/usr/bin:${PATH} && \ +export LD_LIBRARY_PATH=${RBUS_INSTALL_DIR}/usr/lib:${LD_LIBRARY_PATH} +nohup rtrouted -f -l DEBUG > /tmp/rtrouted_log.txt & diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml new file mode 100644 index 00000000..5ef436fa --- /dev/null +++ b/.github/workflows/push.yml @@ -0,0 +1,92 @@ +# SPDX-FileCopyrightText: 2023 Comcast Cable Communications Management, LLC +# SPDX-License-Identifier: Apache-2.0 + +name: CI + +on: + pull_request: + push: + paths-ignore: + - 'AUTHORS' + - 'LICENSE' + - 'NOTICE' + - '**.md' + - '.gitignore' + tags-ignore: + - 'v[0-9]+.[0-9]+.[0-9]+' + branches: + - master + +jobs: + test: + name: Unit Tests + runs-on: [ ubuntu-latest ] + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + + # Install the dependent packages + - name: Install packages + run: | + sudo apt update + sudo apt-get -y install valgrind libcunit1 libcunit1-doc libcunit1-dev libmsgpack-dev gcovr libtool xsltproc docbook-xsl + pip install codecov + + - name: Make Build Directory + run: mkdir build + + - name: Get Sonarcloud Binaries + uses: xmidt-org/sonarcloud-installer-action@v1 + with: + working-directory: build + + - name: CMake + working-directory: build + run: | + cmake .. -DINTEGRATION_TESTING:BOOL=false -DDISABLE_VALGRIND:BOOL=${DISABLE_VALGRIND} -DENABLE_SESHAT:BOOL=true -DFEATURE_DNS_QUERY:BOOL=true + + + - name: Build + working-directory: build + run: | + build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir bw-output make + + - name: Get rtrouted Binary + working-directory: build + run: | + ../.github/scripts/rtrouted.sh + + - name: Unit tests run + working-directory: build + run: | + ps aux + export RBUS_ROOT=${HOME}/rbus + export RBUS_INSTALL_DIR=${RBUS_ROOT}/install + export PATH=${RBUS_INSTALL_DIR}/usr/bin:${PATH} + export LD_LIBRARY_PATH=${RBUS_INSTALL_DIR}/usr/lib:${LD_LIBRARY_PATH} + build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir bw-output make test + + - name: Stop rtrouted + run: | + killall -9 rtrouted + + - name: Merge GCOV Reports for Sonarcloud + working-directory: build + run: | + gcovr --sonarqube coverage.xml -r .. + + - name: Upload Codecov.io + uses: codecov/codecov-action@v1 + with: + directory: . + fail_ci_if_error: true + + # - name: Upload SonarCloud + # run: | + # build/sonar-scanner/bin/sonar-scanner -Dsonar.host.url=https://sonarcloud.io -Dproject.settings=.sonar-project.properties -Dsonar.login=${{ secrets.SONAR_TOKEN }} + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + +