-
Notifications
You must be signed in to change notification settings - Fork 33
227 lines (205 loc) · 7.6 KB
/
build.yml
File metadata and controls
227 lines (205 loc) · 7.6 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
name: Build
on:
workflow_dispatch:
inputs:
memfault_fw_type:
type: string
required: false
default: "att-dev"
workflow_call:
inputs:
memfault_fw_type:
type: string
required: false
default: "att-dev"
nrfsdk_sha_update:
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: |
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
- name: Build (old) thingy91 firmware
if: ${{ github.event_name != 'pull_request' }}
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: ${{ github.event_name != 'pull_request' }}
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: ${{ github.event_name != 'pull_request' }}
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: ${{ github.event_name != 'pull_request' }}
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: ${{ github.event_name != 'pull_request' }}
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: ${{ github.event_name != 'pull_request' }}
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
# Asset Tracker Template firmware build with patches for Thingy91x
- name: Apply patches for Thingy91x firmware
if: ${{ github.event_name != 'pull_request' }}
run: |
git apply docs/patches/magnetometer.patch
git apply docs/patches/dummy-module.patch
working-directory: asset-tracker-template
- name: Build patched thingy91x firmware
if: ${{ github.event_name != 'pull_request' }}
uses: ./asset-tracker-template/.github/actions/build-step
with:
board: thingy91x/nrf9151/ns
short_board: thingy91x
version: ${{ env.VERSION }}-patched
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 }}