-
Notifications
You must be signed in to change notification settings - Fork 2
292 lines (246 loc) · 10.2 KB
/
build-and-release.yaml
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
name: Build and Release
on:
push:
branches:
- saga
paths:
- ".github/workflows/build-and-release.yaml"
- "!package.json"
- "!package-lock.json"
workflow_dispatch:
pull_request:
env:
BROKER_HOSTNAME: iot.thingy.rocks
MEMFAULT_PROJECT_KEY: m8U6bBczNz1N8Xi3M8kAKjAMKu9833YA
jobs:
# This generates a string containing the current date which is used in
# in artifact names to simplify locating and distinguishing them once they have
# been downloaded
date-string:
name: Generate string containing the current date
runs-on: ubuntu-22.04
outputs:
dateAsString: ${{ steps.dateAsString.outputs.dateAsString }}
steps:
- name: Generate date string
id: dateAsString
run: echo "dateAsString=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_OUTPUT
release-version:
name: Determine next release version
runs-on: ubuntu-22.04
outputs:
nextRelease: ${{ steps.version.outputs.nextRelease }}
steps:
- uses: actions/checkout@v4
- name: Determine next release version
uses: nordicsemiconductor/cloud-get-next-version-action@saga
id: version
with:
branch: saga
defaultVersion: "0.0.0-development-${{ github.sha }}"
- run: echo ${{ steps.version.outputs.nextRelease }}
build:
runs-on: ubuntu-22.04
container: ghcr.io/zephyrproject-rtos/ci:v0.26.2
env:
CMAKE_PREFIX_PATH: /opt/toolchains
needs: [release-version, date-string]
strategy:
matrix:
configuration:
- thingy91.low-power.memfault
# Double-tap to crash (dt2c) sends Button ID 42 and crashes on double tap of button
# to demonstrate the Memfault crash reporting feature.
- thingy91.low-power.memfault.dt2c
- thingy91.memfault.dt2c
- nrf9160dk.low-power.memfault
# Not enough flash for Memfault AND debug on Thingy:91,
# and it's not that useful anyway because debug builds
# will most likely be used connected to a PC
- thingy91.debug
- nrf9160dk.debug
# Thingy:91 with solar shield using AWS backend
- thingy91.low-power.solar.memfault
- thingy91.debug.solar
# NB-IoT only builds for Thingy:91
- thingy91.low-power.memfault.nbiot
- thingy91.debug.nbiot
- thingy91.low-power.memfault.nbiot.legacy_pco
- thingy91.debug.nbiot.legacy_pco
# Thingy:91 X
- thingy91x.wifi
- thingy91x.low-power.wifi
steps:
- uses: actions/checkout@v4
with:
path: firmware
submodules: recursive
- run: mv firmware/sdk-nrf firmware/nrf
- name: Initialize
working-directory: firmware/nrf
run: |
sudo apt-get update
sudo apt-get install -y ruby
pip3 install -r scripts/requirements-build.txt
west init -l .
west config manifest.group-filter +bsec
west update -o=--depth=1 -n
- name: Configure for Thingy:91
if:
contains(matrix.configuration, 'thingy91') &&
!contains(matrix.configuration, 'thingy91x')
run: echo 'board=thingy91_nrf9160_ns' >> $GITHUB_ENV
- name: Configure for Thingy:91 X
working-directory: firmware
if: contains(matrix.configuration, 'thingy91x')
run: |
echo 'board=thingy91x_nrf9151_ns' >> $GITHUB_ENV
echo "CONFIG_MQTT_HELPER_SEC_TAG=43" >> firmware.conf
- name: Configure for 9160DK
if: contains(matrix.configuration, 'nrf9160dk')
run: echo '[email protected]' >> $GITHUB_ENV
- name: Configure Version
working-directory: firmware
run: |
APP_VERSION=${{ needs.release-version.outputs.nextRelease }}+${{ matrix.configuration }}
echo "CONFIG_ASSET_TRACKER_V2_APP_VERSION=\"${APP_VERSION}\"" >> firmware.conf
echo "APP_VERSION=${APP_VERSION}" >> $GITHUB_ENV
echo "CONFIG_DATA_DEVICE_MODE_ACTIVE=y" >> firmware.conf
echo "CONFIG_LTE_PSM_REQ_RAT=\"00000000\"" >> firmware.conf
- name: Configure the AWS IoT broker hostname
working-directory: firmware
run: |
echo "CONFIG_AWS_IOT_BROKER_HOST_NAME=\"${{ env.BROKER_HOSTNAME }}\"" >> firmware.conf
echo AWS_OVERLAY=overlay-aws.conf >> $GITHUB_ENV
- name: Configure Memfault
if: contains(matrix.configuration, 'memfault')
working-directory: firmware
run: |
echo "CONFIG_DEBUG_MODULE_MEMFAULT_USE_EXTERNAL_TRANSPORT=y" >> firmware.conf
echo "CONFIG_DEBUG_MODULE_MEMFAULT_HEARTBEAT_INTERVAL_SEC=3600" >> firmware.conf
echo "CONFIG_MEMFAULT_NCS_FW_VERSION_STATIC=y" >> firmware.conf
echo "CONFIG_MEMFAULT_NCS_FW_VERSION=\"${{ env.APP_VERSION }}\"" >> firmware.conf
echo "CONFIG_MEMFAULT_NCS_FW_TYPE=\"thingy_world\"" >> firmware.conf
echo "CONFIG_MEMFAULT_NCS_PROJECT_KEY=\"${{ env.MEMFAULT_PROJECT_KEY }}\"" >> firmware.conf
echo "CONFIG_MEMFAULT_NCS_IMPLEMENT_METRICS_COLLECTION=n" >> firmware.conf
echo MEMFAULT_OVERLAY=overlay-memfault.conf >> $GITHUB_ENV
- name: Configure double-tap-to-crash
if: contains(matrix.configuration, 'dt2c')
working-directory: firmware
run: echo "CONFIG_UI_DOUBLE_TAP_TO_CRASH=y" >> firmware.conf
- name: Configure for NB-IoT only
working-directory: firmware
if: contains(matrix.configuration, 'nbiot')
run: echo "CONFIG_LTE_NETWORK_MODE_NBIOT_GPS=y" >> firmware.conf
- name: Build with legacy PCO
working-directory: firmware
if: contains(matrix.configuration, 'legacy_pco')
run: echo "CONFIG_PDN_LEGACY_PCO=y" >> firmware.conf
- name: Configure for LTE-m and NB-IoT
working-directory: firmware
if: ${{ !contains(matrix.configuration, 'nbiot') }}
run: echo "CONFIG_LTE_NETWORK_MODE_LTE_M_NBIOT_GPS=y" >> firmware.conf
- name: enable low-power build
if: contains(matrix.configuration, 'low-power')
run: echo CONFIG_OVERLAY=overlay-low-power.conf >> $GITHUB_ENV
- name: enable debug build
working-directory: firmware
if: contains(matrix.configuration, 'debug')
run: |
echo CONFIG_OVERLAY=overlay-debug.conf >> $GITHUB_ENV
- name: enable solar shield support
if: contains(matrix.configuration, 'solar')
run: |
echo SHIELD_OVERLAY=overlay-solar.conf >> $GITHUB_ENV
echo EXTRA_ARGS="-DDTC_OVERLAY_FILE=\"boards/${{ env.board }}.overlay;solar_shield.overlay\"" >> $GITHUB_ENV
- name: enable WiFi shield support
if:
contains(matrix.configuration, 'wifi') &&
!contains(matrix.configuration, 'thingy91x')
run: |
echo EXTRA_ARGS="-DSHIELD=nrf7002ek -DEXTRA_CONF_FILE=overlay-nrf7002ek-wifi-scan-only.conf" >> $GITHUB_ENV
# WiFi cannot be combined with P-GPS support
- name: enable P-GPS
if: ${{ !contains(matrix.configuration, 'wifi') }}
run: echo PGPS_OVERLAY=overlay-pgps.conf >> $GITHUB_ENV
- name: enable BSEC library to support Bosch BME680 Environmental sensor
if:
contains(matrix.configuration, 'thingy91') ||
contains(matrix.configuration, 'thingy91x')
working-directory: firmware
run: |
echo BSEC_OVERLAY=overlay-bsec.conf >> $GITHUB_ENV
- run: cat firmware.conf
working-directory: firmware
- name: copy overlays
run: |
cp firmware/firmware.conf firmware/nrf/applications/asset_tracker_v2
cp firmware/overlay-bsec.conf firmware/nrf/applications/asset_tracker_v2
- name: Build
working-directory: firmware/nrf/applications/asset_tracker_v2
# -Werror=no-unused-variable below is needed for BSEC to compile
run: |
west build \
-p always \
-b ${{ env.board }} \
-- \
${{ env.EXTRA_ARGS }} \
-DOVERLAY_CONFIG="${{ env.CONFIG_OVERLAY }};${{ env.PGPS_OVERLAY }};${{ env.AWS_OVERLAY }};${{ env.MEMFAULT_OVERLAY }};firmware.conf;${{ env.SHIELD_OVERLAY }};${{ env.BSEC_OVERLAY }}" \
-DEXTRA_CFLAGS="-Werror -Wno-unused-variable"
- run: mv firmware/nrf/applications/asset_tracker_v2/build firmware/build
if: always()
- run: cat firmware/build/zephyr/.config
if: always()
- run: cat firmware/build/zephyr/zephyr.dts
if: always()
- name: Upload symbols file to Memfault
if: contains(matrix.configuration, 'memfault')
working-directory: firmware
run: |
pip3 install memfault-cli
memfault \
--org-token ${{ secrets.MEMFAULT_ORGANIZATION_TOKEN }} \
--org ${{ secrets.MEMFAULT_ORGANIZATION_SLUG }} \
--project ${{ secrets.MEMFAULT_PROJECT_SLUG }} \
upload-mcu-symbols \
--software-type thingy_world \
--software-version ${{ env.APP_VERSION }} \
build/zephyr/zephyr.elf
- name: Copy firmware
run: |
cp firmware/build/zephyr/merged.hex ./
cp firmware/build/zephyr/app_signed.hex ./
cp firmware/build/zephyr/app_update.bin ./
cp firmware/build/zephyr/zephyr.elf ./
cp firmware/build/zephyr/.config ./
- uses: actions/upload-artifact@v4
if: always()
with:
name:
${{ matrix.configuration }}-${{
needs.date-string.outputs.dateAsString }}-${{ github.sha }}
path: |
merged.hex
app_signed.hex
app_update.bin
firmware.conf
zephyr.elf
.config
release:
name: Release
runs-on: ubuntu-22.04
if:
github.ref == 'refs/heads/saga' && (github.event_name == 'push' ||
github.event_name == 'workflow_dispatch' || github.event_name ==
'repository_dispatch')
needs: [build]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
- uses: actions/setup-node@v4
with:
node-version: "20.x"
cache: "npm"
- run: npx semantic-release