[mosq]: Add unit test and fix restart issue #3438
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: "examples: build/host-tests" | |
| on: | |
| push: | |
| branches: | |
| - master | |
| pull_request: | |
| types: [opened, synchronize, reopened, labeled] | |
| jobs: | |
| build_all_examples: | |
| if: contains(github.event.pull_request.labels.*.name, 'examples') || github.event_name == 'push' | |
| name: Build examples | |
| strategy: | |
| matrix: | |
| idf_ver: ["latest", "release-v5.1", "release-v5.2", "release-v5.3", "release-v5.4", "release-v5.5", "release-v6.0"] | |
| runs-on: ubuntu-22.04 | |
| container: espressif/idf:${{ matrix.idf_ver }} | |
| env: | |
| TARGET_TEST: examples/esp_netif/slip_custom_netif/ | |
| TARGET_TEST_DIR: build_esp32c3_target | |
| steps: | |
| - name: Checkout esp-protocols | |
| uses: actions/checkout@v4 | |
| - name: Build with IDF-${{ matrix.idf_ver }} | |
| env: | |
| EXPECTED_WARNING: "Warning: The smallest app partition is nearly full" | |
| shell: bash | |
| run: | | |
| . ${IDF_PATH}/export.sh | |
| python -m pip install idf-build-apps | |
| # Build default configs for all targets | |
| python ./ci/build_apps.py examples -m examples/.build-test-rules.yml -d -c | |
| # Build target tests | |
| python ./ci/build_apps.py ${TARGET_TEST} -r sdkconfig.ci=target | |
| cd ${TARGET_TEST} | |
| ${GITHUB_WORKSPACE}/ci/clean_build_artifacts.sh `pwd`/${TARGET_TEST_DIR} | |
| zip -qur artifacts.zip ${TARGET_TEST_DIR} | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: slip_target_${{ matrix.idf_ver }} | |
| path: ${{ env.TARGET_TEST }}/artifacts.zip | |
| if-no-files-found: error | |
| build_and_run_on_host: | |
| if: contains(github.event.pull_request.labels.*.name, 'examples') || github.event_name == 'push' | |
| name: Build and run examples on linux | |
| strategy: | |
| matrix: | |
| idf_ver: ["latest"] | |
| runs-on: ubuntu-22.04 | |
| container: espressif/idf:${{ matrix.idf_ver }} | |
| steps: | |
| - name: Checkout esp-protocols | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - 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 -r 'sdkconfig.ci' | |
| ./ci/test_broker/run.sh | |
| sleep 1 | |
| failed=0 | |
| timeout 5 ./examples/mqtt/build_linux/esp_mqtt_demo.elf | tee test.log || true | |
| grep 'MQTT_EVENT_DATA' test.log || failed=1 | |
| pkill -f 'broker.elf' || true | |
| exit $failed | |
| run_on_target: | |
| # Skip running on forks since it won't have access to secrets | |
| if: | | |
| github.repository == 'espressif/esp-protocols' && | |
| ( contains(github.event.pull_request.labels.*.name, 'examples') || github.event_name == 'push' ) | |
| name: Slip example target test | |
| needs: build_all_examples | |
| strategy: | |
| matrix: | |
| idf_ver: ["release-v5.5", "latest"] | |
| runs-on: | |
| - self-hosted | |
| - modem | |
| env: | |
| TARGET_TEST: examples/esp_netif/slip_custom_netif/ | |
| TARGET_TEST_DIR: build_esp32c3_target | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: slip_target_${{ matrix.idf_ver }} | |
| path: ${{ env.TARGET_TEST }}/ci/ | |
| - name: Run Test | |
| working-directory: ${{ env.TARGET_TEST }} | |
| run: | | |
| python -m venv .venv | |
| source .venv/bin/activate | |
| pip install --prefer-binary cryptography pytest-embedded pytest-embedded-serial-esp pytest-embedded-idf pytest-custom_exit_code esptool netifaces | |
| unzip ci/artifacts.zip -d ci | |
| for dir in `ls -d ci/build_*`; do | |
| rm -rf build sdkconfig.defaults | |
| mv $dir build | |
| python -m pytest --log-cli-level DEBUG --target=esp32c3 | |
| done |