|
| 1 | +name: L2 HAL Plugins using Mock |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ develop, 'sprint/**', 'release/**' ,main,'topic/**'] |
| 6 | + paths: |
| 7 | + - HdmiCecSource/** |
| 8 | + - HdmiCecSink/** |
| 9 | + - FrontPanel/** |
| 10 | + - HdcpProfile/** |
| 11 | + - DeviceDiagnostics/** |
| 12 | + |
| 13 | + pull_request: |
| 14 | + branches: [ develop, 'sprint/**', 'release/**' ,main, 'feature/**','topic/**'] |
| 15 | + paths: |
| 16 | + - HdmiCecSource/** |
| 17 | + - HdmiCecSink/** |
| 18 | + - FrontPanel/** |
| 19 | + - HdcpProfile/** |
| 20 | + - DeviceDiagnostics/** |
| 21 | + |
| 22 | +jobs: |
| 23 | + L2_HAL_Plugins_using_Mock: |
| 24 | + runs-on: ubuntu-22.04 |
| 25 | + #container: |
| 26 | + #image: partners.artifactory.comcast.com/rdk-docker/mw_hal_emulator_docker_image:latest |
| 27 | + #credentials: |
| 28 | + #username: ${{ vars.RDKE_ARTIFACTORY_USER }} |
| 29 | + #password: ${{ secrets.RDKE_ARTIFACTORY_USER_APIKEY }} |
| 30 | + |
| 31 | + steps: |
| 32 | + - uses: actions/checkout@v2 |
| 33 | + with: |
| 34 | + fetch-depth: 0 |
| 35 | + |
| 36 | + #- name: Download .env Config file for authorization of repositories |
| 37 | + # run: | |
| 38 | + # #echo $SHELL |
| 39 | + # curl -v -u ${{ secrets.HAL_EMULATOR_MANIFEST_USERNAME }}:${{ secrets.HAL_EMULATOR_MANIFEST_PASSWORD }} \ |
| 40 | + # -o .env \ |
| 41 | + # https://raw.githubusercontent.com/rdk-e/rdkservices/develop/L2HalMock/workflowConfig.env?token=GHSAT0AAAAAACP3CS2MBK2A7SRVN6WJJZ7WZWEMXRA |
| 42 | + |
| 43 | + #- name: Source .env Config file for authorization |
| 44 | + #id: set-env |
| 45 | + # shell: sh |
| 46 | + # run: | |
| 47 | + # set -a |
| 48 | + # . $GITHUB_WORKSPACE/.env |
| 49 | + # set +a |
| 50 | + # echo "USERNAME=$USERNAME" >> $GITHUB_ENV |
| 51 | + # echo "PASSWORD=$PASSWORD" >> $GITHUB_ENV |
| 52 | + |
| 53 | + |
| 54 | + - name: Fetch the changed file from given paths |
| 55 | + # id: getfile |
| 56 | + # run: | |
| 57 | + # #git config --global --add safe.directory /__w/rdkservices/rdkservices |
| 58 | + # #if [ "${{ github.event_name }}" = "pull_request" ]; then |
| 59 | + # #echo "::set-output name=files::$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} | xargs)" |
| 60 | + # #else |
| 61 | + # #echo "::set-output name=files::$(git diff-tree --no-commit-id --name-only -r ${{ github.sha }} | xargs)" |
| 62 | + # #fi |
| 63 | + # name: Fetch the changed file from given paths |
| 64 | + id: getfile |
| 65 | + run: | |
| 66 | + git config --global --add safe.directory /__w/entservices-inputoutput/entservices-inputoutput |
| 67 | + if [ "${{ github.event_name }}" = "pull_request" ]; then |
| 68 | + echo "::set-output name=files::$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} | xargs)" |
| 69 | + else |
| 70 | + echo "::set-output name=files::$(git diff-tree --no-commit-id --name-only -r ${{ github.sha }} | xargs)" |
| 71 | + fi |
| 72 | +
|
| 73 | + |
| 74 | + - name: Plugin to be build |
| 75 | + run: | |
| 76 | + echo "PLUGIN_NAME=${{ steps.getfile.outputs.files }}" >> $GITHUB_ENV |
| 77 | + #echo ${{ steps.getfile.outputs.files }} >> $PLUGIN_NAME |
| 78 | +
|
| 79 | + - name: Plugin Name Extract |
| 80 | + id: extract_plugin |
| 81 | + run: | |
| 82 | + PLUGIN_NAME="${{ steps.getfile.outputs.files }}" |
| 83 | + keyword=$(python3 -c " |
| 84 | + import os |
| 85 | + import sys |
| 86 | + |
| 87 | + def extract_keyword(plugin_name): |
| 88 | + paths = plugin_name.split() |
| 89 | + for path in paths: |
| 90 | + keyword = path.split('/')[0] |
| 91 | + if keyword.lower() in ['hdmicecsource', 'hdmicecsink','frontpanel','hdcpprofile']: |
| 92 | + return keyword |
| 93 | + return None |
| 94 | + |
| 95 | + plugin_name = os.environ.get('PLUGIN_NAME', '') |
| 96 | + if not plugin_name: |
| 97 | + print('PLUGIN_NAME environment variable is not set.') |
| 98 | + sys.exit(1) |
| 99 | + |
| 100 | + keyword = extract_keyword(plugin_name) |
| 101 | + if keyword: |
| 102 | + print(keyword) |
| 103 | + else: |
| 104 | + print('No matching keyword found.') |
| 105 | + sys.exit(1) |
| 106 | + ") |
| 107 | + echo "PLUGIN_NAME=$keyword" >> $GITHUB_ENV |
| 108 | +
|
| 109 | +
|
| 110 | + if: contains(steps.getfile.outputs.files, 'HdmiCecSource') || contains(steps.getfile.outputs.files, 'HdmiCecSink') |
| 111 | + - name: Clone the Manifest and build the associated binaries |
| 112 | + run: | |
| 113 | + apt-get install csvtool |
| 114 | + apt-get install meson |
| 115 | + apt-get update && apt-get install -y lynx |
| 116 | + rm -rf rdkservices |
| 117 | + apt install libjsoncpp-dev |
| 118 | + #git clone -b topic/RDK-55408 https://${{secrets.HAL_EMULATOR_MANIFEST_USERNAME}}:${{ secrets.HAL_EMULATOR_MANIFEST_PASSWORD}}@github.com/rdk-e/entservices-inputoutput.git |
| 119 | + git clone -b topic/RDK-57404 https://akrish905_comcast:[email protected]/rdk-e/entservices-inputoutput.git |
| 120 | + cd entservices-inputoutput/L2HalMock |
| 121 | + #git clone -b peru https://${{secrets.HAL_EMULATOR_MANIFEST_USERNAME}}:${{ secrets.HAL_EMULATOR_MANIFEST_PASSWORD}}@github.com/rdk-e/FLASK-for-Hal-Mock.git |
| 122 | + git clone -b peru https:///akrish905_comcast:[email protected]/rdk-e/FLASK-for-Hal-Mock.git |
| 123 | + cd FLASK-for-Hal-Mock |
| 124 | + mv peru.yaml .. |
| 125 | + #cp -r peru.yaml __w/rdkservices/rdkservices/rdkservices/L2HalMock |
| 126 | + cd .. |
| 127 | + #sed -i 's/USERNAME_PLACEHOLDER/${{ secrets.PERU_USERNAME }}/g' peru.yaml |
| 128 | + #sed -i 's/PASSWORD_PLACEHOLDER/${{ secrets.PERU_PASSWORD }}/g' peru.yaml |
| 129 | + sed -i 's/USERNAME_PLACEHOLDER/akrish905_comcast/g' peru.yaml |
| 130 | + sed -i 's/PASSWORD_PLACEHOLDER/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/g' peru.yaml |
| 131 | + #sed -i 's/L2HAL_USERNAME_PLACEHOLDER/${{ secrets.L2HAL_USERNAME }}/g' peru.yaml |
| 132 | + #sed -i 's/L2HAL_PASSWORD_PLACEHOLDER/${{ secrets.L2HAL_PASSWORD }}/g' peru.yaml |
| 133 | + chmod -Rf 777 build.sh |
| 134 | + ./build.sh $PLUGIN_NAME |
| 135 | + shell: bash |
| 136 | + continue-on-error: false |
| 137 | + |
| 138 | + - name: Start all services, Execute testcases |
| 139 | + run: | |
| 140 | + cd rdkservices/L2HalMock |
| 141 | + echo "$$$$$$$$$$$ make all services up $$$$$$$$$$$$$$$$" |
| 142 | + chmod -Rf 777 run.sh |
| 143 | + ./run.sh $PLUGIN_NAME |
| 144 | + echo "Execute TEST SUITE" |
| 145 | + #Start-Sleep -s 60 |
| 146 | + #cd Tests/L2HALMockTests/Test_Framework |
| 147 | + cd workspace/deps/rdk/flask/Test_Framework |
| 148 | + # ./restart.sh |
| 149 | + python3 TestManager.py $PLUGIN_NAME |
| 150 | + killall -QUIT WPEFramework |
| 151 | + continue-on-error: false |
| 152 | + |
| 153 | + - name: Generating code coverage report |
| 154 | + run: | |
| 155 | + apt-get install -y neovim |
| 156 | + apt-get -y update |
| 157 | + apt-get install -y lcov |
| 158 | + ${pwd} |
| 159 | + #cd rdkservices/build/HdmiCecSource/CMakeFiles/WPEFrameworkHdmiCecSource.dir |
| 160 | + ls |
| 161 | + # killall -QUIT WPEFramework |
| 162 | + ${pwd} |
| 163 | + cd rdkservices/L2HalMock |
| 164 | + # nvim rdkservices/HdmiCecSink/HdmiCecSink.cpp |
| 165 | + ./generate_coveragereport.sh |
| 166 | + continue-on-error: false |
| 167 | + |
| 168 | + - name: copying code coverage report |
| 169 | + run: | |
| 170 | + cd rdkservices/L2HalMock |
| 171 | + cp -r coverage /tmp/coverage |
| 172 | + continue-on-error: false |
| 173 | + |
| 174 | + - name: Generating Test report |
| 175 | + run: | |
| 176 | + echo "********************" |
| 177 | + cd rdkservices/L2HalMock/workspace/deps/rdk/flask/Test_Framework |
| 178 | + pwd |
| 179 | + echo "Latest Results of the Run in CSV Format" |
| 180 | + more TestReport.csv |
| 181 | + #csvtool readable TestReport.csv | sed -e 's/,,/,,/g' | column -s, -t | less -#5 -N -S |
| 182 | + echo "Processing HTML Report" |
| 183 | + cd 'Test Execution Reports' |
| 184 | + lynx -dump "$(ls -t | head -n 1)" |
| 185 | + latest_file=$(ls -t | head -n 1) |
| 186 | + cp "$latest_file" /tmp/report_L2-hal-plugins-tests.html |
| 187 | + shell: bash |
| 188 | + continue-on-error: false |
| 189 | + |
| 190 | + |
| 191 | + - name: Generating code coverage report |
| 192 | + run: | |
| 193 | + apt-get install -y neovim |
| 194 | + apt-get -y update |
| 195 | + apt-get install -y lcov |
| 196 | + ${pwd} |
| 197 | + #cd rdkservices/build/HdmiCecSource/CMakeFiles/WPEFrameworkHdmiCecSource.dir |
| 198 | + ls |
| 199 | + # killall -QUIT WPEFramework |
| 200 | + ${pwd} |
| 201 | + cd rdkservices/L2HalMock |
| 202 | + # nvim rdkservices/HdmiCecSink/HdmiCecSink.cpp |
| 203 | + ./generate_coveragereport.sh |
| 204 | + continue-on-error: false |
| 205 | + |
| 206 | + |
| 207 | + - name: copying code coverage report |
| 208 | + if: contains(steps.getfile.outputs.files, 'HdmiCecSource') |
| 209 | + run: | |
| 210 | + cd rdkservices/L2HalMock |
| 211 | + cp -r coverage /tmp/coverage |
| 212 | + continue-on-error: false |
| 213 | + |
| 214 | + |
| 215 | + - name: Stop all services |
| 216 | + run: | |
| 217 | + echo "$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$^^^^^^^^^^^^^^^^^^^^^^^^^^^^" |
| 218 | + netstat -ntlp |
| 219 | + cd rdkservices/L2HALMock/start_services |
| 220 | + python3 stop_run.py |
| 221 | + continue-on-error: true |
| 222 | + |
| 223 | + - name: Cache the Reports |
| 224 | + id: report |
| 225 | + run: | |
| 226 | + cd rdkservices/L2HalMock/workspace/deps/rdk/flask/Test_Framework |
| 227 | + # Get the latest file with .html extension using absolute path |
| 228 | + latest_report=$(realpath $(pwd)/'Test Execution Reports'/*.html | tail -n 1) |
| 229 | + echo "Uploading: $latest_report" |
| 230 | + echo "latest_report = $latest_report" >> $GITHUB_ENV |
| 231 | + continue-on-error: false |
| 232 | + |
| 233 | + - name: Upload artifacts code coverage |
| 234 | + uses: actions/upload-artifact@v4 |
| 235 | + with: |
| 236 | + name: artifacts_code_coverage |
| 237 | + path: /tmp/coverage |
| 238 | + if-no-files-found: error |
| 239 | + retention-days: 5 |
| 240 | + continue-on-error: false |
| 241 | + |
| 242 | + - name: Upload artifacts test report |
| 243 | + uses: actions/upload-artifact@v4 |
| 244 | + with: |
| 245 | + name: artifacts_report_L2-hal-plugins-tests |
| 246 | + path: /tmp/report_L2-hal-plugins-tests.html |
| 247 | + if-no-files-found: error |
| 248 | + retention-days: 5 |
| 249 | + continue-on-error: false |
0 commit comments