-
Notifications
You must be signed in to change notification settings - Fork 13
102 lines (89 loc) · 2.7 KB
/
build_zephyr.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
# Copyright (c) 2024 Golioth, Inc.
# SPDX-License-Identifier: Apache-2.0
name: Build Zephyr binaries
on:
workflow_dispatch:
inputs:
ZEPHYR_SDK:
description: Zephyr toolchain version
required: true
type: string
default: 0.16.3
BOARD:
description: Zephyr board to build
required: true
type: string
default: nrf9160dk/nr9160/ns
ARTIFACT:
description: Whether or not to save the artifact produced by the build
required: true
type: boolean
default: false
HEX_FILE:
description: Name of the hex file to save
required: false
type: string
default: merged.hex
TAG:
description: version number of the firmware build
type: string
workflow_call:
inputs:
ZEPHYR_SDK:
required: true
type: string
BOARD:
required: true
type: string
ARTIFACT:
required: true
type: boolean
HEX_FILE:
required: true
type: string
TAG:
type: string
jobs:
build:
runs-on: ubuntu-latest
container: golioth/golioth-zephyr-base:${{ inputs.ZEPHYR_SDK }}-SDK-v0
env:
ZEPHYR_SDK_INSTALL_DIR: /opt/toolchains/zephyr-sdk-${{ inputs.ZEPHYR_SDK }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
path: app
- name: Process Board name
id: nicename
shell: bash
run: |
BOARD_NICENAME=${{ inputs.BOARD }}
BOARD_NICENAME=$(echo $BOARD_NICENAME | cut -d/ -f1)
echo "BOARD_NICENAME=${BOARD_NICENAME}" >> $GITHUB_OUTPUT
- name: Setup West workspace
run: |
west init -l app
west update --narrow -o=--depth=1
west zephyr-export
pip3 install -r deps/zephyr/scripts/requirements-base.txt
# Needed for TF-M
pip3 install cryptography pyasn1 pyyaml cbor>=1.0.0 imgtool>=1.9.0 jinja2 click
- name: Build with West
run: |
west build -p -b ${{ inputs.BOARD }} app/01_IOT
- name: Prepare artifacts
shell: bash
if: inputs.ARTIFACT == true && inputs.TAG != ''
run: |
cd build
mkdir -p artifacts
mv zephyr/${{ inputs.HEX_FILE }} ./artifacts/Golioth_${{ steps.nicename.outputs.BOARD_NICENAME }}_kitchen_sink_${{ inputs.TAG }}.hex
# Run IDs are unique per repo but are reused on re-runs
- name: Save artifact
if: inputs.ARTIFACT == true
uses: actions/upload-artifact@v4
with:
name: build_artifacts_${{ github.run_id }}_${{ steps.nicename.outputs.BOARD_NICENAME }}
path: |
build/artifacts/*