-
Notifications
You must be signed in to change notification settings - Fork 9
185 lines (164 loc) · 7.66 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
name: Build
on:
workflow_dispatch:
inputs:
build_bl_update:
description: Build bootloader update
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"
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
pull_request:
schedule:
- cron: "0 0 * * *"
jobs:
build:
runs-on: ubuntu-22.04
container: ghcr.io/zephyrproject-rtos/ci:v0.26.14
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
- 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
- name: Apply nrf_wifi HAL patch
run: git apply thingy91x-oob/scripts/nrf_wifi_hal_memory_leak_fix.patch --directory=nrfxlib
- name: Build nrf91 firmware
working-directory: thingy91x-oob/app
run: |
echo "CONFIG_MEMFAULT_NCS_PROJECT_KEY=\"${{ secrets.MEMFAULT_PROJECT_KEY }}\"" >> overlay-memfault.conf
echo CONFIG_MEMFAULT_NCS_FW_VERSION_STATIC=y >> overlay-memfault.conf
echo CONFIG_MEMFAULT_NCS_FW_VERSION=\"${{ env.VERSION }}\" >> overlay-memfault.conf
echo CONFIG_MEMFAULT_NCS_FW_TYPE=\"${{ env.MEMFAULT_SW_TYPE }}\" >> overlay-memfault.conf
west build -b thingy91x/nrf9151/ns -p --sysbuild -- -DEXTRA_CONF_FILE="overlay-memfault.conf"
- name: Create nrf91 Bootloader HEX file
run: |
python3 zephyr/scripts/build/mergehex.py -o \
$(pwd)/thingy91x-oob/app/build/b0_s0_s1_merged.hex \
$(pwd)/thingy91x-oob/app/build/b0_container.hex \
$(pwd)/thingy91x-oob/app/build/app_provision.hex \
$(pwd)/thingy91x-oob/app/build/signed_by_b0_mcuboot.hex \
$(pwd)/thingy91x-oob/app/build/signed_by_b0_s1_image.hex
- name: Apply Connectivity Bridge patch for debug feature
run: |
git apply thingy91x-oob/scripts/debug_feature_nrf.patch --directory=nrf
git apply thingy91x-oob/scripts/debug_feature_zephyr.patch --directory=zephyr
- name: Build nrf53 firmware
working-directory: nrf/applications/connectivity_bridge
run: |
west build -b thingy91x/nrf5340/cpuapp -p --sysbuild
- name: Create nrf53 merged_domains HEX file
run: |
python3 zephyr/scripts/build/mergehex.py -o \
$(pwd)/thingy91x-oob/app/build/hello.nrfcloud.com-${{ env.VERSION }}-thingy91x-nrf53-connectivity-bridge.hex \
$(pwd)/nrf/applications/connectivity_bridge/build/merged_CPUNET.hex \
$(pwd)/nrf/applications/connectivity_bridge/build/merged.hex
- name: Create nrf53 Bootloader HEX file
run: |
python3 zephyr/scripts/build/mergehex.py -o \
$(pwd)/thingy91x-oob/app/build/hello.nrfcloud.com-${{ env.VERSION }}-thingy91x-nrf53-bootloader.hex \
$(pwd)/nrf/applications/connectivity_bridge/build/b0_container.hex \
$(pwd)/nrf/applications/connectivity_bridge/build/signed_by_b0_mcuboot.hex \
$(pwd)/nrf/applications/connectivity_bridge/build/signed_by_b0_s1_image.hex \
$(pwd)/nrf/applications/connectivity_bridge/build/app_provision.hex \
$(pwd)/nrf/applications/connectivity_bridge/build/b0n_container.hex \
$(pwd)/nrf/applications/connectivity_bridge/build/net_provision.hex
- name: Copy nrf53 DFU file
run: |
cp $(pwd)/nrf/applications/connectivity_bridge/build/dfu_application.zip \
$(pwd)/thingy91x-oob/app/build/hello.nrfcloud.com-${{ env.VERSION }}-thingy91x-nrf53-dfu.zip
- name: Apply Connectivity Bridge patch for bootloader update
working-directory: nrf
run: |
git stash --include-untracked
git apply ../scripts/nrf53_bl_update.patch
- 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 \
app/build/hello.nrfcloud.com-${{ env.VERSION }}-thingy91x-nrf91-bootloader.zip
rm -rf twister-out
west twister -T ../nrf/applications/connectivity_bridge \
--test applications.connectivity_bridge.bootloader_update -v -p thingy91x/nrf5340/cpuapp --inline-logs
cp twister-out/thingy91x_nrf5340_cpuapp/applications.connectivity_bridge.bootloader_update/dfu_mcuboot.zip \
app/build/hello.nrfcloud.com-${{ env.VERSION }}-thingy91x-nrf53-bootloader.zip
cp twister-out/thingy91x_nrf5340_cpuapp/applications.connectivity_bridge.bootloader_update/dfu_application.zip \
app/build/hello.nrfcloud.com-${{ env.VERSION }}-thingy91x-nrf53-connectivity-bridge-verbose.zip
- name: Rename artifacts
working-directory: thingy91x-oob/app/build
run: |
cp merged.hex hello.nrfcloud.com-${{ env.VERSION }}-thingy91x-debug-app.hex
cp app/zephyr/.config hello.nrfcloud.com-${{ env.VERSION }}-thingy91x-debug-app.config
cp app/zephyr/zephyr.signed.bin hello.nrfcloud.com-${{ env.VERSION }}-thingy91x-debug-app_update_signed.bin
cp app/zephyr/zephyr.signed.hex hello.nrfcloud.com-${{ env.VERSION }}-thingy91x-debug-app_update_signed.hex
cp app/zephyr/zephyr.elf hello.nrfcloud.com-${{ env.VERSION }}-thingy91x-debug-app.elf
cp b0_s0_s1_merged.hex hello.nrfcloud.com-${{ env.VERSION }}-thingy91x-bootloader.hex
cp dfu_application.zip hello.nrfcloud.com-${{ env.VERSION }}-thingy91x-nrf91-dfu.zip
- name: Upload artifact
uses: actions/upload-artifact@v4
id: artifact-upload-step
with:
name: firmware
if-no-files-found: error
path: |
thingy91x-oob/app/build/hello.nrfcloud.com-*.*
- name: Print run-id and fw version
run: |
echo Run id: ${{ github.run_id }}
echo Version: ${{ env.VERSION }}