-
Notifications
You must be signed in to change notification settings - Fork 2
192 lines (176 loc) · 8.66 KB
/
build.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
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
name: Build
on:
workflow_dispatch:
inputs:
build_debug:
type: boolean
required: false
default: false
workflow_call:
inputs:
memfault_sw_type:
type: string
required: false
default: "asset-tracker-template-ci"
build_debug:
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 }}
pull_request:
paths-ignore:
- "tests/**"
- "docs/**"
- "scripts/**"
- "README.md"
- ".github/workflows/*.yml"
- "!.github/workflows/build.yml"
schedule:
- cron: "0 0 * * *"
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 }}
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
west config manifest.group-filter +bsec
west config build.sysbuild True
west update -o=--depth=1 -n
west blobs fetch hal_nordic
- name: Install dependencies
run: |
pip install -r nrf/scripts/requirements-build.txt
- 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_SW_TYPE from inputs or use default
run: |
if [ -z "${{ inputs.memfault_sw_type }}" ]; then
echo "MEMFAULT_SW_TYPE=asset-tracker-template-ci" >> $GITHUB_ENV
else
echo "MEMFAULT_SW_TYPE=${{ inputs.memfault_sw_type }}" >> $GITHUB_ENV
fi
# Asset Tracker Template firmware build
- name: Build thingy91x firmware
working-directory: asset-tracker-template/app
run: |
mkdir -p artifacts
cp overlay-memfault.conf overlay-memfault-att.conf
echo "CONFIG_MEMFAULT_NCS_PROJECT_KEY=\"${{ secrets.MEMFAULT_PROJECT_KEY }}\"" >> overlay-memfault-att.conf
echo CONFIG_MEMFAULT_NCS_FW_VERSION_STATIC=y >> overlay-memfault-att.conf
echo CONFIG_MEMFAULT_NCS_FW_VERSION=\"${{ env.VERSION }}\" >> overlay-memfault-att.conf
echo CONFIG_MEMFAULT_NCS_FW_TYPE=\"${{ env.MEMFAULT_SW_TYPE }}-thingy91x\" >> overlay-memfault-att.conf
west build -b thingy91x/nrf9151/ns -d build -p --sysbuild -- -DEXTRA_CONF_FILE="overlay-memfault-att.conf"
cp build/merged.hex artifacts/asset-tracker-template-${{ env.VERSION }}-thingy91x-nrf91.hex
cp build/app/zephyr/.config artifacts/asset-tracker-template-${{ env.VERSION }}-thingy91x-nrf91.config
cp build/app/zephyr/zephyr.signed.bin artifacts/asset-tracker-template-${{ env.VERSION }}-thingy91x-nrf91-update-signed.bin
cp build/app/zephyr/zephyr.signed.hex artifacts/asset-tracker-template-${{ env.VERSION }}-thingy91x-nrf91-update-signed.hex
cp build/app/zephyr/zephyr.elf artifacts/asset-tracker-template-${{ env.VERSION }}-thingy91x-nrf91.elf
cp build/dfu_application.zip artifacts/asset-tracker-template-${{ env.VERSION }}-thingy91x-nrf91-dfu.zip
cd build
ninja partition_manager_report
ninja partition_manager_report > ../artifacts/pmr-thingy91x-nrf91-default-${{ env.VERSION }}.txt
sed -i '1d' ../artifacts/pmr-thingy91x-nrf91-default-${{ env.VERSION }}.txt
- name: Build nrf9151dk firmware
working-directory: asset-tracker-template/app
run: |
mkdir -p artifacts
cp overlay-memfault.conf overlay-memfault-att.conf
echo "CONFIG_MEMFAULT_NCS_PROJECT_KEY=\"${{ secrets.MEMFAULT_PROJECT_KEY }}\"" >> overlay-memfault-att.conf
echo CONFIG_MEMFAULT_NCS_FW_VERSION_STATIC=y >> overlay-memfault-att.conf
echo CONFIG_MEMFAULT_NCS_FW_VERSION=\"${{ env.VERSION }}\" >> overlay-memfault-att.conf
echo CONFIG_MEMFAULT_NCS_FW_TYPE=\"${{ env.MEMFAULT_SW_TYPE }}-nrf9151dk\" >> overlay-memfault-att.conf
west build -b nrf9151dk/nrf9151/ns -d build -p --sysbuild -- -DEXTRA_CONF_FILE="overlay-memfault-att.conf"
cp build/merged.hex artifacts/asset-tracker-template-${{ env.VERSION }}-nrf9151dk-nrf91.hex
cp build/app/zephyr/.config artifacts/asset-tracker-template-${{ env.VERSION }}-nrf9151dk-nrf91.config
cp build/app/zephyr/zephyr.signed.bin artifacts/asset-tracker-template-${{ env.VERSION }}-nrf9151dk-nrf91-update-signed.bin
cp build/app/zephyr/zephyr.signed.hex artifacts/asset-tracker-template-${{ env.VERSION }}-nrf9151dk-nrf91-update-signed.hex
cp build/app/zephyr/zephyr.elf artifacts/asset-tracker-template-${{ env.VERSION }}-nrf9151dk-nrf91.elf
cp build/dfu_application.zip artifacts/asset-tracker-template-${{ env.VERSION }}-nrf9151dk-nrf91-dfu.zip
cd build
ninja partition_manager_report
ninja partition_manager_report > ../artifacts/pmr-nrf9151dk-nrf91-default-${{ env.VERSION }}.txt
sed -i '1d' ../artifacts/pmr-nrf9151dk-nrf91-default-${{ env.VERSION }}.txt
- name: Upload artifact
uses: actions/upload-artifact@v4
id: artifact-upload-att
with:
name: firmware-att
if-no-files-found: error
path: |
asset-tracker-template/app/artifacts/*
# Asset Tracker Template debug firmware build
- name: Build thingy91x debug firmware
if: ${{ inputs.build_debug }}
working-directory: asset-tracker-template/app
run: |
cp overlay-memfault.conf overlay-memfault-debug.conf
echo "CONFIG_MEMFAULT_NCS_PROJECT_KEY=\"${{ secrets.MEMFAULT_PROJECT_KEY }}\"" >> overlay-memfault-debug.conf
echo CONFIG_MEMFAULT_NCS_FW_VERSION_STATIC=y >> overlay-memfault-debug.conf
echo CONFIG_MEMFAULT_NCS_FW_VERSION=\"${{ env.VERSION }}-debug\" >> overlay-memfault-debug.conf
echo CONFIG_MEMFAULT_NCS_FW_TYPE=\"${{ env.MEMFAULT_SW_TYPE }}-thingy91x\" >> overlay-memfault-debug.conf
west build -p -b thingy91x/nrf9151/ns -p --sysbuild -- -DEXTRA_CONF_FILE="overlay-memfault-debug.conf;overlay-etb.conf"
- name: Rename debug artifacts
if: ${{ inputs.build_debug }}
working-directory: asset-tracker-template/app/build
run: |
cp merged.hex asset-tracker-template-${{ env.VERSION }}-thingy91x-nrf91.hex
cp app/zephyr/.config asset-tracker-template-${{ env.VERSION }}-debug-thingy91x-nrf91.config
cp app/zephyr/zephyr.signed.bin asset-tracker-template-${{ env.VERSION }}-debug-thingy91x-nrf91-update-signed.bin
cp app/zephyr/zephyr.signed.hex asset-tracker-template-${{ env.VERSION }}-debug-thingy91x-nrf91-update-signed.hex
cp app/zephyr/zephyr.elf asset-tracker-template-${{ env.VERSION }}-debug-thingy91x-nrf91.elf
cp dfu_application.zip asset-tracker-template-${{ env.VERSION }}-debug-thingy91x-nrf91-dfu.zip
- name: Create partition manager report for nRF91 debug firmware
if: ${{ inputs.build_debug }}
working-directory: asset-tracker-template/app/build
run: |
ninja partition_manager_report
ninja partition_manager_report > pmr-nrf91-debug-${{ env.VERSION }}.txt
sed -i '1d' pmr-nrf91-debug-${{ env.VERSION }}.txt
- name: Upload artifact
if: ${{ inputs.build_debug }}
uses: actions/upload-artifact@v4
id: artifact-upload-att-debug
with:
name: firmware-att-debug
if-no-files-found: error
path: |
asset-tracker-template/app/build/asset-tracker-template-*.*
asset-tracker-template/app/build/pmr-nrf91-*.txt
- name: Print run-id and fw version
run: |
echo Run id: ${{ github.run_id }}
echo Version: ${{ env.VERSION }}