From e71365f835936ff4f378badbc62a57ca72700952 Mon Sep 17 00:00:00 2001 From: David Cermak Date: Fri, 25 Jul 2025 08:36:43 +0200 Subject: [PATCH 1/2] fix(examples): Use configured public broker for MQTT linux test Also updated pre-commit hook versions, as some don't work in py3.12 --- .github/workflows/examples_build-host-test.yml | 5 +++-- .pre-commit-config.yaml | 10 +++------- ci/build_apps.py | 1 + ci/config_env.sh | 7 +++++++ examples/mqtt/sdkconfig.ci | 2 ++ 5 files changed, 16 insertions(+), 9 deletions(-) create mode 100755 ci/config_env.sh create mode 100644 examples/mqtt/sdkconfig.ci diff --git a/.github/workflows/examples_build-host-test.yml b/.github/workflows/examples_build-host-test.yml index 008408316..0a1cbbc1a 100644 --- a/.github/workflows/examples_build-host-test.yml +++ b/.github/workflows/examples_build-host-test.yml @@ -59,10 +59,11 @@ jobs: - name: Build with IDF-${{ matrix.idf_ver }} shell: bash run: | + . ${GITHUB_WORKSPACE}/ci/config_env.sh . ${IDF_PATH}/export.sh python -m pip install idf-build-apps - python ./ci/build_apps.py examples/mqtt -l -t linux - timeout 5 ./examples/mqtt/build_linux_default/esp_mqtt_demo.elf | tee test.log || true + python ./ci/build_apps.py examples/mqtt -l -t linux -r 'sdkconfig.ci' + timeout 5 ./examples/mqtt/build_linux/esp_mqtt_demo.elf | tee test.log || true grep 'MQTT_EVENT_DATA' test.log run_on_target: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2eee6e394..87771043c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -25,12 +25,8 @@ repos: (?x)^( .*.py )$ - - repo: https://github.com/myint/unify - rev: v0.5 - hooks: - - id: unify - - repo: https://github.com/pre-commit/mirrors-yapf - rev: "v0.32.0" + - repo: https://github.com/google/yapf + rev: "v0.43.0" hooks: - id: yapf args: ['style={based_on_style: google, column_limit: 160, indent_width: 4}'] @@ -39,7 +35,7 @@ repos: hooks: - id: isort - repo: https://github.com/myint/eradicate/ - rev: v2.1.0 + rev: 3.0.0 hooks: - id: eradicate - repo: https://github.com/espressif/check-copyright/ diff --git a/ci/build_apps.py b/ci/build_apps.py index f36399af8..806a53605 100644 --- a/ci/build_apps.py +++ b/ci/build_apps.py @@ -65,6 +65,7 @@ if __name__ == '__main__': sys.exit( build_apps(apps, + verbose=2, dry_run=False, keep_going=False, no_preserve=args.delete, diff --git a/ci/config_env.sh b/ci/config_env.sh new file mode 100755 index 000000000..7239a35c6 --- /dev/null +++ b/ci/config_env.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +# This script is used to set some common variables for the CI pipeline. + +set -e + +# MQTT public broker URI +export CI_MQTT_BROKER_URI="broker.emqx.io" diff --git a/examples/mqtt/sdkconfig.ci b/examples/mqtt/sdkconfig.ci new file mode 100644 index 000000000..bc8c262f3 --- /dev/null +++ b/examples/mqtt/sdkconfig.ci @@ -0,0 +1,2 @@ +# CONFIG_ESP_EVENT_POST_FROM_ISR is not set +CONFIG_BROKER_URL="mqtt://${CI_MQTT_BROKER_URI}" From 6d5411941b9fc728a3fcf03d0396b652778a4caf Mon Sep 17 00:00:00 2001 From: David Cermak Date: Fri, 25 Jul 2025 10:58:17 +0200 Subject: [PATCH 2/2] fix(modem): Make MQTT public broker endpoint configurable --- .github/workflows/modem__target-test.yml | 1 + .../esp_modem/examples/pppos_client/sdkconfig.ci.sim800_c3 | 1 + .../esp_modem/examples/pppos_client/sdkconfig.ci.usb_a7670_s2 | 1 + .../examples/simple_cmux_client/sdkconfig.ci.sim800_cmux | 2 +- 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/modem__target-test.yml b/.github/workflows/modem__target-test.yml index e2a663958..9dea3bc80 100644 --- a/.github/workflows/modem__target-test.yml +++ b/.github/workflows/modem__target-test.yml @@ -36,6 +36,7 @@ jobs: shell: bash working-directory: ${{ env.TEST_DIR }} run: | + . ${GITHUB_WORKSPACE}/ci/config_env.sh . ${IDF_PATH}/export.sh rm -rf sdkconfig build [ -f ${SDKCONFIG} ] && cp ${SDKCONFIG} sdkconfig.defaults diff --git a/components/esp_modem/examples/pppos_client/sdkconfig.ci.sim800_c3 b/components/esp_modem/examples/pppos_client/sdkconfig.ci.sim800_c3 index 23b0fc200..4fcd2179d 100644 --- a/components/esp_modem/examples/pppos_client/sdkconfig.ci.sim800_c3 +++ b/components/esp_modem/examples/pppos_client/sdkconfig.ci.sim800_c3 @@ -15,3 +15,4 @@ CONFIG_EXAMPLE_PAUSE_NETIF_TO_CHECK_SIGNAL=y CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT=y CONFIG_ESP32_PANIC_PRINT_HALT=y CONFIG_EXAMPLE_DETECT_MODE_BEFORE_CONNECT=y +CONFIG_EXAMPLE_MQTT_BROKER_URI="mqtt://${CI_MQTT_BROKER_URI}" diff --git a/components/esp_modem/examples/pppos_client/sdkconfig.ci.usb_a7670_s2 b/components/esp_modem/examples/pppos_client/sdkconfig.ci.usb_a7670_s2 index 665f78517..0804642fd 100644 --- a/components/esp_modem/examples/pppos_client/sdkconfig.ci.usb_a7670_s2 +++ b/components/esp_modem/examples/pppos_client/sdkconfig.ci.usb_a7670_s2 @@ -12,3 +12,4 @@ CONFIG_EXAMPLE_MODEM_PPP_AUTH_NONE=y CONFIG_EXAMPLE_MQTT_TEST_TOPIC="/ci/esp-modem/pppos-client" CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT=y CONFIG_ESP32_PANIC_PRINT_HALT=y +CONFIG_EXAMPLE_MQTT_BROKER_URI="mqtt://${CI_MQTT_BROKER_URI}" diff --git a/components/esp_modem/examples/simple_cmux_client/sdkconfig.ci.sim800_cmux b/components/esp_modem/examples/simple_cmux_client/sdkconfig.ci.sim800_cmux index 7154d2fc3..ede340955 100644 --- a/components/esp_modem/examples/simple_cmux_client/sdkconfig.ci.sim800_cmux +++ b/components/esp_modem/examples/simple_cmux_client/sdkconfig.ci.sim800_cmux @@ -16,4 +16,4 @@ CONFIG_COMPILER_CXX_EXCEPTIONS=y CONFIG_ESP_MAIN_TASK_STACK_SIZE=8192 CONFIG_EXAMPLE_CLOSE_CMUX_AT_END=y CONFIG_EXAMPLE_MQTT_TEST_TOPIC="/ci/esp-modem/pppos-client" -CONFIG_BROKER_URI="mqtt://test.mosquitto.org" +CONFIG_BROKER_URI="mqtt://${CI_MQTT_BROKER_URI}"