-
Notifications
You must be signed in to change notification settings - Fork 34
296 lines (269 loc) · 9.99 KB
/
build.yml
File metadata and controls
296 lines (269 loc) · 9.99 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
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
294
295
296
name: Build
on:
workflow_dispatch:
inputs:
memfault_fw_type:
description: Memfault Firmware Type
type: string
required: false
default: "att-dev"
build_all:
description: Build for all targets
type: boolean
required: false
default: false
push_memory_badges:
description: Whether to parse thingy91x build log and push memory badges
type: boolean
required: false
default: false
workflow_call:
inputs:
memfault_fw_type:
type: string
required: false
default: "att-dev"
nrfsdk_sha_update:
type: boolean
required: false
default: false
build_all:
type: boolean
required: false
default: false
push_memory_badges:
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 }}
ncsupdate_pr:
description: Pull request id for west ncs pointer
value: ${{ jobs.build.outputs.ncsupdate_pr }}
pull_request:
paths-ignore:
- "tests/**"
- "docs/**"
- "scripts/**"
- "README.md"
- ".github/workflows/*.yml"
- "!.github/workflows/build.yml"
jobs:
build:
runs-on: build_self_hosted
container: ghcr.io/zephyrproject-rtos/ci:v0.27.4
env:
CMAKE_PREFIX_PATH: /opt/toolchains
outputs:
run_id: ${{ github.run_id }}
version: ${{ env.VERSION }}
ncsupdate_pr: ${{ steps.pr.outputs.pull-request-number }}
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
path: asset-tracker-template
- name: Initialize
working-directory: asset-tracker-template
run: |
if [ ! -d "../.west" ]; then
west init -l .
else
echo ".west folder already exists, skipping west init."
fi
if [ "$NRFSDK_SHA_UPDATE" = "true" ]; then
NRFSDK_SHA=$(git ls-remote https://github.com/nrfconnect/sdk-nrf main | awk '{print $1}')
sed -i "/revision:/s/\( *revision: *\).*/\1${NRFSDK_SHA}/" west.yml
echo Configuring build on NCS rev ${NRFSDK_SHA}
echo "NRFSDK_SHA=${NRFSDK_SHA}" >> $GITHUB_ENV
fi
west update -o=--depth=1 -n
west blobs fetch hal_nordic
env:
NRFSDK_SHA_UPDATE: ${{ inputs.nrfsdk_sha_update }}
- name: Install dependencies
run: |
# The Matter IDL is part of requirements-build.txt, but it's not available
# in pypi so we need to install it from the source code
MATTER_IDL_PATH=modules/lib/matter/scripts/py_matter_idl
if [ -d $MATTER_IDL_PATH ]; then
pip install -e $MATTER_IDL_PATH
fi
pip install -r nrf/scripts/requirements-build.txt
rm -rf artifacts
mkdir -p artifacts
- 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: asset-tracker-template
run: |
python3 scripts/app_version.py ${GITHUB_REF_NAME} > app/VERSION
cat app/VERSION
- name: Set MEMFAULT_FW_TYPE and MEMFAULT_FW_VERSION_PREFIX
shell: bash
run: |
if [[ -z "${{ inputs.memfault_fw_type }}" ]]; then
echo "MEMFAULT_FW_TYPE=att-dev" >> $GITHUB_ENV
else
echo "MEMFAULT_FW_TYPE=${{ inputs.memfault_fw_type }}" >> $GITHUB_ENV
fi
if [[ "${{ startsWith(github.ref, 'refs/tags/') }}" == "true" ]]; then
echo "MEMFAULT_FW_VERSION_PREFIX=${{ github.ref_name }}" >> $GITHUB_ENV
else
echo "MEMFAULT_FW_VERSION_PREFIX=0.0.0-dev" >> $GITHUB_ENV
fi
# Asset Tracker Template firmware build
- name: Build thingy91x firmware
uses: ./asset-tracker-template/.github/actions/build-step
with:
board: thingy91x/nrf9151/ns
short_board: thingy91x
version: ${{ env.VERSION }}
path: asset-tracker-template/app
push_memory_badges: ${{ inputs.push_memory_badges }}
- name: Generate Memory Reports and Visualizations
if: ${{ inputs.push_memory_badges }}
continue-on-error: true
working-directory: asset-tracker-template
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Install required packages
pip install pandas plotly --break-system-packages
# Generate sunburst charts first
python3 scripts/sunburst_from_mem_report.py ../artifacts/rom_report_thingy91x.json
python3 scripts/sunburst_from_mem_report.py ../artifacts/ram_report_thingy91x.json
# Generate badges, history plots, and push everything to gh-pages
./tests/on_target/scripts/update_memory_badges.sh \
../artifacts/build_output_thingy91x.log \
../artifacts/rom_report_thingy91x.html \
../artifacts/ram_report_thingy91x.html
- name: Build (old) thingy91 firmware
if: ${{ inputs.build_all }}
uses: ./asset-tracker-template/.github/actions/build-step
with:
board: thingy91/nrf9160/ns
short_board: thingy91
version: ${{ env.VERSION }}
path: asset-tracker-template/app
- name: Build nrf9151dk firmware
if: ${{ inputs.build_all }}
uses: ./asset-tracker-template/.github/actions/build-step
with:
board: nrf9151dk/nrf9151/ns
short_board: nrf9151dk
version: ${{ env.VERSION }}
path: asset-tracker-template/app
- name: Build nrf9160dk firmware
if: ${{ inputs.build_all }}
uses: ./asset-tracker-template/.github/actions/build-step
with:
board: nrf9160dk/nrf9160/ns
short_board: nrf9160dk
version: ${{ env.VERSION }}
path: asset-tracker-template/app
- name: Build nrf9161dk firmware
if: ${{ inputs.build_all }}
uses: ./asset-tracker-template/.github/actions/build-step
with:
board: nrf9161dk/nrf9161/ns
short_board: nrf9161dk
version: ${{ env.VERSION }}
path: asset-tracker-template/app
# Asset Tracker Template debug firmware build
- name: Build thingy91x debug firmware
if: ${{ inputs.build_all }}
uses: ./asset-tracker-template/.github/actions/build-step
with:
memfault_project_key: ${{ secrets.MEMFAULT_PROJECT_KEY }}
memfault_fw_type: ${{ env.MEMFAULT_FW_TYPE }}
memfault_fw_version_prefix: ${{ env.MEMFAULT_FW_VERSION_PREFIX }}
board: thingy91x/nrf9151/ns
short_board: thingy91x
version: ${{ env.VERSION }}-debug
path: asset-tracker-template/app
debug: true
# Asset Tracker Template firmware build with MQTT cloud moduel for Thingy91x
- name: Build thingy91x firmware with MQTT cloud module
if: ${{ inputs.build_all }}
uses: ./asset-tracker-template/.github/actions/build-step
with:
board: thingy91x/nrf9151/ns
short_board: thingy91x
version: ${{ env.VERSION }}-mqtt
path: asset-tracker-template/app
mqtt: true
- name: Build thingy91x with modem trace on uart
if: ${{ inputs.build_all }}
uses: ./asset-tracker-template/.github/actions/build-step
with:
board: thingy91x/nrf9151/ns
short_board: thingy91x
modem_trace: true
version: ${{ env.VERSION }}-mtrace
path: asset-tracker-template/app
- name: Build nrf9151dk with modem trace on uart
if: ${{ inputs.build_all }}
uses: ./asset-tracker-template/.github/actions/build-step
with:
board: nrf9151dk/nrf9151/ns
short_board: nrf9151dk
modem_trace: true
version: ${{ env.VERSION }}-mtrace
path: asset-tracker-template/app
- name: Build nrf9151dk with external GNSS antenna
if: ${{ inputs.build_all }}
uses: ./asset-tracker-template/.github/actions/build-step
with:
board: nrf9151dk/nrf9151/ns
short_board: nrf9151dk
external_gnss: true
version: ${{ env.VERSION }}-ext-gnss
path: asset-tracker-template/app
- name: Build for nRF9161 DK with modem trace on UART 1
if: ${{ inputs.build_all }}
uses: ./asset-tracker-template/.github/actions/build-step
with:
board: nrf9161dk/nrf9161/ns
short_board: nrf9161dk
modem_trace: true
version: ${{ env.VERSION }}-mtrace
path: asset-tracker-template/app
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: firmware-artifacts-att
path: artifacts/*
- name: Print run-id and fw version
run: |
echo Run id: ${{ github.run_id }}
echo Version: ${{ env.VERSION }}
- name: Create update PR
if: ${{ inputs.nrfsdk_sha_update }}
uses: peter-evans/create-pull-request@v7
id: pr
with:
path: asset-tracker-template
add-paths: west.yml
commit-message: "manifest: auto: Update nrf-sdk SHA"
branch: nrf-manifest-auto-branch
base: main
title: "manifest: auto: Update nrf-sdk SHA"
- name: Check outputs
run: |
echo PR created: ${{ steps.pr.outputs.pull-request-number }}