@@ -22,6 +22,12 @@ variables:
2222 ZEPHYR_SDK : https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.16.3/zephyr-sdk-0.16.3_linux-aarch64_minimal.tar.xz
2323 PI_PICO_SDK_REV : 1.5.1
2424 PI_PICO_SDK : https://github.com/raspberrypi/pico-sdk
25+ PIP_CACHE_DIR : " $CI_PROJECT_DIR/.cache/pip"
26+ PIP_EXTRA_INDEX_URL : " https://dl.espressif.com/pypi"
27+
28+ cache :
29+ paths :
30+ - " $CI_PROJECT_DIR/.cache/pip"
2531
2632run_pre_commit :
2733 stage : pre_check
@@ -50,19 +56,32 @@ check_stub_source_correctness:
5056 - build
5157 - internet
5258 before_script :
53- - pip install -U idf-build-apps
59+ - apt install ccache
60+ - pip install -U idf-build-apps --prefer-binary
5461 variables :
62+ IDF_CCACHE_ENABLE : 1
63+ CCACHE_DIR : " /cache/esf_ccache"
64+ CCACHE_SLOPPINESS : " time_macros"
5565 PEDANTIC_FLAGS : " -Werror -Wall -Wextra"
5666 EXTRA_CFLAGS : " ${PEDANTIC_FLAGS}"
5767 EXTRA_CXXFLAGS : " ${PEDANTIC_FLAGS}"
5868 BUILD_DIR : " build"
5969 script :
70+ # CCACHE_RECACHE Used when invalidating the current cache.
71+ # could be enabled by MR label "ccache:recache"
72+ - |
73+ if [ -n "${CI_MERGE_REQUEST_LABELS}" ] && echo "${CI_MERGE_REQUEST_LABELS}" | grep -q "ccache::recache"; then
74+ export CCACHE_RECACHE="1"
75+ echo "INFO: ccache recache enabled"
76+ fi
6077 - python -m idf_build_apps build -v -p .
6178 --recursive
6279 --exclude ./examples/binaries
6380 --config "sdkconfig.defaults*"
6481 --build-dir ${BUILD_DIR}
6582 --check-warnings
83+ # Show ccache statistics if enabled globally
84+ - test "$CI_CCACHE_STATS" == 1 && test -n "$(which ccache)" && ccache --show-stats -vv || true
6685
6786build_idf_v4.3 :
6887 image : espressif/idf:release-v4.3
@@ -71,20 +90,33 @@ build_idf_v4.3:
7190 - build
7291 - internet
7392 before_script :
74- - pip install -U idf-build-apps
93+ - apt install ccache
94+ - pip install -U idf-build-apps --prefer-binary
7595 variables :
96+ IDF_CCACHE_ENABLE : 1
97+ CCACHE_DIR : " /cache/esf_ccache"
98+ CCACHE_SLOPPINESS : " time_macros"
7699 PEDANTIC_FLAGS : " -Werror -Wall -Wextra"
77100 EXTRA_CFLAGS : " ${PEDANTIC_FLAGS}"
78101 EXTRA_CXXFLAGS : " ${PEDANTIC_FLAGS}"
79102 BUILD_DIR : " build"
80103 script :
104+ # CCACHE_RECACHE Used when invalidating the current cache.
105+ # could be enabled by MR label "ccache:recache"
106+ - |
107+ if [ -n "${CI_MERGE_REQUEST_LABELS}" ] && echo "${CI_MERGE_REQUEST_LABELS}" | grep -q "ccache::recache"; then
108+ export CCACHE_RECACHE="1"
109+ echo "INFO: ccache recache enabled"
110+ fi
81111 - python -m idf_build_apps build -v -p .
82112 --recursive
83113 --exclude ./examples/binaries
84114 --target "esp32"
85115 --config "sdkconfig.defaults*"
86116 --build-dir ${BUILD_DIR}
87117 --check-warnings
118+ # Show ccache statistics if enabled globally
119+ - test "$CI_CCACHE_STATS" == 1 && test -n "$(which ccache)" && ccache --show-stats -vv || true
88120
89121build_idf_v4.4 :
90122 image : espressif/idf:release-v4.4
@@ -143,6 +175,11 @@ build_stm32:
143175 # IDF is not necessary for STM32 build, but this image is already used in another job
144176 # and it comes with a recent enough CMake version.
145177 image : espressif/idf:latest
178+ artifacts :
179+ paths :
180+ - " **/build*/*.bin"
181+ when : always
182+ expire_in : 3 days
146183 tags :
147184 - build
148185 - internet
@@ -194,8 +231,15 @@ build_pi_pico:
194231 tags :
195232 - build
196233 - internet
234+ artifacts :
235+ paths :
236+ - " **/build*/*.bin"
237+ - " **/build*/*.elf"
238+ - " **/build*/*.uf2"
239+ when : always
240+ expire_in : 3 days
197241 script :
198- - git clone --single-branch --depth=1 -b ${PI_PICO_SDK_REV} ${PI_PICO_SDK}
242+ - git clone --recursive -- single-branch --depth=1 -b ${PI_PICO_SDK_REV} ${PI_PICO_SDK}
199243 - export PICO_SDK_PATH=$(pwd)/pico-sdk
200244 - wget --no-verbose -O gcc-arm-none-eabi.tar.xz ${ARM_TOOLCHAIN_URL}
201245 - tar xf gcc-arm-none-eabi.tar.xz
@@ -207,7 +251,25 @@ build_pi_pico:
207251 - cmake ..
208252 - cmake --build .
209253
210- run_tests :
254+ build_pi :
255+ stage : build
256+ image : dtcooper/raspberrypi-os:latest
257+ tags :
258+ - ESF-RPI-01
259+ before_script :
260+ - apt-get update
261+ - apt-get install -y cmake gcc g++ make pigpio
262+ script :
263+ - cd $CI_PROJECT_DIR/examples/raspberry_example
264+ - mkdir build && cd build
265+ - cmake .. && cmake --build .
266+ artifacts :
267+ paths :
268+ - " ${CI_PROJECT_DIR}/examples/raspberry_example/build/raspberry_flasher"
269+ when : always
270+ expire_in : 3 days
271+
272+ test_qemu :
211273 stage : test
212274 image : ${CI_DOCKER_REGISTRY}/qemu:esp-develop-20191124
213275 tags :
@@ -218,6 +280,73 @@ run_tests:
218280 - export QEMU_PATH=/opt/qemu/bin/qemu-system-xtensa
219281 - ./run_qemu_test.sh
220282
283+ .test_template :
284+ stage : test
285+ image : debian:latest
286+ before_script :
287+ - apt-get update
288+ - apt-get install -y python3 python3-pip libffi-dev
289+ - pip install -r $CI_PROJECT_DIR/test/requirements_test.txt --break-system-packages --prefer-binary
290+ - pip install esptool --break-system-packages --prefer-binary
291+ artifacts :
292+ paths :
293+ - " ${CI_PROJECT_DIR}/examples/pytest_embedded_log/"
294+ when : always
295+ expire_in : 1 week
296+
297+ test_esp1 :
298+ extends : .test_template
299+ tags :
300+ - ESF-RPI-02
301+ parallel :
302+ matrix :
303+ - CI_BUILD_FOLDER :
304+ - " build_stable"
305+ - " build_master"
306+ script :
307+ - cd $CI_PROJECT_DIR
308+ - pytest --target=esp32s3 --port=/dev/serial_ports/ESP32S3_ESP32C3 -k 'not test_esp32_spi_load_ram_example'
309+
310+ test_esp2 :
311+ extends : .test_template
312+ tags :
313+ - ESF-RPI-01
314+ parallel :
315+ matrix :
316+ - CI_BUILD_FOLDER :
317+ - " build_stable"
318+ - " build_master"
319+ script :
320+ - cd $CI_PROJECT_DIR
321+ - pytest --target=esp32 --port=/dev/serial_ports/ESP32_ESP32
322+ - pytest --target=esp32s3 --port=/dev/serial_ports/ESP32S3_ESP32C3 -k 'not test_esp32_usb_cdc_acm_example'
323+
324+ test_stm32 :
325+ extends : .test_template
326+ tags :
327+ - ESF-RPI-03
328+ script :
329+ - pytest --target=stm32 --port=/dev/serial_ports/STM32_ESP32
330+
331+ test_pi_pico :
332+ extends : .test_template
333+ tags :
334+ - ESF-RPI-03
335+ script :
336+ - pytest --target=pi_pico --port=/dev/serial_ports/pico_ESP32
337+
338+ test_rpi :
339+ stage : test
340+ image : dtcooper/raspberrypi-os:latest
341+ tags :
342+ - ESF-RPI-01
343+ before_script :
344+ - apt-get update
345+ - apt-get install -y pigpio python3 python3-pip libffi-dev
346+ - pip install -r $CI_PROJECT_DIR/test/requirements_test.txt --break-system-packages --prefer-binary
347+ script :
348+ - pytest --target=raspberry
349+
221350push_to_the_components_registry :
222351 stage : deploy
223352 image : python:3.11-bookworm
0 commit comments