Skip to content

Commit

Permalink
[Actions] Managing dependencies to make the workflows callable from d…
Browse files Browse the repository at this point in the history
…ifferent repos (#276)

* Making the Linux action callable

* Creating a template for the Linux build

* Using the template to build

* Updating the dependency tree in the main action file

* Changing the repo owner to be fixed since this workflow is callable now

* Add a branch restriction
  • Loading branch information
VeithMetro authored Jan 16, 2024
1 parent c59d01d commit fe77319
Show file tree
Hide file tree
Showing 2 changed files with 98 additions and 86 deletions.
92 changes: 6 additions & 86 deletions .github/workflows/Build ThunderNanoServicesRDK on Linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,93 +7,13 @@ on:
branches: ["master"]

jobs:
Thunder:
uses: VeithMetro/Thunder/.github/workflows/Linux build template.yml@development/actions

ThunderInterfaces:
uses: rdkcentral/ThunderInterfaces/.github/workflows/Build ThunderInterfaces on Linux.yml@master
needs: Thunder
uses: VeithMetro/ThunderInterfaces/.github/workflows/Linux build template.yml@development/actions

ThunderNanoServicesRDK:
needs: ThunderInterfaces

runs-on: ubuntu-latest

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

name: Build type - ${{matrix.build_type}}
steps:
- name: Install necessary packages
uses: nick-fields/retry@v2
with:
timeout_minutes: 10
max_attempts: 10
command: |
sudo gem install apt-spy2
sudo apt-spy2 fix --commit --launchpad --country=US
sudo apt-get update
sudo apt install python3-pip
pip install jsonref
sudo apt install build-essential cmake ninja-build libusb-1.0-0-dev zlib1g-dev libssl-dev
- name: Checkout Thunder
uses: actions/checkout@v3
with:
path: Thunder
repository: rdkcentral/Thunder

- name: Checkout ThunderInterfaces
uses: actions/checkout@v3
with:
path: ThunderInterfaces
repository: rdkcentral/ThunderInterfaces

- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: ThunderInterfaces-${{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
- name: Checkout ThunderNanoServicesRDK
uses: actions/checkout@v3
with:
path: ThunderNanoServicesRDK
repository: ${{github.repository_owner}}/ThunderNanoServicesRDK

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

- name: Build ThunderNanoServicesRDK
run: |
cmake -G Ninja -S ThunderNanoServicesRDK -B ${{matrix.build_type}}/build/ThunderNanoServicesRDK \
-DCMAKE_CXX_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" \
-DPLUGIN_DEVICEIDENTIFICATION=ON \
-DPLUGIN_DEVICEINFO=ON \
-DPLUGIN_LOCATIONSYNC=ON \
-DPLUGIN_MESSAGECONTROL=ON \
-DPLUGIN_MESSENGER=ON \
-DPLUGIN_MONITOR=ON \
-DPLUGIN_OPENCDMI=ON \
-DPLUGIN_PERFORMANCEMETRICS=ON \
${{steps.plugins.outputs.first_match}}
cmake --build ${{matrix.build_type}}/build/ThunderNanoServicesRDK --target install
- name: Tar files
run: tar -czvf ${{matrix.build_type}}.tar.gz ${{matrix.build_type}}

- name: Upload
uses: actions/upload-artifact@v3
with:
name: ThunderNanoServicesRDK-${{matrix.build_type}}-artifact
path: ${{matrix.build_type}}.tar.gz
uses: VeithMetro/ThunderNanoServicesRDK/.github/workflows/Linux build template.yml@development/actions
92 changes: 92 additions & 0 deletions .github/workflows/Linux build template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: Build ThunderNanoServicesRDK on Linux

on:
workflow_call:

jobs:
ThunderNanoServicesRDK:

runs-on: ubuntu-latest

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

name: Build type - ${{matrix.build_type}}
steps:
- name: Install necessary packages
uses: nick-fields/retry@v2
with:
timeout_minutes: 10
max_attempts: 10
command: |
sudo gem install apt-spy2
sudo apt-spy2 fix --commit --launchpad --country=US
sudo apt-get update
sudo apt install python3-pip
pip install jsonref
sudo apt install build-essential cmake ninja-build libusb-1.0-0-dev zlib1g-dev libssl-dev
- name: Checkout Thunder
uses: actions/checkout@v3
with:
path: Thunder
repository: rdkcentral/Thunder

- name: Checkout ThunderInterfaces
uses: actions/checkout@v3
with:
path: ThunderInterfaces
repository: rdkcentral/ThunderInterfaces

- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: ThunderInterfaces-${{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
- name: Checkout ThunderNanoServicesRDK
uses: actions/checkout@v3
with:
path: ThunderNanoServicesRDK
repository: WebPlatformForEmbedded/ThunderNanoServicesRDK

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

- name: Build ThunderNanoServicesRDK
run: |
cmake -G Ninja -S ThunderNanoServicesRDK -B ${{matrix.build_type}}/build/ThunderNanoServicesRDK \
-DCMAKE_CXX_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" \
-DPLUGIN_DEVICEIDENTIFICATION=ON \
-DPLUGIN_DEVICEINFO=ON \
-DPLUGIN_LOCATIONSYNC=ON \
-DPLUGIN_MESSAGECONTROL=ON \
-DPLUGIN_MESSENGER=ON \
-DPLUGIN_MONITOR=ON \
-DPLUGIN_OPENCDMI=ON \
-DPLUGIN_PERFORMANCEMETRICS=ON \
${{steps.plugins.outputs.first_match}}
cmake --build ${{matrix.build_type}}/build/ThunderNanoServicesRDK --target install
- name: Tar files
run: tar -czvf ${{matrix.build_type}}.tar.gz ${{matrix.build_type}}

- name: Upload
uses: actions/upload-artifact@v3
with:
name: ThunderNanoServicesRDK-${{matrix.build_type}}-artifact
path: ${{matrix.build_type}}.tar.gz

0 comments on commit fe77319

Please sign in to comment.