-
Notifications
You must be signed in to change notification settings - Fork 112
/
.gitlab-ci.yml
362 lines (337 loc) · 10.7 KB
/
.gitlab-ci.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
stages:
- pre_check
- build
- test
- deploy
workflow:
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
- if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS && $CI_PIPELINE_SOURCE == "push"
when: never
- if: "$CI_COMMIT_BRANCH"
variables:
STM32_CUBE_H7_REPO: https://github.com/STMicroelectronics/STM32CubeH7
STM32_CUBE_H7_REPO_TAG: v1.11.1
ARM_TOOLCHAIN_URL: https://developer.arm.com/-/media/Files/downloads/gnu/13.2.rel1/binrel/arm-gnu-toolchain-13.2.rel1-x86_64-arm-none-eabi.tar.xz?rev=e434b9ea4afc4ed7998329566b764309&hash=CA590209F5774EE1C96E6450E14A3E26
QEMU_PATH: /opt/qemu/bin/qemu-system-xtensa
ZEPHYR_REPO: https://github.com/zephyrproject-rtos/zephyr.git
ZEPHYR_REPO_REV: v4.0.0
ZEPHYR_TOOLCHAIN: https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.17.0/toolchain_linux-x86_64_xtensa-espressif_esp32_zephyr-elf.tar.xz
ZEPHYR_SDK: https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.17.0/zephyr-sdk-0.17.0_linux-aarch64_minimal.tar.xz
PI_PICO_SDK_REV: 1.5.1
PI_PICO_SDK: https://github.com/raspberrypi/pico-sdk
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
PIP_EXTRA_INDEX_URL: "https://dl.espressif.com/pypi"
cache:
paths:
- "$CI_PROJECT_DIR/.cache/pip"
run_pre_commit:
stage: pre_check
image: python:3.11-bookworm
tags:
- internet
script:
- apt-get update
- pip install pre-commit
- git fetch origin master
- pre-commit run --show-diff-on-failure --from-ref origin/master --to-ref HEAD
check_stub_source_correctness:
stage: pre_check
image: espressif/idf:v5.2.2
tags:
- internet
script:
- cd $CI_PROJECT_DIR/examples/esp32_stub_example
- idf.py reconfigure -DSERIAL_FLASHER_STUB_PULL_VERSION='0.3.0'
- git diff --exit-code
.build_idf_template:
stage: build
tags:
- build
- internet
before_script:
- apt install ccache
- pip install -U idf-build-apps --prefer-binary
variables:
IDF_CCACHE_ENABLE: 1
CCACHE_DIR: "/cache/esf_ccache"
CCACHE_SLOPPINESS: "time_macros"
PEDANTIC_FLAGS: "-Werror -Wall -Wextra"
EXTRA_CFLAGS: "${PEDANTIC_FLAGS}"
EXTRA_CXXFLAGS: "${PEDANTIC_FLAGS}"
BUILD_DIR: "build"
script:
# CCACHE_RECACHE Used when invalidating the current cache.
# could be enabled by MR label "ccache:recache"
- |
if [ -n "${CI_MERGE_REQUEST_LABELS}" ] && echo "${CI_MERGE_REQUEST_LABELS}" | grep -q "ccache::recache"; then
export CCACHE_RECACHE="1"
echo "INFO: ccache recache enabled"
fi
- python -m idf_build_apps build -v -p .
--recursive
--exclude ./examples/binaries
--config "sdkconfig.defaults*"
--build-dir ${BUILD_DIR}
--check-warnings
# Show ccache statistics if enabled globally
- test "$CI_CCACHE_STATS" == 1 && test -n "$(which ccache)" && ccache --show-stats -vv || true
build_idf_v4.3:
image: espressif/idf:release-v4.3
stage: build
tags:
- build
- internet
before_script:
- apt install ccache
- pip install -U idf-build-apps --prefer-binary
variables:
IDF_CCACHE_ENABLE: 1
CCACHE_DIR: "/cache/esf_ccache"
CCACHE_SLOPPINESS: "time_macros"
PEDANTIC_FLAGS: "-Werror -Wall -Wextra"
EXTRA_CFLAGS: "${PEDANTIC_FLAGS}"
EXTRA_CXXFLAGS: "${PEDANTIC_FLAGS}"
BUILD_DIR: "build"
script:
# CCACHE_RECACHE Used when invalidating the current cache.
# could be enabled by MR label "ccache:recache"
- |
if [ -n "${CI_MERGE_REQUEST_LABELS}" ] && echo "${CI_MERGE_REQUEST_LABELS}" | grep -q "ccache::recache"; then
export CCACHE_RECACHE="1"
echo "INFO: ccache recache enabled"
fi
- python -m idf_build_apps build -v -p .
--recursive
--exclude ./examples/binaries
--target "esp32"
--config "sdkconfig.defaults*"
--build-dir ${BUILD_DIR}
--check-warnings
# Show ccache statistics if enabled globally
- test "$CI_CCACHE_STATS" == 1 && test -n "$(which ccache)" && ccache --show-stats -vv || true
build_idf_v4.4:
image: espressif/idf:release-v4.4
extends: .build_idf_template
build_idf_v5.0:
image: espressif/idf:release-v5.0
extends: .build_idf_template
build_idf_v5.1:
image: espressif/idf:release-v5.1
extends: .build_idf_template
build_idf_v5.2:
image: espressif/idf:release-v5.2
extends: .build_idf_template
build_idf_v5.3:
image: espressif/idf:release-v5.3
variables:
BUILD_DIR: "build_stable"
artifacts:
paths:
- "**/build*/*.bin"
- "**/build*/*.elf"
- "**/build*/*.map"
- "**/build*/flasher_args.json"
- "**/build*/flash_project_args"
- "**/build*/config/sdkconfig.json"
- "**/build*/bootloader/*.bin"
- "**/build*/partition_table/*.bin"
when: always
expire_in: 3 days
extends: .build_idf_template
build_idf_master:
image: espressif/idf:latest
variables:
BUILD_DIR: "build_master"
artifacts:
paths:
- "**/build*/*.bin"
- "**/build*/*.elf"
- "**/build*/*.map"
- "**/build*/flasher_args.json"
- "**/build*/flash_project_args"
- "**/build*/config/sdkconfig.json"
- "**/build*/bootloader/*.bin"
- "**/build*/partition_table/*.bin"
when: always
expire_in: 3 days
extends: .build_idf_template
build_stm32:
stage: build
# IDF is not necessary for STM32 build, but this image is already used in another job
# and it comes with a recent enough CMake version.
image: espressif/idf:latest
artifacts:
paths:
- "**/build*/*.bin"
when: always
expire_in: 3 days
tags:
- build
- internet
script:
- cd $CI_PROJECT_DIR
- git submodule update --init
- git clone --depth=1 -b ${STM32_CUBE_H7_REPO_TAG} ${STM32_CUBE_H7_REPO}
- wget --no-verbose -O gcc-arm-none-eabi.tar.xz ${ARM_TOOLCHAIN_URL}
- tar xf gcc-arm-none-eabi.tar.xz
- mv arm-gnu-toolchain-* gcc-arm-none-eabi
- mkdir $CI_PROJECT_DIR/examples/stm32_example/build
- cd $CI_PROJECT_DIR/examples/stm32_example/build
- cmake -DSTM32_TOOLCHAIN_PATH=$CI_PROJECT_DIR/gcc-arm-none-eabi -DSTM32_CUBE_H7_PATH=$CI_PROJECT_DIR/STM32CubeH7 -G Ninja ..
- cmake --build .
build_zephyr:
stage: build
image: espressif/idf:latest
tags:
- build
- internet
script:
- mkdir $CI_PROJECT_DIR/zephyrproject-rtos
- cd $CI_PROJECT_DIR/zephyrproject-rtos
- git clone --single-branch --depth=1 -b ${ZEPHYR_REPO_REV} ${ZEPHYR_REPO}
- mkdir $CI_PROJECT_DIR/zephyrproject-rtos/zephyr-sdk
- cd $CI_PROJECT_DIR/zephyrproject-rtos/zephyr-sdk
- wget --no-verbose -O zephyr_sdk.tar.xz ${ZEPHYR_SDK}
- tar xvf zephyr_sdk.tar.xz --strip-components=1
- wget --no-verbose -O esp32_toolchain.tar.xz ${ZEPHYR_TOOLCHAIN}
- tar xvf esp32_toolchain.tar.xz
- export ZEPHYR_SDK_INSTALL_DIR=$(pwd)
- export ZEPHYR_TOOLCHAIN_VARIANT="zephyr"
- cd $CI_PROJECT_DIR/zephyrproject-rtos/zephyr
- export ZEPHYR_BASE=$(pwd)
- pip install -r scripts/requirements.txt
- pip install wheel
- if [[ ! -d "$CI_PROJECT_DIR/zephyrproject-rtos/.west" ]]; then
- west init -l .
- fi
- unset IDF_PATH
- west zephyr-export
- west update hal_espressif
- west build -p -b esp32_devkitc_wroom/esp32/procpu $CI_PROJECT_DIR/examples/zephyr_example -DZEPHYR_EXTRA_MODULES=$CI_PROJECT_DIR
build_pi_pico:
stage: build
image: espressif/idf:latest
tags:
- build
- internet
artifacts:
paths:
- "**/build*/*.bin"
- "**/build*/*.elf"
- "**/build*/*.uf2"
when: always
expire_in: 3 days
script:
- git clone --recursive --single-branch --depth=1 -b ${PI_PICO_SDK_REV} ${PI_PICO_SDK}
- export PICO_SDK_PATH=$(pwd)/pico-sdk
- wget --no-verbose -O gcc-arm-none-eabi.tar.xz ${ARM_TOOLCHAIN_URL}
- tar xf gcc-arm-none-eabi.tar.xz
- mv arm-gnu-toolchain-* gcc-arm-none-eabi
- export PATH="$(pwd)/gcc-arm-none-eabi/bin:$PATH"
- cd $CI_PROJECT_DIR/examples/pi_pico_example
- mkdir build
- cd build
- cmake ..
- cmake --build .
build_pi:
stage: build
image: dtcooper/raspberrypi-os:latest
tags:
- ESF-RPI-01
before_script:
- apt-get update
- apt-get install -y cmake gcc g++ make pigpio
script:
- cd $CI_PROJECT_DIR/examples/raspberry_example
- mkdir build && cd build
- cmake .. && cmake --build .
artifacts:
paths:
- "${CI_PROJECT_DIR}/examples/raspberry_example/build/raspberry_flasher"
when: always
expire_in: 3 days
test_qemu:
stage: test
image: ${CI_DOCKER_REGISTRY}/qemu:esp-develop-20191124
tags:
- build
- internet
script:
- cd $CI_PROJECT_DIR/test
- export QEMU_PATH=/opt/qemu/bin/qemu-system-xtensa
- ./run_qemu_test.sh
.test_template:
stage: test
image: debian:latest
before_script:
- apt-get update
- apt-get install -y python3 python3-pip libffi-dev
- pip install -r $CI_PROJECT_DIR/test/requirements_test.txt --break-system-packages --prefer-binary
- pip install esptool --break-system-packages --prefer-binary
artifacts:
paths:
- "${CI_PROJECT_DIR}/examples/pytest_embedded_log/"
when: always
expire_in: 1 week
test_esp1:
extends: .test_template
tags:
- ESF-RPI-02
parallel:
matrix:
- CI_BUILD_FOLDER:
- "build_stable"
- "build_master"
script:
- cd $CI_PROJECT_DIR
- pytest --target=esp32s3 --port=/dev/serial_ports/ESP32S3_ESP32C3 -k 'not test_esp32_spi_load_ram_example'
- pytest --target=esp32 --port=/dev/serial_ports/ESP32_ESP32C6 -k 'test_esp32_sdio_load_ram_example'
test_esp2:
extends: .test_template
tags:
- ESF-RPI-01
parallel:
matrix:
- CI_BUILD_FOLDER:
- "build_stable"
- "build_master"
script:
- cd $CI_PROJECT_DIR
- pytest --target=esp32 --port=/dev/serial_ports/ESP32_ESP32 -k 'not test_esp32_sdio_load_ram_example'
- pytest --target=esp32s3 --port=/dev/serial_ports/ESP32S3_ESP32C3 -k 'not test_esp32_usb_cdc_acm_example'
test_stm32:
extends: .test_template
tags:
- ESF-RPI-03
script:
- pytest --target=stm32 --port=/dev/serial_ports/STM32_ESP32
test_pi_pico:
extends: .test_template
tags:
- ESF-RPI-03
script:
- pytest --target=pi_pico --port=/dev/serial_ports/pico_ESP32
test_rpi:
stage: test
image: dtcooper/raspberrypi-os:latest
tags:
- ESF-RPI-01
before_script:
- apt-get update
- apt-get install -y pigpio python3 python3-pip libffi-dev
- pip install -r $CI_PROJECT_DIR/test/requirements_test.txt --break-system-packages --prefer-binary
script:
- pytest --target=raspberry
push_to_the_components_registry:
stage: deploy
image: python:3.11-bookworm
tags:
- build
- internet
rules:
- if: '$CI_COMMIT_BRANCH == "master"'
- if: '$FORCE_PUSH_COMPONENT == "1"'
script:
- pip install idf-component-manager
- compote component upload --allow-existing --name=esp-serial-flasher --namespace=espressif