Skip to content

Versions of Github actions updated #109

Versions of Github actions updated

Versions of Github actions updated #109

Workflow file for this run

#
# If not stated otherwise in this file or this component's LICENSE file the
# following copyright and licenses apply:
#
# Copyright 2023 Sky UK
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# This workflow builds and runs the rialto-ocdm unittests. The workflow shall fail if any test fails
# and the results of the tests are checked and displayed in github. Logs are uploaded on failure.
name: build_ut
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "master" branch
push:
branches: [ "master", "rdkcentral:master" ]
pull_request:
branches: [ "master", "rdkcentral:master" ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This job sets up the repo with the dependancies then runs the tests
build-test:
name: Build and test build_ut
# Runs on ubuntu
runs-on: ubuntu-22.04
# Timeout after
timeout-minutes: 60
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: checkout repo
uses: actions/checkout@v4
# Setup github for python 3.8
- name: setup python
uses: actions/setup-python@v5
with:
python-version: 3.8
# Setup gstreamer 1.0
- name: Build gstreamer library
run: |
sudo apt-get update
sudo apt-get install libunwind-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev gstreamer1.0-plugins-base
# Setup github for lcov 2.0
- name: Build lcov library
run: |
sudo apt-get install libjson-perl libperlio-gzip-perl perl libgd-gd2-perl libcapture-tiny-perl libdatetime-perl
wget https://github.com/linux-test-project/lcov/releases/download/v2.0/lcov-2.0.tar.gz
tar -xf lcov-2.0.tar.gz
cd lcov-2.0
sudo make install
# Check, from which rialto branch should we download headers
- name: Check if rialto branch with the same name exists
id: check-branch
shell: sh +e {0}
run: |
branch=master
if [ "$GITHUB_EVENT_NAME" = "pull_request" ]; then
git ls-remote --exit-code --heads "https://github.com/rdkcentral/rialto.git" ${{ github.event.pull_request.head.ref }} > /dev/null
if [ $? -eq 0 ]; then
branch="${{ github.event.pull_request.head.ref }}"
fi
fi
echo "branch=$branch" >> "$GITHUB_OUTPUT"
# Run the build script
- name: build_ut.py script
run: |
python build_ut.py -c -xml -f -cov -b ${{ steps.check-branch.outputs.branch }}
# Process the test results
- name: Check results
uses: dorny/test-reporter@v1
if: success() || failure()
with:
name: GTests
path: build/*gtest_result.xml
reporter: java-junit
# Upload logs on failure
- name: Upload logs
uses: actions/upload-artifact@v4
if: failure()
with:
name: logs
path: |
gtest_result.log
build/*gtest_result.xml
# Upload coverage report on success
- name: Upload Coverage Report
uses: actions/upload-artifact@v4
if: success()
with:
name: coverage_report
path: build/gh_pages/coverage_report
# Upload coverage statistics on success
- name: Upload Coverage Statistics
uses: actions/upload-artifact@v4
if: success()
with:
name: coverage_report_stats
path: build/coverage_statistics.txt
checks-the-cov-report:
name: Checks the Coverage Report
# Runs on ubuntu
runs-on: ubuntu-22.04
# Timeout after
timeout-minutes: 2
# # Define the dependencies on the previous coverage jobs
needs: [build-test]
steps:
- name: Checkout repo
uses: actions/checkout@v4
# Download the current coverage statistics
- name: Download Current Coverage Statistics
uses: actions/download-artifact@v4
with:
name: coverage_report_stats
path: build
# Download current master coverage statistics
- name: Download Master Coverage Statistics
uses: dawidd6/action-download-artifact@v3
if: ${{ success() && github.ref != 'refs/heads/master' }}
with:
workflow_conclusion: success
branch: master
name: coverage_report_stats
path: master_artifacts
# Run the process_coverage_stats script
- name: Process Coverage Statistics
if: ${{ success() && github.ref != 'refs/heads/master' }}
run: python scripts/coverage/process_coverage_stats.py ./master_artifacts/coverage_statistics.txt build/coverage_statistics.txt
# Get process_coverage_stats script output
- id: get-comment-body
if: ${{ (success() || failure()) && github.ref != 'refs/heads/master' }}
run: |
body="$(cat comparison_output.txt)"
body="${body//'%'/'%25'}"
body="${body//$'\n'/'%0A'}"
body="${body//$'\r'/'%0D'}"
echo "::set-output name=body::$body"
# Create comment with coverage info
- name: Create Coverage Comment
if: ${{ (success() || failure()) && github.ref != 'refs/heads/master' }}
uses: peter-evans/create-or-update-comment@v4
with:
issue-number: ${{ github.event.pull_request.number }}
body: ${{ steps.get-comment-body.outputs.body }}