Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Actions] Adding a MacOS build workflow and making sure it is warning-free #395

Merged
merged 16 commits into from
Nov 12, 2024
Merged
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
28 changes: 28 additions & 0 deletions .github/workflows/Build ThunderInterfaces on MacOS.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Build ThunderInterfaces on MacOS

on:
workflow_dispatch:
push:
branches: ["master"]
pull_request:
branches: ["master"]

jobs:
Thunder:
uses: rdkcentral/Thunder/.github/workflows/MacOS build template.yml@master

ThunderInterfaces:
needs: Thunder
uses: rdkcentral/ThunderInterfaces/.github/workflows/MacOS build template.yml@master

# ThunderClientLibraries:
# needs: ThunderInterfaces
# uses: rdkcentral/ThunderClientLibraries/.github/workflows/Linux build template.yml@master

# ThunderNanoServices:
# needs: ThunderInterfaces
# uses: rdkcentral/ThunderNanoServices/.github/workflows/Linux build template.yml@master

# ThunderNanoServicesRDK:
# needs: ThunderInterfaces
# uses: WebPlatformForEmbedded/ThunderNanoServicesRDK/.github/workflows/Linux build template.yml@master
80 changes: 80 additions & 0 deletions .github/workflows/MacOS build template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: MacOS build template

on:
workflow_call:

jobs:
Thunder:
runs-on: macos-14

strategy:
matrix:
build_type: [Debug, Release, MinSizeRel]

name: Build type - ${{matrix.build_type}}
steps:
# --------- Installing packages & downloading artifacts ---------
- name: Install necessary packages
run: |
brew update
brew upgrade
brew install ninja zlib
python3 -m venv venv
source venv/bin/activate
pip install jsonref

- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: Thunder-${{matrix.build_type}}-artifact
path: ${{matrix.build_type}}

- name: Unpack files
run: |
tar -xvzf ${{matrix.build_type}}/${{matrix.build_type}}.tar.gz
rm ${{matrix.build_type}}/${{matrix.build_type}}.tar.gz

# ----- Checkout & DependsOn regex -----
- name: Checkout ThunderInterfaces - default
if: ${{ !contains(github.event.pull_request.body, '[DependsOn=ThunderInterfaces:') }}
uses: actions/checkout@v4
with:
path: ThunderInterfaces
repository: rdkcentral/ThunderInterfaces

- name: Regex ThunderInterfaces
if: contains(github.event.pull_request.body, '[DependsOn=ThunderInterfaces:')
id: thunderinterfaces
uses: AsasInnab/regex-action@v1
with:
regex_pattern: '(?<=\[DependsOn=ThunderInterfaces:).*(?=\])'
regex_flags: 'gim'
search_string: ${{github.event.pull_request.body}}

- name: Checkout ThunderInterfaces - ${{steps.thunderinterfaces.outputs.first_match}}
if: contains(github.event.pull_request.body, '[DependsOn=ThunderInterfaces:')
uses: actions/checkout@v4
with:
path: ThunderInterfaces
repository: rdkcentral/ThunderInterfaces
ref: ${{steps.thunderinterfaces.outputs.first_match}}

# ----- Building & uploading -----
- name: Build ThunderInterfaces
run: |
source venv/bin/activate
cmake -G Ninja -S ThunderInterfaces -B ${{matrix.build_type}}/build/ThunderInterfaces \
-DCMAKE_CXX_FLAGS="-Wall -Wextra -Wpedantic -Werror" \
-DCMAKE_C_FLAGS="-Wall -Wextra -Wpedantic -Werror" \
-DCMAKE_INSTALL_PREFIX="${{matrix.build_type}}/install/usr" \
-DCMAKE_MODULE_PATH="${PWD}/${{matrix.build_type}}/install/usr/include/WPEFramework/Modules"
cmake --build ${{matrix.build_type}}/build/ThunderInterfaces --target install

- name: Tar files
run: tar -czvf ${{matrix.build_type}}.tar.gz ${{matrix.build_type}}

- name: Upload
uses: actions/upload-artifact@v4
with:
name: ThunderInterfaces-${{matrix.build_type}}-artifact
path: ${{matrix.build_type}}.tar.gz
9 changes: 8 additions & 1 deletion interfaces/DRMHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,14 @@ class BufferReader {

// Read a value from the stream, performing endian correction,
// and advance the stream pointer.
inline bool Read1(uint8_t* v) WARNING_RESULT_NOT_USED { return Read(v); }
inline bool Read1(uint8_t* v) WARNING_RESULT_NOT_USED
{
if ((v != nullptr) && (HasBytes(1) == true)) {
*v = buf_[pos_++];
return true;
}
return false;
}
inline bool Read2(uint16_t* v) WARNING_RESULT_NOT_USED { return Read(v); }
inline bool Read2s(int16_t* v) WARNING_RESULT_NOT_USED { return Read(v); }
inline bool Read4(uint32_t* v) WARNING_RESULT_NOT_USED { return Read(v); }
Expand Down