-
Notifications
You must be signed in to change notification settings - Fork 111
339 lines (271 loc) · 10.9 KB
/
release.yml
File metadata and controls
339 lines (271 loc) · 10.9 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
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
name: Release
on:
push:
tags:
- v*
env:
MEMFAULT_CLI_VERSION: "1.6.0"
jobs:
build-bootloader:
runs-on: ubuntu-24.04
container:
image: ghcr.io/pebble-dev/pebbleos-docker:v1
strategy:
matrix:
board: ["asterix"]
steps:
- name: Mark Github workspace as safe
run: git config --system --add safe.directory "${GITHUB_WORKSPACE}"
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
- name: Fetch tags
run: |
git fetch --tags --force
- name: Install Python dependencies
run: |
pip install -U pip
pip install -r requirements.txt
- name: Obtain platform name
id: get-platform
run: |
BOARD=${{ matrix.board }}
PLATFORM=${BOARD%%_*}
echo "platform=$PLATFORM" >> "$GITHUB_OUTPUT"
- name: Configure bootloader
working-directory: platform/${{ steps.get-platform.outputs.platform }}/boot
run: ./waf configure --board ${{ matrix.board }}
- name: Build bootloader
working-directory: platform/${{ steps.get-platform.outputs.platform }}/boot
run: ./waf build
- name: Copy bootloader artifacts
run: |
mkdir -p artifacts
cp platform/${{ steps.get-platform.outputs.platform }}/boot/build/tintin_boot.hex \
artifacts/bootloader_${{ matrix.board }}_${{github.ref_name}}.hex
- name: Configure bootloader (nowatchdog)
working-directory: platform/${{ steps.get-platform.outputs.platform }}/boot
run: ./waf configure --board ${{ matrix.board }} --nowatchdog
- name: Build bootloader (nowatchdog)
working-directory: platform/${{ steps.get-platform.outputs.platform }}/boot
run: ./waf build
- name: Copy bootloader artifacts (nowatchdog)
run: |
mkdir -p artifacts
cp platform/${{ steps.get-platform.outputs.platform }}/boot/build/tintin_boot.hex \
artifacts/bootloader_nowatchdog_${{ matrix.board }}_${{github.ref_name}}.hex
- name: Store
uses: actions/upload-artifact@v4
with:
path: artifacts
name: artifacts-bootloader-${{ matrix.board }}
build-prf:
runs-on: ubuntu-24.04
container:
image: ghcr.io/pebble-dev/pebbleos-docker:v1
strategy:
matrix:
board: ["asterix", "obelix_dvt", "obelix_pvt", "getafix_evt"]
steps:
- name: Mark Github workspace as safe
run: git config --system --add safe.directory "${GITHUB_WORKSPACE}"
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
- name: Fetch tags
run: |
git fetch --tags --force
- name: Install Python dependencies
run: |
pip install -U pip
pip install -r requirements.txt
- name: Configure
run: ./waf configure --board ${{ matrix.board }} --release
- name: Build PRF
run: ./waf build_prf
- name: Bundle PRF
run: ./waf bundle_prf
- name: Copy PRF artifacts
run: |
mkdir -p artifacts
cp build/prf/src/fw/tintin_fw.hex artifacts/prf_${{ matrix.board }}_${{github.ref_name}}.hex
cp build/prf/src/fw/tintin_fw.bin artifacts/prf_${{ matrix.board }}_${{github.ref_name}}.bin
cp build/prf/src/fw/tintin_fw.elf artifacts/prf_${{ matrix.board }}_${{github.ref_name}}.elf
cp build/prf/*.pbz artifacts
cp build/prf/src/fw/tintin_fw_loghash_dict.json artifacts/prf_${{ matrix.board }}_${{github.ref_name}}_loghash_dict.json
- name: Get PRF Build ID
id: prf_build_id
run: |
echo "BUILD_ID=$(arm-none-eabi-readelf -n build/prf/src/fw/tintin_fw.elf | sed -n -e 's/^.*Build ID: //p')" >> "$GITHUB_OUTPUT"
- name: Upload PRF log hash dictionary
uses: Noelware/s3-action@2.3.1
with:
access-key-id: ${{ secrets.LOG_HASH_BUCKET_KEY_ID }}
secret-key: ${{ secrets.LOG_HASH_BUCKET_SECRET }}
endpoint: ${{ vars.LOG_HASH_BUCKET_ENDPOINT }}
bucket: ${{ vars.LOG_HASH_BUCKET_NAME }}
files: |
build/prf/src/fw/tintin_fw_loghash_dict.json
path-format: ${{ steps.prf_build_id.outputs.BUILD_ID }}-${{ github.sha }}-prf.json
- name: Configure PRF MFG
run: ./waf configure --board ${{ matrix.board }} --mfg --nohash --release
- name: Build MFG PRF
run: ./waf build_prf
- name: Copy MFG PRF artifacts
run: |
mkdir -p artifacts
cp build/prf/src/fw/tintin_fw.hex artifacts/prf_mfg_${{ matrix.board }}_${{github.ref_name}}.hex
cp build/prf/src/fw/tintin_fw.bin artifacts/prf_mfg_${{ matrix.board }}_${{github.ref_name}}.bin
cp build/prf/src/fw/tintin_fw.elf artifacts/prf_mfg_${{ matrix.board }}_${{github.ref_name}}.elf
- name: Store
uses: actions/upload-artifact@v4
with:
name: artifacts-prf-${{ matrix.board }}
path: artifacts
build-firmware:
runs-on: ubuntu-24.04
container:
image: ghcr.io/pebble-dev/pebbleos-docker:v1
strategy:
matrix:
board: ["asterix", "obelix_dvt", "obelix_pvt", "getafix_evt"]
slot: [0, 1]
exclude:
- board: "asterix"
slot: 1
steps:
- name: Mark Github workspace as safe
run: git config --system --add safe.directory "${GITHUB_WORKSPACE}"
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
- name: Fetch tags
run: |
git fetch --tags --force
- name: Install Python dependencies
run: |
pip install -U pip
pip install -r requirements.txt
- name: Get npm cache directory
id: npm-cache-dir
shell: bash
run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT}
- name: Node modules cache
uses: actions/cache@v4
with:
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('third_party/jerryscript/jerryscript/js_tooling/package.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Set slot suffix
id: slot_suffix
run: |
NEEDS_SUFFIX="obelix_dvt obelix_pvt getafix_evt"
if echo $NEEDS_SUFFIX | grep -wq "${{ matrix.board }}"; then
echo "SLOT_SUFFIX=_slot${{ matrix.slot }}" >> "$GITHUB_OUTPUT"
else
echo "SLOT_SUFFIX=" >> "$GITHUB_OUTPUT"
fi
- name: Configure
run: ./waf configure --board ${{ matrix.board }} --slot ${{ matrix.slot }} --release
- name: Build firmware
run: ./waf build
- name: Bundle firmware
run: ./waf bundle
- name: Copy firmware artifacts
run: |
mkdir -p artifacts
cp build/src/fw/tintin_fw.hex artifacts/firmware_${{ matrix.board }}_${{github.ref_name}}${{ steps.slot_suffix.outputs.SLOT_SUFFIX }}.hex
cp build/src/fw/tintin_fw.bin artifacts/firmware_${{ matrix.board }}_${{github.ref_name}}${{ steps.slot_suffix.outputs.SLOT_SUFFIX }}.bin
cp build/src/fw/tintin_fw.elf artifacts/firmware_${{ matrix.board }}_${{github.ref_name}}${{ steps.slot_suffix.outputs.SLOT_SUFFIX }}.elf
cp build/*.pbz artifacts
cp build/src/fw/tintin_fw_loghash_dict.json artifacts/firmware_${{ matrix.board }}_${{github.ref_name}}${{ steps.slot_suffix.outputs.SLOT_SUFFIX }}_loghash_dict.json
- name: Get Build ID
id: build_id
run: |
echo "BUILD_ID=$(arm-none-eabi-readelf -n build/src/fw/tintin_fw.elf | sed -n -e 's/^.*Build ID: //p')" >> "$GITHUB_OUTPUT"
- name: Upload log hash dictionary
uses: Noelware/s3-action@2.3.1
with:
access-key-id: ${{ secrets.LOG_HASH_BUCKET_KEY_ID }}
secret-key: ${{ secrets.LOG_HASH_BUCKET_SECRET }}
endpoint: ${{ vars.LOG_HASH_BUCKET_ENDPOINT }}
bucket: ${{ vars.LOG_HASH_BUCKET_NAME }}
files: |
build/src/fw/tintin_fw_loghash_dict.json
path-format: ${{ steps.build_id.outputs.BUILD_ID }}-${{ github.sha }}-normal.json
- name: Store
uses: actions/upload-artifact@v4
with:
name: artifacts-${{ matrix.board }}${{ steps.slot_suffix.outputs.SLOT_SUFFIX }}
path: artifacts
- name: Upload symbols to Memfault
run: |
pip install memfault-cli==${MEMFAULT_CLI_VERSION}
memfault \
--org-token ${{ secrets.MEMFAULT_ORG_TOKEN }} \
--org ${{ secrets.MEMFAULT_ORG }} \
--project ${{ secrets.MEMFAULT_PROJECT }} \
upload-mcu-symbols \
artifacts/firmware_${{ matrix.board }}_${{github.ref_name}}${{ steps.slot_suffix.outputs.SLOT_SUFFIX }}.elf
release:
runs-on: ubuntu-24.04
needs:
- build-bootloader
- build-prf
- build-firmware
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
- name: Display artifacts
run: ls -R
- name: Merge slot-specific pbz files
run: |
NEEDS_MERGE="obelix_dvt obelix_pvt getafix_evt"
mkdir artifacts-merged
for board in $NEEDS_MERGE; do
python3 tools/merge_pbz.py \
--slot0-pbz "artifacts-${board}_slot0/normal_${board}_${{ github.ref_name }}_slot0.pbz" \
--slot1-pbz "artifacts-${board}_slot1/normal_${board}_${{ github.ref_name }}_slot1.pbz" \
--output "artifacts-merged/normal_${board}_${{ github.ref_name }}.pbz"
done
- name: Create release
uses: softprops/action-gh-release@v2.2.2
with:
files: artifacts-*/*
- name: Deploy Memfault release
run: |
pip install memfault-cli==${MEMFAULT_CLI_VERSION}
for file in artifacts-*/normal*.pbz; do
# Skip slot-specific pbzs
if echo $file | grep -q "_slot"; then
continue
fi
BOARD=$(echo $file | sed -n -e 's/^.*normal_\([a-zA-Z0-9_]*\)_v.*\.pbz$/\1/p')
memfault \
--org-token ${{ secrets.MEMFAULT_ORG_TOKEN }} \
--org ${{ secrets.MEMFAULT_ORG }} \
--project ${{ secrets.MEMFAULT_PROJECT }} \
upload-ota-payload \
--hardware-version $BOARD \
--software-type pebbleos \
--software-version ${{ github.ref_name }} \
$file
done
memfault \
--org-token ${{ secrets.MEMFAULT_ORG_TOKEN }} \
--org ${{ secrets.MEMFAULT_ORG }} \
--project ${{ secrets.MEMFAULT_PROJECT }} \
deploy-release \
--release-version ${{ github.ref_name }} \
--cohort internal