-
Notifications
You must be signed in to change notification settings - Fork 1
112 lines (96 loc) · 3.87 KB
/
Linux build template.yml
File metadata and controls
112 lines (96 loc) · 3.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
name: Linux build template
permissions:
contents: read
on:
workflow_call:
jobs:
ThunderLibraries:
runs-on: ubuntu-24.04
strategy:
matrix:
build_type: [Debug, Release, MinSizeRel]
architecture: [32, 64]
# ----- Packages & artifacts -----
name: Build type - ${{matrix.build_type}}${{matrix.architecture == '32' && ' x86' || ''}}
steps:
- name: Prepare apt (add i386 if needed)
if: ${{ matrix.architecture == '32' }}
run: |
sudo dpkg --add-architecture i386
- name: Update apt indices (with retries)
shell: bash
run: |
set -euo pipefail
for attempt in {1..5}; do
if sudo apt-get update -o Acquire::Retries=5 -o Acquire::http::Timeout=30; then
break
fi
echo "apt-get update failed (attempt $attempt), retrying..."
sleep $((attempt*10))
done
- name: Install system dependencies
shell: bash
run: |
set -euo pipefail
export DEBIAN_FRONTEND=noninteractive
PKGS="python3-venv python3-pip build-essential cmake ninja-build libusb-1.0-0-dev"
if [ "${{ matrix.architecture }}" = "32" ]; then
PKGS="$PKGS zlib1g-dev:i386 libssl-dev:i386 libsbc-dev:i386 gcc-13-multilib g++-13-multilib"
else
PKGS="$PKGS zlib1g-dev libssl-dev libsbc-dev"
fi
for attempt in {1..4}; do
if sudo apt-get install -y --no-install-recommends $PKGS; then
break
fi
echo "apt-get install failed (attempt $attempt), cleaning up & retrying..."
sudo apt-get clean
sleep $((attempt*15))
done
- name: Set up Python environment
run: |
python3 -m venv venv
source venv/bin/activate
pip install --upgrade pip
pip install jsonref
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: Thunder-${{matrix.build_type}}${{matrix.architecture == '32' && '_x86' || ''}}-artifact
path: ${{matrix.build_type}}
- name: Unpack files
run: |
tar -xvzf ${{matrix.build_type}}/${{matrix.build_type}}${{matrix.architecture == '32' && '_x86' || ''}}.tar.gz
rm ${{matrix.build_type}}/${{matrix.build_type}}${{matrix.architecture == '32' && '_x86' || ''}}.tar.gz
# ----- Regex & checkout -----
- name: Checkout ThunderLibraries
uses: actions/checkout@v4
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}}
# ----- Building & uploading -----
- name: Build ThunderLibraries
run: |
source venv/bin/activate
cmake -G Ninja -S ThunderLibraries -B ${{matrix.build_type}}/build/ThunderLibraries \
-DCMAKE_CXX_FLAGS="-Wall -Wextra -Wpedantic -Werror -m${{matrix.architecture}}" \
-DCMAKE_C_FLAGS="-Wall -Wextra -Wpedantic -Werror -m${{matrix.architecture}}" \
-DCMAKE_INSTALL_PREFIX="${{matrix.build_type}}/install/usr" \
-DCMAKE_MODULE_PATH="${PWD}/${{matrix.build_type}}/install/usr/include/WPEFramework/Modules" \
${{steps.libs.outputs.first_match}}
# cmake --build ${{matrix.build_type}}/build/ThunderLibraries --target install
- name: Tar files
run: tar -czvf ${{matrix.build_type}}${{matrix.architecture == '32' && '_x86' || ''}}.tar.gz ${{matrix.build_type}}
- name: Upload
uses: actions/upload-artifact@v4
with:
name: ThunderLibraries-${{matrix.build_type}}${{matrix.architecture == '32' && '_x86' || ''}}-artifact
path: ${{matrix.build_type}}${{matrix.architecture == '32' && '_x86' || ''}}.tar.gz