-
Notifications
You must be signed in to change notification settings - Fork 8
293 lines (263 loc) · 12.1 KB
/
build.yml
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
name: Build
on:
workflow_dispatch:
inputs:
build_bl_update:
description: Build bootloader update
type: boolean
required: false
default: false
build_debug:
type: boolean
required: false
default: false
workflow_call:
inputs:
build_bl_update:
type: boolean
required: false
default: false
memfault_sw_type:
type: string
required: false
default: "hello.nrfcloud.com-ci"
build_debug:
type: boolean
required: false
default: false
outputs:
run_id:
description: The run ID of the workflow to fetch artifacts from
value: ${{ jobs.build.outputs.run_id }}
version:
description: The version of the firmware built on this run_id
value: ${{ jobs.build.outputs.version }}
push:
branches:
- main
paths-ignore:
- "tests/on_target/**"
- ".github/workflows/test.yml"
- ".github/workflows/on_target.yml"
- ".github/workflows/docs-build-and-publish.yml"
- "docs/**"
pull_request:
paths-ignore:
- "tests/on_target/**"
- ".github/workflows/test.yml"
- ".github/workflows/on_target.yml"
- ".github/workflows/docs-build-and-publish.yml"
- "docs/**"
schedule:
- cron: "0 0 * * *"
jobs:
build:
runs-on: ubuntu-24.04
container: ghcr.io/zephyrproject-rtos/ci:v0.27.4
env:
CMAKE_PREFIX_PATH: /opt/toolchains
outputs:
run_id: ${{ github.run_id }}
version: ${{ env.VERSION }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
path: thingy91x-oob
- name: Initialize
working-directory: thingy91x-oob
run: |
west init -l .
west config manifest.group-filter +bsec
west config build.sysbuild True
west update -o=--depth=1 -n
west blobs fetch hal_nordic
- uses: robinraju/release-downloader@v1
with:
tag: 'v2.0.0-preview58'
fileName: 'nrf53-bl-v3-*.hex'
- uses: robinraju/release-downloader@v1
with:
tag: 'v2.0.0-preview58'
fileName: 'nrf91-bl-v2.hex'
- name: Install dependencies
run: |
pip install -r nrf/scripts/requirements-build.txt
- name: Set VERSION environment variable
shell: bash
run: |
if [[ "${{ startsWith(github.ref, 'refs/tags/') }}" == "true" ]]; then
echo "VERSION=${{ github.ref_name }}" >> $GITHUB_ENV
else
echo "VERSION=${{ github.sha }}" >> $GITHUB_ENV
fi
- name: Update VERSION file for release
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
working-directory: thingy91x-oob
run: |
python3 scripts/app_version.py ${GITHUB_REF_NAME} > app/VERSION
cat app/VERSION
- name: Set MEMFAULT_SW_TYPE from inputs or use default
run: |
if [ -z "${{ inputs.memfault_sw_type }}" ]; then
echo "MEMFAULT_SW_TYPE=hello.nrfcloud.com-ci" >> $GITHUB_ENV
else
echo "MEMFAULT_SW_TYPE=${{ inputs.memfault_sw_type }}" >> $GITHUB_ENV
fi
# Out-of-box firmware build
- name: Build nrf91 firmware
working-directory: thingy91x-oob/app
run: |
cp overlay-memfault.conf overlay-memfault-oob.conf
echo "CONFIG_MEMFAULT_NCS_PROJECT_KEY=\"${{ secrets.MEMFAULT_PROJECT_KEY }}\"" >> overlay-memfault-oob.conf
echo CONFIG_MEMFAULT_NCS_FW_VERSION_STATIC=y >> overlay-memfault-oob.conf
echo CONFIG_MEMFAULT_NCS_FW_VERSION=\"${{ env.VERSION }}\" >> overlay-memfault-oob.conf
echo CONFIG_MEMFAULT_NCS_FW_TYPE=\"${{ env.MEMFAULT_SW_TYPE }}\" >> overlay-memfault-oob.conf
west build -b thingy91x/nrf9151/ns -p --sysbuild -- -DEXTRA_CONF_FILE="overlay-memfault-oob.conf"
- name: Rename artifacts
working-directory: thingy91x-oob/app/build
run: |
cp ../../../nrf91-bl-*.hex .
# Overwrite the bootloader part with the frozen version
python3 ../../../zephyr/scripts/build/mergehex.py -o \
hello.nrfcloud.com-${{ env.VERSION }}-thingy91x-nrf91.hex \
merged.hex \
nrf91-bl-*.hex \
--overlap replace
cp app/zephyr/.config hello.nrfcloud.com-${{ env.VERSION }}-thingy91x-nrf91.config
cp app/zephyr/zephyr.signed.bin hello.nrfcloud.com-${{ env.VERSION }}-thingy91x-nrf91-update-signed.bin
cp app/zephyr/zephyr.signed.hex hello.nrfcloud.com-${{ env.VERSION }}-thingy91x-nrf91-update-signed.hex
cp app/zephyr/zephyr.elf hello.nrfcloud.com-${{ env.VERSION }}-thingy91x-nrf91.elf
cp dfu_application.zip hello.nrfcloud.com-${{ env.VERSION }}-thingy91x-nrf91-dfu.zip
- name: Create partition manager report for nRF91 firmware
working-directory: thingy91x-oob/app/build
run: |
ninja partition_manager_report
ninja partition_manager_report > pmr-nrf91-default-${{ env.VERSION }}.txt
sed -i '1d' pmr-nrf91-default-${{ env.VERSION }}.txt
- name: Upload artifact
uses: actions/upload-artifact@v4
id: artifact-upload-oob
with:
name: firmware-oob
if-no-files-found: error
path: |
thingy91x-oob/app/build/hello.nrfcloud.com-*.*
thingy91x-oob/app/build/nrf91-bl-*.hex
thingy91x-oob/app/build/pmr-nrf91-*.txt
# Out-of-box debug firmware build
- name: Build nrf91 debug firmware
if: ${{ inputs.build_debug }}
working-directory: thingy91x-oob/app
run: |
cp overlay-memfault.conf overlay-memfault-debug.conf
echo "CONFIG_MEMFAULT_NCS_PROJECT_KEY=\"${{ secrets.MEMFAULT_PROJECT_KEY }}\"" >> overlay-memfault-debug.conf
echo CONFIG_MEMFAULT_NCS_FW_VERSION_STATIC=y >> overlay-memfault-debug.conf
echo CONFIG_MEMFAULT_NCS_FW_VERSION=\"${{ env.VERSION }}+debug\" >> overlay-memfault-debug.conf
echo CONFIG_MEMFAULT_NCS_FW_TYPE=\"${{ env.MEMFAULT_SW_TYPE }}\" >> overlay-memfault-debug.conf
echo CONFIG_APP_MEMFAULT_UPLOAD_METRICS_ON_CLOUD_READY=y >> overlay-memfault-debug.conf
west build -p -b thingy91x/nrf9151/ns -p --sysbuild -- -DEXTRA_CONF_FILE="overlay-memfault-debug.conf;overlay-modemtrace-to-memfault.conf;overlay-etb.conf"
- name: Rename debug artifacts
if: ${{ inputs.build_debug }}
working-directory: thingy91x-oob/app/build
run: |
cp ../../../nrf91-bl-*.hex .
# Overwrite the bootloader part with the frozen version
python3 ../../../zephyr/scripts/build/mergehex.py -o \
hello.nrfcloud.com-${{ env.VERSION }}+debug-thingy91x-nrf91.hex \
merged.hex \
nrf91-bl-*.hex \
--overlap replace
cp app/zephyr/.config hello.nrfcloud.com-${{ env.VERSION }}+debug-thingy91x-nrf91.config
cp app/zephyr/zephyr.signed.bin hello.nrfcloud.com-${{ env.VERSION }}+debug-thingy91x-nrf91-update-signed.bin
cp app/zephyr/zephyr.signed.hex hello.nrfcloud.com-${{ env.VERSION }}+debug-thingy91x-nrf91-update-signed.hex
cp app/zephyr/zephyr.elf hello.nrfcloud.com-${{ env.VERSION }}+debug-thingy91x-nrf91.elf
cp dfu_application.zip hello.nrfcloud.com-${{ env.VERSION }}+debug-thingy91x-nrf91-dfu.zip
- name: Create partition manager report for nRF91 debug firmware
if: ${{ inputs.build_debug }}
working-directory: thingy91x-oob/app/build
run: |
ninja partition_manager_report
ninja partition_manager_report > pmr-nrf91-debug-${{ env.VERSION }}.txt
sed -i '1d' pmr-nrf91-debug-${{ env.VERSION }}.txt
- name: Upload artifact
if: ${{ inputs.build_debug }}
uses: actions/upload-artifact@v4
id: artifact-upload-oob-debug
with:
name: firmware-oob-debug
if-no-files-found: error
path: |
thingy91x-oob/app/build/hello.nrfcloud.com-*.*
thingy91x-oob/app/build/pmr-nrf91-*.txt
# Connectivity Bridge firmware build
- name: Build nrf53 firmware
working-directory: nrf/applications/connectivity_bridge
run: |
west build -b thingy91x/nrf5340/cpuapp -p --sysbuild -- -Dmcuboot_CONFIG_FW_INFO_FIRMWARE_VERSION=3 -DCONFIG_BUILD_S1_VARIANT=y
- name: Create partition manager report for nRF53 firmware
working-directory: nrf/applications/connectivity_bridge/build
run: |
ninja partition_manager_report
ninja partition_manager_report > pmr-nrf53-default-${{ env.VERSION }}.txt
sed -i '1d' pmr-nrf53-default-${{ env.VERSION }}.txt
- name: Create nrf53 merged_domains HEX file
run: |
# check that bootloader hex files are present
ls $(pwd)/nrf53-bl-v*-net.hex $(pwd)/nrf53-bl-v*-app.hex
# merge hex files to app, net and merged variants, enforcing the frozen bootloader
python3 zephyr/scripts/build/mergehex.py -o \
$(pwd)/nrf/applications/connectivity_bridge/build/connectivity-bridge-${{ env.VERSION }}-thingy91x-nrf53-net.hex \
$(pwd)/nrf/applications/connectivity_bridge/build/merged_CPUNET.hex \
$(pwd)/nrf53-bl-v*-net.hex \
--overlap replace
python3 zephyr/scripts/build/mergehex.py -o \
$(pwd)/nrf/applications/connectivity_bridge/build/connectivity-bridge-${{ env.VERSION }}-thingy91x-nrf53-app.hex \
$(pwd)/nrf/applications/connectivity_bridge/build/merged.hex \
$(pwd)/nrf53-bl-v*-app.hex \
--overlap replace
python3 zephyr/scripts/build/mergehex.py -o \
$(pwd)/nrf/applications/connectivity_bridge/build/connectivity-bridge-${{ env.VERSION }}-thingy91x-nrf53-merged.hex \
$(pwd)/nrf/applications/connectivity_bridge/build/connectivity-bridge-${{ env.VERSION }}-thingy91x-nrf53-app.hex \
$(pwd)/nrf/applications/connectivity_bridge/build/connectivity-bridge-${{ env.VERSION }}-thingy91x-nrf53-net.hex
- name: Copy nrf53 DFU file
run: |
cp $(pwd)/nrf/applications/connectivity_bridge/build/dfu_application.zip \
$(pwd)/nrf/applications/connectivity_bridge/build/connectivity-bridge-${{ env.VERSION }}-thingy91x-nrf53-dfu.zip
cp nrf53-bl-*.hex $(pwd)/nrf/applications/connectivity_bridge/build/
- name: Upload artifact
uses: actions/upload-artifact@v4
id: artifact-upload-connectivity-bridge
with:
name: firmware-connectivity-bridge
if-no-files-found: error
path: |
nrf/applications/connectivity_bridge/build/connectivity-bridge-*.*
nrf/applications/connectivity_bridge/build/nrf53-bl-*.hex
nrf/applications/connectivity_bridge/build/pmr-nrf53-*.txt
# Bootloader update build
- name: Build BL Update
if: ${{ inputs.build_bl_update }}
working-directory: thingy91x-oob
run: |
west twister -T . --test app/app.build.bootloader_update -v -p thingy91x/nrf9151/ns --inline-logs
cp twister-out/thingy91x_nrf9151_ns/app/app.build.bootloader_update/dfu_mcuboot.zip \
hello.nrfcloud.com-${{ env.VERSION }}-thingy91x-nrf91-bootloader.zip
rm -rf twister-out
west build -b thingy91x/nrf5340/cpuapp -p --sysbuild -d ../nrf/applications/connectivity_bridge/build-bl-update ../nrf/applications/connectivity_bridge -- -Dmcuboot_CONFIG_FW_INFO_FIRMWARE_VERSION=4 -DCONFIG_BUILD_S1_VARIANT=y
cp ../nrf/applications/connectivity_bridge/build-bl-update/dfu_mcuboot.zip \
connectivity-bridge-${{ env.VERSION }}-thingy91x-nrf53-bootloader.zip
- name: Upload artifact
if: ${{ inputs.build_bl_update }}
uses: actions/upload-artifact@v4
id: artifact-upload-bl-update
with:
name: firmware-bl-update
if-no-files-found: error
path: |
thingy91x-oob/hello.nrfcloud.com-*.*
thingy91x-oob/connectivity-bridge-*.*
- name: Print run-id and fw version
run: |
echo Run id: ${{ github.run_id }}
echo Version: ${{ env.VERSION }}