@@ -101,3 +101,83 @@ jobs:
101101 exit 1
102102 fi
103103 echo "Versions are consistent: $CONFIG_VERSION"
104+
105+ build_idf_tests_with_mosq :
106+ name : Build IDF tests
107+ strategy :
108+ matrix :
109+ idf_ver : ["latest"]
110+ idf_target : ["esp32"]
111+ test : [ { app: publish, path: "tools/test_apps/protocols/mqtt/publish_connect_test" }]
112+ runs-on : ubuntu-20.04
113+ container : espressif/idf:${{ matrix.idf_ver }}
114+ env :
115+ TARGET_TEST_DIR : build_esp32_local_broker
116+ steps :
117+ - name : Checkout code
118+ uses : actions/checkout@v4
119+ with :
120+ submodules : recursive
121+ - name : Build ${{ matrix.test.app }} with IDF-${{ matrix.idf_ver }} for ${{ matrix.idf_target }}
122+ shell : bash
123+ run : |
124+ . ${IDF_PATH}/export.sh
125+ pip install idf-component-manager idf-build-apps --upgrade
126+ export OVERRIDE_PATH=`pwd`/components/mosquitto
127+ echo ${OVERRIDE_PATH}
128+ sed -i '/espressif\/mosquitto:/a \ \ \ \ override_path: "${OVERRIDE_PATH}"' ${IDF_PATH}/${{matrix.test.path}}/main/idf_component.yml
129+ cat ${IDF_PATH}/${{matrix.test.path}}/main/idf_component.yml
130+ export PEDANTIC_FLAGS="-DIDF_CI_BUILD -Werror -Werror=deprecated-declarations -Werror=unused-variable -Werror=unused-but-set-variable -Werror=unused-function"
131+ export EXTRA_CFLAGS="${PEDANTIC_FLAGS} -Wstrict-prototypes"
132+ export EXTRA_CXXFLAGS="${PEDANTIC_FLAGS}"
133+ cd ${IDF_PATH}/${{matrix.test.path}}
134+ sed -i 's/4096, /5\*1024, /' main/publish_connect_test.c
135+ cat main/publish_connect_test.c
136+ idf-build-apps find --config sdkconfig.ci.local_broker -vv --target ${{ matrix.idf_target }} --build-dir=${TARGET_TEST_DIR}
137+ idf-build-apps build --config sdkconfig.ci.local_broker -vv --target ${{ matrix.idf_target }} --build-dir=${TARGET_TEST_DIR}
138+ ${GITHUB_WORKSPACE}/ci/clean_build_artifacts.sh `pwd`/${TARGET_TEST_DIR}
139+ sed '/@pytest.mark.parametrize.*config.*/{
140+ s/@pytest.mark.parametrize.*config.*local_broker.*/@pytest.mark.protocols/
141+ t
142+ d
143+ }' pytest_mqtt_publish_app.py > ${TARGET_TEST_DIR}/pytest_local_mosq.py
144+ cat ${TARGET_TEST_DIR}/pytest_local_mosq.py
145+ zip -qur ${GITHUB_WORKSPACE}/artifacts.zip ${TARGET_TEST_DIR}
146+ - uses : actions/upload-artifact@v4
147+ with :
148+ name : mosq_publish_esp32_${{ matrix.idf_ver }}
149+ path : artifacts.zip
150+ if-no-files-found : error
151+
152+ test_idf_ci_with_mosq :
153+ # Skip running on forks since it won't have access to secrets
154+ if : |
155+ github.repository == 'espressif/esp-protocols' &&
156+ ( contains(github.event.pull_request.labels.*.name, 'mosquitto') || github.event_name == 'push' )
157+ name : Mosquitto IDF target tests
158+ needs : build_idf_tests_with_mosq
159+ strategy :
160+ matrix :
161+ idf_ver : ["latest"]
162+ runs-on :
163+ - self-hosted
164+ - ESP32-ETHERNET-KIT
165+ env :
166+ TEST_DIR : examples
167+ steps :
168+ - uses : actions/checkout@v4
169+ - uses : actions/download-artifact@v4
170+ with :
171+ name : mosq_publish_esp32_${{ matrix.idf_ver }}
172+ path : ${{ env.TEST_DIR }}/ci/
173+ - name : Run Test
174+ working-directory : ${{ env.TEST_DIR }}
175+ run : |
176+ python -m pip install pytest-embedded-serial-esp pytest-embedded-idf pytest-rerunfailures pytest-timeout pytest-ignore-test-results "paho-mqtt<2"
177+ unzip ci/artifacts.zip -d ci
178+ for dir in `ls -d ci/build_*`; do
179+ rm -rf build sdkconfig.defaults
180+ mv $dir build
181+ mv build/*.py .
182+ python -m pytest --log-cli-level DEBUG --junit-xml=./results_esp32_${{ matrix.idf_ver }}_${dir#"ci/build_"}.xml --target=esp32 -m protocols
183+ done
0 commit comments