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] Managing dependencies to make the workflows callable from different repos #28

Merged
merged 5 commits into from
Jan 16, 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
76 changes: 2 additions & 74 deletions .github/workflows/Build ThunderLibraries on Linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,83 +5,11 @@ on:
branches: ["main"]
pull_request:
branches: ["main"]
workflow_call:

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

ThunderLibraries:
needs: Thunder

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: Download artifacts
uses: actions/download-artifact@v3
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

- name: Checkout ThunderLibraries
uses: actions/checkout@v3
with:
path: ThunderLibraries
repository: ${{github.repository_owner}}/ThunderLibraries

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

- name: Build ThunderLibraries
run: |
cmake -G Ninja -S ThunderLibraries -B ${{matrix.build_type}}/build/ThunderLibraries \
-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" \
-DBROADCAST=ON \
${{steps.libs.outputs.first_match}}
cmake --build ${{matrix.build_type}}/build/ThunderLibraries --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: ThunderLibraries-${{matrix.build_type}}-artifact
path: ${{matrix.build_type}}.tar.gz
uses: VeithMetro/ThunderLibraries/.github/workflows/Linux build template.yml@development/actions
79 changes: 79 additions & 0 deletions .github/workflows/Linux build template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Build ThunderLibraries on Linux

on:
workflow_call:

jobs:
ThunderLibraries:

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: Download artifacts
uses: actions/download-artifact@v3
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

- name: Checkout ThunderLibraries
uses: actions/checkout@v3
with:
path: ThunderLibraries
repository: WebPlatformForEmbedded/ThunderLibraries

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

- name: Build ThunderLibraries
run: |
cmake -G Ninja -S ThunderLibraries -B ${{matrix.build_type}}/build/ThunderLibraries \
-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" \
-DBROADCAST=ON \
${{steps.libs.outputs.first_match}}
cmake --build ${{matrix.build_type}}/build/ThunderLibraries --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: ThunderLibraries-${{matrix.build_type}}-artifact
path: ${{matrix.build_type}}.tar.gz