-
Notifications
You must be signed in to change notification settings - Fork 8
147 lines (128 loc) · 5.53 KB
/
Linux build template.yml
File metadata and controls
147 lines (128 loc) · 5.53 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
name: Linux build template
permissions:
contents: read
on:
workflow_call:
jobs:
ThunderNanoServicesRDK:
runs-on: ubuntu-24.04
strategy:
matrix:
build_type: [Debug, Release, MinSizeRel]
architecture: [32, 64]
# --------- Packages install & artifacts download ---------
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 autoconf automake libtool libtool-bin pkg-config"
if [ "${{ matrix.architecture }}" = "32" ]; then
PKGS="$PKGS zlib1g-dev:i386 libssl-dev:i386 libsbc-dev:i386 gcc-13-multilib g++-13-multilib libarchive-dev:i386 libcurl4-openssl-dev:i386 libgpgme-dev:i386 libgpg-error-dev:i386 libgstreamer1.0-dev:i386 libdrm-dev:i386"
else
PKGS="$PKGS zlib1g-dev libssl-dev libsbc-dev libarchive-dev libcurl4-openssl-dev libgpgme-dev libgpg-error-dev libgstreamer1.0-dev libdrm-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: ThunderInterfaces-${{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
# ----- Checkout & Options regex -----
- name: Checkout ThunderNanoServicesRDK
uses: actions/checkout@v4
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: Checkout libopkg
uses: actions/checkout@v4
with:
path: opkg
repository: oe-mirrors/opkg
# ----- Build & upload artifacts -----
- name: Build libopkg
run: |
export PKG_CONFIG_PATH=/usr/lib/${{matrix.architecture == '32' && 'i386' || 'x86_64'}}-linux-gnu/pkgconfig:$PKG_CONFIG_PATH
cd opkg
./autogen.sh || true
./configure --prefix=/usr/local ${{matrix.architecture == '32' && 'CFLAGS="-m32" LDFLAGS="-m32"' || ''}}
make
sudo make install
- name: Install libopkg headers
run: |
sudo mkdir -p /usr/local/include/libopkg
sudo cp $GITHUB_WORKSPACE/opkg/libopkg/*.h /usr/local/include/libopkg
- name: Build ThunderNanoServicesRDK
run: |
source venv/bin/activate
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib/${{matrix.architecture == '32' && 'i386' || 'x86_64'}}-linux-gnu/pkgconfig:$PKG_CONFIG_PATH
cmake -G Ninja -S ThunderNanoServicesRDK -B ${{matrix.build_type}}/build/ThunderNanoServicesRDK \
-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" \
-DPLUGIN_BRIDGELINK=ON \
-DPLUGIN_DEVICEIDENTIFICATION=ON \
-DPLUGIN_DEVICEINFO=ON \
-DPLUGIN_DISPLAYINFO=ON \
-DPLUGIN_LOCATIONSYNC=ON \
-DPLUGIN_MESSAGECONTROL=ON \
-DPLUGIN_MESSENGER=ON \
-DPLUGIN_MONITOR=ON \
-DPLUGIN_OPENCDMI=ON \
-DPLUGIN_PACKAGER=ON \
-DPLUGIN_PERFORMANCEMETRICS=ON \
-DPLUGIN_PLAYERINFO=ON \
-DPLUGIN_RUSTBRIDGE=ON \
-DPLUGIN_SECURITYAGENT=ON \
${{steps.plugins.outputs.first_match}}
cmake --build ${{matrix.build_type}}/build/ThunderNanoServicesRDK --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: ThunderNanoServicesRDK-${{matrix.build_type}}${{matrix.architecture == '32' && '_x86' || ''}}-artifact
path: ${{matrix.build_type}}${{matrix.architecture == '32' && '_x86' || ''}}.tar.gz