From 263c1675c55deb1120553560ee6265c2b36a65cf Mon Sep 17 00:00:00 2001 From: Euripedes Rocha Date: Fri, 28 Feb 2025 11:16:26 +0100 Subject: [PATCH 1/2] fix: Update badges url to reflect current status --- README.md | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 6a6fe3e..1be44b6 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,17 @@ -[![](https://travis-ci.org/tuanpmt/espmqtt.svg?branch=master)](https://travis-ci.org/tuanpmt/espmqtt) -[![](http://hits.dwyl.io/tuanpmt/espmqtt.svg)](http://hits.dwyl.io/tuanpmt/espmqtt) -[![Twitter Follow](https://img.shields.io/twitter/follow/tuanpmt.svg?style=social&label=Follow)](https://twitter.com/tuanpmt) -![GitHub contributors](https://img.shields.io/github/contributors/tuanpmt/espmqtt.svg) - # ESP32 MQTT Library +![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/espressif/esp-mqtt/test-examples.yml?branch=master) +![License](https://img.shields.io/github/license/espressif/esp-mqtt) +![GitHub contributors](https://img.shields.io/github/contributors/espressif/esp-mqtt) + ## Features -- Based on: https://github.com/tuanpmt/esp_mqtt +- Based on: - Support MQTT over TCP, SSL with mbedtls, MQTT over Websocket, MQTT over Websocket Secure -- Easy to setup with URI +- Easy to setup with URI - Multiple instances (Multiple clients in one application) - Support subscribing, publishing, authentication, will messages, keep alive pings and all 3 QoS levels (it should be a fully functional client). +- Support for MQTT 3.1.1 and 5.0 ## How to use @@ -20,9 +20,9 @@ Please refer to instructions in [ESP-IDF](https://github.com/espressif/esp-idf) ## Documentation -* Please refer to the standard [ESP-IDF](https://github.com/espressif/esp-idf), documentation for the latest version: https://docs.espressif.com/projects/esp-idf/ +- Please refer to the standard [ESP-IDF](https://github.com/espressif/esp-idf), documentation for the latest version: -* Documentation of ESP-MQTT API: https://docs.espressif.com/projects/esp-idf/en/latest/api-reference/protocols/mqtt.html +- Documentation of ESP-MQTT API: ## License @@ -33,7 +33,9 @@ Apache License ## Older IDF verisons For [ESP-IDF](https://github.com/espressif/esp-idf) versions prior to IDFv3.2, please clone as a component of [ESP-IDF](https://github.com/espressif/esp-idf): + ``` git submodule add https://github.com/espressif/esp-mqtt.git components/espmqtt ``` + and checkout the [ESP-MQTT_FOR_IDF_3.1](https://github.com/espressif/esp-mqtt/tree/ESP-MQTT_FOR_IDF_3.1) tag From bb85b20af67effa47768dc9167a84a90b809b23b Mon Sep 17 00:00:00 2001 From: Euripedes Rocha Date: Fri, 28 Feb 2025 11:18:06 +0100 Subject: [PATCH 2/2] fix: Adds all IDF versions under support --- .gitlab-ci.yml | 201 ++++++++++++++++++++++++++----------------------- 1 file changed, 106 insertions(+), 95 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 09d6315..50e9301 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,118 +1,129 @@ stages: - - build - - test - - deploy - + - build + - test + - deploy variables: - IDF_REPO: ${GITLAB_SSH_SERVER}/idf/esp-idf.git + IDF_REPO: ${GITLAB_SSH_SERVER}/idf/esp-idf.git .add_gh_key_remote: &add_gh_key_remote | - cit_add_ssh_key "${GH_PUSH_KEY}" - git remote remove github || true - git remote add github ${GH_PUSH_REPO} + cit_add_ssh_key "${GH_PUSH_KEY}" + git remote remove github || true + git remote add github ${GH_PUSH_REPO} before_script: - # Use CI Tools - - curl -sSL ${CIT_LOADER_URL} | sh - - source citools/import_functions - # Add gitlab ssh key - - mkdir -p ~/.ssh - - chmod 700 ~/.ssh - - echo -n $GITLAB_KEY > ~/.ssh/id_rsa_base64 - - base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa - - chmod 600 ~/.ssh/id_rsa - - echo -e "Host gitlab.espressif.cn\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config - - PATH=$CI_PROJECT_DIR/esp-idf/tools:$PATH - - export MQTT_PATH=$CI_PROJECT_DIR + # Use CI Tools + - curl -sSL ${CIT_LOADER_URL} | sh + - source citools/import_functions + # Add gitlab ssh key + - mkdir -p ~/.ssh + - chmod 700 ~/.ssh + - echo -n $GITLAB_KEY > ~/.ssh/id_rsa_base64 + - base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa + - chmod 600 ~/.ssh/id_rsa + - echo -e "Host gitlab.espressif.cn\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config + - PATH=$CI_PROJECT_DIR/esp-idf/tools:$PATH + - export MQTT_PATH=$CI_PROJECT_DIR .build_template: - stage: build - tags: - - build - - internet - script: - # Replace the IDF's default esp-mqtt with this version - - rm -rf $IDF_PATH/components/mqtt/esp-mqtt && cp -r $MQTT_PATH $IDF_PATH/components/mqtt/ - # Build the examples - - $MQTT_PATH/ci/build_examples.sh + stage: build + tags: + - build + - internet + script: + # Replace the IDF's default esp-mqtt with this version + - rm -rf $IDF_PATH/components/mqtt/esp-mqtt && cp -r $MQTT_PATH $IDF_PATH/components/mqtt/ + # Build the examples + - $MQTT_PATH/ci/build_examples.sh build_idf_v5.0: - extends: .build_template - image: espressif/idf:release-v5.0 + extends: .build_template + image: espressif/idf:release-v5.0 build_idf_v5.1: - extends: .build_template - image: espressif/idf:release-v5.1 + extends: .build_template + image: espressif/idf:release-v5.1 + +build_idf_v5.2: + extends: .build_template + image: espressif/idf:release-v5.2 + +build_idf_v5.3: + extends: .build_template + image: espressif/idf:release-v5.3 + +build_idf_v5.4: + extends: .build_template + image: espressif/idf:release-v5.4 build_idf_latest: - extends: .build_template - image: espressif/idf:latest + extends: .build_template + image: espressif/idf:latest build_and_host_test: - stage: build - image: espressif/idf:latest - script: - # Replace the IDF's default esp-mqtt with this version - - rm -rf $IDF_PATH/components/mqtt/esp-mqtt && cp -r $MQTT_PATH $IDF_PATH/components/mqtt/ - - cd $IDF_PATH/components/mqtt/esp-mqtt/host_test - - idf.py build - - build/host_mqtt_client_test.elf + stage: build + image: espressif/idf:latest + script: + # Replace the IDF's default esp-mqtt with this version + - rm -rf $IDF_PATH/components/mqtt/esp-mqtt && cp -r $MQTT_PATH $IDF_PATH/components/mqtt/ + - cd $IDF_PATH/components/mqtt/esp-mqtt/host_test + - idf.py build + - build/host_mqtt_client_test.elf build_and_test_qemu: - stage: build - image: ${CI_DOCKER_REGISTRY}/qemu-v5.1:1-20220802 - tags: - - build - - shiny - dependencies: [] - script: - - export IDF_PATH=$CI_PROJECT_DIR/esp-idf - - git clone "${IDF_REPO}" - # switch to IDF and setup the tools - - $MQTT_PATH/ci/set_idf.sh release/v5.1 - - $IDF_PATH/tools/idf_tools.py install-python-env - - cd $IDF_PATH && tools/idf_tools.py --non-interactive install && eval "$(tools/idf_tools.py --non-interactive export)" - # Remove `debug_backend` and Add `paho-mqtt` to the required packages - - sed '/debug_backend/d;/pygobject/d' $IDF_PATH/tools/requirements/requirements.ttfw.txt > requirements.txt - - python -m pip install -r requirements.txt - - python -m pip install paho-mqtt - - $MQTT_PATH/ci/set_mqtt.sh $CI_COMMIT_SHA - # build publish-connect stress test, setup test parameters - - cd tools/test_apps/protocols/mqtt/publish_connect_test && cat sdkconfig.qemu | $IDF_PATH/tools/ci/envsubst.py > sdkconfig.defaults && idf.py build - - export TEST_PATH=`pwd` && export MQTT_PUBLISH_TEST=1 - - export PYTHONPATH="$IDF_PATH/tools:$IDF_PATH/tools/ci/python_packages" - # run test (with environment->qemu) - - cd $IDF_PATH/tools/ci/python_packages/tiny_test_fw/bin - # use more relaxed criteria with QEMU tests - - export MQTT_PUBLISH_MSG_len_0=0 MQTT_PUBLISH_MSG_repeat_0=5 - - export MQTT_PUBLISH_MSG_len_1=2 MQTT_PUBLISH_MSG_repeat_1=50 - - export MQTT_PUBLISH_MSG_len_2=128 MQTT_PUBLISH_MSG_repeat_2=2 - - export MQTT_PUBLISH_MSG_len_3=20 MQTT_PUBLISH_MSG_repeat_3=20 - - python Runner.py $TEST_PATH -c $MQTT_PATH/ci/publish_connect_mqtt_qemu.yml -e $TEST_PATH/env.yml + stage: build + image: ${CI_DOCKER_REGISTRY}/qemu-v5.1:1-20220802 + tags: + - build + - shiny + dependencies: [] + script: + - export IDF_PATH=$CI_PROJECT_DIR/esp-idf + - git clone "${IDF_REPO}" + # switch to IDF and setup the tools + - $MQTT_PATH/ci/set_idf.sh release/v5.1 + - $IDF_PATH/tools/idf_tools.py install-python-env + - cd $IDF_PATH && tools/idf_tools.py --non-interactive install && eval "$(tools/idf_tools.py --non-interactive export)" + # Remove `debug_backend` and Add `paho-mqtt` to the required packages + - sed '/debug_backend/d;/pygobject/d' $IDF_PATH/tools/requirements/requirements.ttfw.txt > requirements.txt + - python -m pip install -r requirements.txt + - python -m pip install paho-mqtt + - $MQTT_PATH/ci/set_mqtt.sh $CI_COMMIT_SHA + # build publish-connect stress test, setup test parameters + - cd tools/test_apps/protocols/mqtt/publish_connect_test && cat sdkconfig.qemu | $IDF_PATH/tools/ci/envsubst.py > sdkconfig.defaults && idf.py build + - export TEST_PATH=`pwd` && export MQTT_PUBLISH_TEST=1 + - export PYTHONPATH="$IDF_PATH/tools:$IDF_PATH/tools/ci/python_packages" + # run test (with environment->qemu) + - cd $IDF_PATH/tools/ci/python_packages/tiny_test_fw/bin + # use more relaxed criteria with QEMU tests + - export MQTT_PUBLISH_MSG_len_0=0 MQTT_PUBLISH_MSG_repeat_0=5 + - export MQTT_PUBLISH_MSG_len_1=2 MQTT_PUBLISH_MSG_repeat_1=50 + - export MQTT_PUBLISH_MSG_len_2=128 MQTT_PUBLISH_MSG_repeat_2=2 + - export MQTT_PUBLISH_MSG_len_3=20 MQTT_PUBLISH_MSG_repeat_3=20 + - python Runner.py $TEST_PATH -c $MQTT_PATH/ci/publish_connect_mqtt_qemu.yml -e $TEST_PATH/env.yml check_remotes_sync: - stage: test - except: - - master - - idf - script: - - *add_gh_key_remote - - git fetch --depth=1 origin master - - git fetch --depth=1 github master - - test "$(git rev-parse origin/master)" == "$(git rev-parse github/master)" + stage: test + except: + - master + - idf + script: + - *add_gh_key_remote + - git fetch --depth=1 origin master + - git fetch --depth=1 github master + - test "$(git rev-parse origin/master)" == "$(git rev-parse github/master)" push_master_to_github: - stage: deploy - image: ${CI_DOCKER_REGISTRY}/esp32-ci-env - tags: - - build - only: - - master - - idf - when: on_success - variables: - GIT_STRATEGY: clone - script: - - *add_gh_key_remote - - git push github HEAD:${CI_COMMIT_REF_NAME} + stage: deploy + image: ${CI_DOCKER_REGISTRY}/esp32-ci-env + tags: + - build + only: + - master + - idf + when: on_success + variables: + GIT_STRATEGY: clone + script: + - *add_gh_key_remote + - git push github HEAD:${CI_COMMIT_REF_NAME}