-
Notifications
You must be signed in to change notification settings - Fork 14
371 lines (323 loc) · 15.1 KB
/
build-and-test.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
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
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
# SPDX-FileCopyrightText: 2021 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
name: Build and Test
on:
push:
branches:
- main
pull_request:
branches:
- main
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
TOOLCHAIN: arm-none-eabi
TOOLCHAIN_VERSION: 13.2.rel1
RENODE: renode
RENODE_VERSION: 1.14.0
VENV_IREE: venv-iree
VENV_RENODE: venv-renode
IREE_HOST_INSTALL: build-iree-host-install
jobs:
install-toolchain:
name: Install Arm GNU Toolchain
runs-on: ubuntu-20.04
steps:
- name: Cache Toolchain
id: cache-toolchain
uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
with:
path: ${{ env.TOOLCHAIN }}
key: ${{ runner.os }}-arm-gnu-toolchain-${{ env.TOOLCHAIN_VERSION }}-x86_64-arm-none-eabi
lookup-only: 'true'
- name: Install GNU Arm Embedded Toolchain
if: steps.cache-toolchain.outputs.cache-hit != 'true'
run: |
wget -q https://developer.arm.com/-/media/Files/downloads/gnu/${{ env.TOOLCHAIN_VERSION }}/binrel/arm-gnu-toolchain-${{ env.TOOLCHAIN_VERSION }}-x86_64-arm-none-eabi.tar.xz
mkdir ${{ env.TOOLCHAIN }}
tar xfJ arm-gnu-toolchain-${{ env.TOOLCHAIN_VERSION }}-x86_64-arm-none-eabi.tar.xz -C ${{ env.TOOLCHAIN }} --strip-components=1
install-renode:
name: Install Renode
runs-on: ubuntu-20.04
steps:
- name: Cache Renode
id: cache-renode
uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
with:
path: |
${{ env.VENV_RENODE }}
${{ env.RENODE }}
key: ${{ runner.os }}-${{ env.RENODE }}-${{ env.RENODE_VERSION }}
lookup-only: 'true'
- name: Install Renode
if: steps.cache-renode.outputs.cache-hit != 'true'
run: |
wget -q https://github.com/renode/renode/releases/download/v${{ env.RENODE_VERSION }}/renode-${{ env.RENODE_VERSION }}.linux-portable.tar.gz
tar xf renode-${{ env.RENODE_VERSION }}.linux-portable.tar.gz
mv renode_${{ env.RENODE_VERSION }}_portable ${{ env.RENODE }}
python3 -m venv ${{ env.VENV_RENODE }}
source ${{ env.VENV_RENODE }}/bin/activate
pip install -r ${{ env.RENODE }}/tests/requirements.txt
install-snapshot:
name: Install IREE snaphot
runs-on: ubuntu-20.04
steps:
- name: Checkout repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
path: ${{ env.REPO }}
- name: Cache IREE Snapshot
id: cache-snapshot
uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
with:
path: |
${{ env.VENV_IREE }}
${{ env.IREE_HOST_INSTALL }}
key: ${{ runner.os }}-iree-snapshot-${{ hashFiles('iree-release-link.txt') }}
lookup-only: 'true'
- name: Install IREE Dependencies
if: steps.cache-snapshot.outputs.cache-hit != 'true'
run: |
python3 -m venv ${{ env.VENV_IREE }}
source ${{ env.VENV_IREE }}/bin/activate
pip install -r requirements.txt
- name: Install IREE Tools
if: steps.cache-snapshot.outputs.cache-hit != 'true'
run: |
mkdir ${{ env.IREE_HOST_INSTALL }}
wget -i iree-release-link.txt -O iree-dist-linux-x86_64.tar.xz
tar xvfJ iree-dist-linux-x86_64.tar.xz -C ${{ env.IREE_HOST_INSTALL }}
rm iree-dist-linux-x86_64.tar.xz
build:
name: Build Samples
needs: [install-toolchain, install-snapshot]
runs-on: ubuntu-20.04
steps:
- name: Configure environment
run: echo "${GITHUB_WORKSPACE}/${{ env.TOOLCHAIN }}/bin" >> ${GITHUB_PATH}
- name: Install Dependencies
run: |
sudo apt update
sudo apt install cmake ninja-build
- name: Checkout repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
path: ${{ env.REPO }}
submodules: 'false'
- name: Initalize submodules
run : |
git submodule update --init third_party/CMSIS_5
git submodule update --init third_party/cmsis_device_f4
git submodule update --init third_party/cmsis_device_l4
git submodule update --init third_party/iree
git submodule update --init third_party/libopencm3
git submodule update --init third_party/nrfx
- name: Initalize IREE submodules
run : |
cd third_party/iree
git submodule update --init -- third_party/googletest
git submodule update --init -- third_party/flatcc
- name: Cache Toolchain
id: cache-toolchain
uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
with:
path: ${{ env.TOOLCHAIN }}
key: ${{ runner.os }}-arm-gnu-toolchain-${{ env.TOOLCHAIN_VERSION }}-x86_64-arm-none-eabi
- name: Cache IREE Snapshot
id: cache-snapshot
uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
with:
path: |
${{ env.VENV_IREE }}
${{ env.IREE_HOST_INSTALL }}
key: ${{ runner.os }}-iree-snapshot-${{ hashFiles('iree-release-link.txt') }}
- name: Build with CMSIS for nRF52840
run: |
source ${{ env.VENV_IREE }}/bin/activate
mkdir build-cmsis-nrf52840
cd build-cmsis-nrf52840
export PATH_TO_ARM_TOOLCHAIN="$GITHUB_WORKSPACE/${TOOLCHAIN}"
../build_tools/configure_build.sh cmsis nrf52840
cmake --build . --target all
- name: Upload CMSIS build artifact for nRF52840
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
with:
name: cmsis-nrf52840-build-artifact
path: |
build-cmsis-nrf52840/samples/simple_embedding/sample_vmvx_sync.elf
build-cmsis-nrf52840/samples/simple_embedding/sample_embedded_sync.elf
build-cmsis-nrf52840/samples/simple_vec_mul/simple_vec_mul_int_bytecode_vmvx.elf
build-cmsis-nrf52840/samples/simple_vec_mul/simple_vec_mul_int_bytecode_vmvx_inline.elf
build-cmsis-nrf52840/samples/simple_vec_mul/simple_vec_mul_int_bytecode_static.elf
build-cmsis-nrf52840/samples/simple_vec_mul/simple_vec_mul_int_bytecode_static_c.elf
build-cmsis-nrf52840/samples/simple_vec_mul/simple_vec_mul_int_bytecode_static_inline.elf
build-cmsis-nrf52840/samples/simple_vec_mul/simple_vec_mul_int_bytecode_static_inline_c.elf
build-cmsis-nrf52840/samples/static_library/sample_static_library.elf
build-cmsis-nrf52840/samples/static_library/sample_static_library_c.elf
build-cmsis-nrf52840/samples/vision_inference/mnist_static_library.elf
build-cmsis-nrf52840/samples/vision_inference/mnist_static_library_c.elf
retention-days: 1
- name: Build with CMSIS for STM32F4xx
run: |
source ${{ env.VENV_IREE }}/bin/activate
mkdir build-cmsis-stm32f4xx
cd build-cmsis-stm32f4xx
export PATH_TO_ARM_TOOLCHAIN="$GITHUB_WORKSPACE/${TOOLCHAIN}"
../build_tools/configure_build.sh cmsis stm32f4xx
cmake --build . --target all
- name: Upload CMSIS build artifact for STM32F4xx
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
with:
name: cmsis-stm32f4xx-build-artifact
path: |
build-cmsis-stm32f4xx/samples/simple_embedding/sample_vmvx_sync.elf
build-cmsis-stm32f4xx/samples/simple_embedding/sample_embedded_sync.elf
build-cmsis-stm32f4xx/samples/simple_vec_mul/simple_vec_mul_int_bytecode_vmvx.elf
build-cmsis-stm32f4xx/samples/simple_vec_mul/simple_vec_mul_int_bytecode_vmvx_inline.elf
build-cmsis-stm32f4xx/samples/simple_vec_mul/simple_vec_mul_int_bytecode_static.elf
build-cmsis-stm32f4xx/samples/simple_vec_mul/simple_vec_mul_int_bytecode_static_c.elf
build-cmsis-stm32f4xx/samples/simple_vec_mul/simple_vec_mul_int_bytecode_static_inline.elf
build-cmsis-stm32f4xx/samples/simple_vec_mul/simple_vec_mul_int_bytecode_static_inline_c.elf
build-cmsis-stm32f4xx/samples/static_library/sample_static_library.elf
build-cmsis-stm32f4xx/samples/static_library/sample_static_library_c.elf
build-cmsis-stm32f4xx/samples/vision_inference/mnist_static_library.elf
build-cmsis-stm32f4xx/samples/vision_inference/mnist_static_library_c.elf
retention-days: 1
- name: Build with libopencm3 for STM32F4xx
run: |
source ${{ env.VENV_IREE }}/bin/activate
mkdir build-libopencm3-stm32f4xx
cd build-libopencm3-stm32f4xx
export PATH_TO_ARM_TOOLCHAIN="$GITHUB_WORKSPACE/${TOOLCHAIN}"
../build_tools/configure_build.sh libopencm3 stm32f4xx
cmake --build . --target all
- name: Upload libopencm3 build artifact for STM32F4xx
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
with:
name: libopencm3-stm32f4xx-build-artifact
path: |
build-libopencm3-stm32f4xx/samples/simple_embedding/sample_vmvx_sync.elf
build-libopencm3-stm32f4xx/samples/simple_embedding/sample_embedded_sync.elf
build-libopencm3-stm32f4xx/samples/simple_vec_mul/simple_vec_mul_int_bytecode_vmvx.elf
build-libopencm3-stm32f4xx/samples/simple_vec_mul/simple_vec_mul_int_bytecode_vmvx_inline.elf
build-libopencm3-stm32f4xx/samples/simple_vec_mul/simple_vec_mul_int_bytecode_static.elf
build-libopencm3-stm32f4xx/samples/simple_vec_mul/simple_vec_mul_int_bytecode_static_c.elf
build-libopencm3-stm32f4xx/samples/simple_vec_mul/simple_vec_mul_int_bytecode_static_inline.elf
build-libopencm3-stm32f4xx/samples/simple_vec_mul/simple_vec_mul_int_bytecode_static_inline_c.elf
build-libopencm3-stm32f4xx/samples/static_library/sample_static_library.elf
build-libopencm3-stm32f4xx/samples/static_library/sample_static_library_c.elf
build-libopencm3-stm32f4xx/samples/vision_inference/mnist_static_library.elf
build-libopencm3-stm32f4xx/samples/vision_inference/mnist_static_library_c.elf
retention-days: 1
- name: Build with CMSIS for STM32L4R5
run: |
source ${{ env.VENV_IREE }}/bin/activate
mkdir build-cmsis-stm32l4r5
cd build-cmsis-stm32l4r5
export PATH_TO_ARM_TOOLCHAIN="$GITHUB_WORKSPACE/${TOOLCHAIN}"
../build_tools/configure_build.sh cmsis stm32l4r5
cmake --build . --target all
- name: Upload CMSIS build artifact for STM32L4R5
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
with:
name: cmsis-stm32l4r5-build-artifact
path: |
build-cmsis-stm32l4r5/samples/simple_embedding/sample_vmvx_sync.elf
build-cmsis-stm32l4r5/samples/simple_embedding/sample_embedded_sync.elf
build-cmsis-stm32l4r5/samples/simple_vec_mul/simple_vec_mul_int_bytecode_vmvx.elf
build-cmsis-stm32l4r5/samples/simple_vec_mul/simple_vec_mul_int_bytecode_vmvx_inline.elf
build-cmsis-stm32l4r5/samples/simple_vec_mul/simple_vec_mul_int_bytecode_static.elf
build-cmsis-stm32l4r5/samples/simple_vec_mul/simple_vec_mul_int_bytecode_static_c.elf
build-cmsis-stm32l4r5/samples/simple_vec_mul/simple_vec_mul_int_bytecode_static_inline.elf
build-cmsis-stm32l4r5/samples/simple_vec_mul/simple_vec_mul_int_bytecode_static_inline_c.elf
build-cmsis-stm32l4r5/samples/static_library/sample_static_library.elf
build-cmsis-stm32l4r5/samples/static_library/sample_static_library_c.elf
build-cmsis-stm32l4r5/samples/vision_inference/mnist_static_library.elf
build-cmsis-stm32l4r5/samples/vision_inference/mnist_static_library_c.elf
retention-days: 1
test-nrf52840:
name: Test Samples (nRF52840)
needs: [install-renode, build]
runs-on: ubuntu-20.04
steps:
- name: Checkout repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
path: ${{ env.REPO }}
- name: Cache Renode
id: cache-renode
uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
with:
path: |
${{ env.VENV_RENODE }}
${{ env.RENODE }}
key: ${{ runner.os }}-${{ env.RENODE }}-${{ env.RENODE_VERSION }}
- name: Download CMSIS build artifact for nRF52840
uses: actions/download-artifact@eaceaf801fd36c7dee90939fad912460b18a1ffe # v4.1.2
with:
name: cmsis-nrf52840-build-artifact
path: build-cmsis-nrf52840/samples
- name: Run Renode tests
run: |
source ${{ env.VENV_RENODE }}/bin/activate
${{ env.RENODE }}/renode-test --variable BASE_DIR:$GITHUB_WORKSPACE --variable TARGET:nrf52840 --exclude NoCI --exclude libopencm3 --exclude xfail-nrf52840 tests/*.robot
test-stm32f4:
name: Test Samples (STM32F4xx)
needs: [install-renode, build]
runs-on: ubuntu-20.04
steps:
- name: Checkout repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
path: ${{ env.REPO }}
- name: Cache Renode
id: cache-renode
uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
with:
path: |
${{ env.VENV_RENODE }}
${{ env.RENODE }}
key: ${{ runner.os }}-${{ env.RENODE }}-${{ env.RENODE_VERSION }}
- name: Download CMSIS build artifact for STM32F4xx
uses: actions/download-artifact@eaceaf801fd36c7dee90939fad912460b18a1ffe # v4.1.2
with:
name: cmsis-stm32f4xx-build-artifact
path: build-cmsis-stm32f4xx/samples
- name: Download libopencm3 build artifact for STM32F4xx
uses: actions/download-artifact@eaceaf801fd36c7dee90939fad912460b18a1ffe # v4.1.2
with:
name: libopencm3-stm32f4xx-build-artifact
path: build-libopencm3-stm32f4xx/samples
- name: Run Renode tests
run: |
source ${{ env.VENV_RENODE }}/bin/activate
${{ env.RENODE }}/renode-test --variable BASE_DIR:$GITHUB_WORKSPACE --variable TARGET:stm32f4xx --exclude NoCI tests/*.robot
test-stm32l4r5:
name: Test Samples (STM32L4R5)
needs: [install-renode, build]
runs-on: ubuntu-20.04
steps:
- name: Checkout repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
path: ${{ env.REPO }}
- name: Cache Renode
id: cache-renode
uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
with:
path: |
${{ env.VENV_RENODE }}
${{ env.RENODE }}
key: ${{ runner.os }}-${{ env.RENODE }}-${{ env.RENODE_VERSION }}
- name: Download CMSIS build artifact for STM32L4R5
uses: actions/download-artifact@eaceaf801fd36c7dee90939fad912460b18a1ffe # v4.1.2
with:
name: cmsis-stm32l4r5-build-artifact
path: build-cmsis-stm32l4r5/samples
- name: Run Renode tests
run: |
source ${{ env.VENV_RENODE }}/bin/activate
${{ env.RENODE }}/renode-test --variable BASE_DIR:$GITHUB_WORKSPACE --variable TARGET:stm32l4r5 --exclude NoCI --exclude libopencm3 tests/*.robot