From 42f5cfc71def80aa29d87219909e62c848621138 Mon Sep 17 00:00:00 2001 From: Euripedes Rocha Date: Wed, 21 May 2025 15:25:48 +0200 Subject: [PATCH] Adds publish connect to gh Placeholder commit for testing --- .github/actions/build-app/action.yml | 54 +++++++ .github/actions/target-pytest/action.yml | 52 +++++++ .github/workflows/build-and-target-test.yml | 26 ++-- .github/workflows/build-app.yml | 66 ++++---- .github/workflows/mqtt__host-tests.yml | 150 +++++++++--------- .github/workflows/publish-connect.yml | 137 ++++++++++++++++ .github/workflows/run-on-target.yml | 74 ++++----- .github/workflows/test-examples.yml | 164 +++++++++++++++----- 8 files changed, 524 insertions(+), 199 deletions(-) create mode 100644 .github/actions/build-app/action.yml create mode 100644 .github/actions/target-pytest/action.yml create mode 100644 .github/workflows/publish-connect.yml diff --git a/.github/actions/build-app/action.yml b/.github/actions/build-app/action.yml new file mode 100644 index 0000000..3221791 --- /dev/null +++ b/.github/actions/build-app/action.yml @@ -0,0 +1,54 @@ +name: Build app +description: Build ESP-IDF applications + +inputs: + idf_version: + required: true + description: ESP-IDF version to use + target: + required: true + description: Target platform + app_name: + required: true + description: Application name + app_path: + required: true + description: Path to the application + build_dir: + required: false + description: Directory for build artifacts + default: build_@t_ + +outputs: + artifacts_path: + description: "App path" + value: ${{ steps.set-path.outputs.artifacts_path }} + +runs: + using: "composite" + steps: + - name: ccache + uses: hendrikmuhs/ccache-action@v1.2 + with: + key: ${{ inputs.idf_version }}-${{ inputs.target }} + - name: Install dependencies + shell: bash + run: | + . ${IDF_PATH}/export.sh + python -m pip install idf-build-apps + - name: Build ${{ inputs.app_name }} with IDF-${{ inputs.idf_version }} + shell: bash + run: | + . ${IDF_PATH}/export.sh + export PEDANTIC_FLAGS="-DIDF_CI_BUILD -Werror -Werror=deprecated-declarations -Werror=unused-variable -Werror=unused-but-set-variable -Werror=unused-function" + export EXTRA_CFLAGS="${PEDANTIC_FLAGS} -Wstrict-prototypes" + export EXTRA_CXXFLAGS="${PEDANTIC_FLAGS}" + rm -rf $IDF_PATH/components/mqtt/esp-mqtt + cp -r . $IDF_PATH/components/mqtt/esp-mqtt + IDF_CCACHE_ENABLE=1 idf-build-apps build --config-rules "sdkconfig.ci.*=" "=default" --collect-app-info build_info_${{ inputs.idf_version }}.json --build-dir ${{ inputs.build_dir }} -p ${{ inputs.app_path }} -t ${{ inputs.target }} + - name: Set app artifact path + id: set-path + shell: bash + run: | + artifacts_path=$(eval echo "${{ inputs.app_path }}") + echo "artifacts_path=$artifacts_path" >> "$GITHUB_OUTPUT" diff --git a/.github/actions/target-pytest/action.yml b/.github/actions/target-pytest/action.yml new file mode 100644 index 0000000..30bdbfe --- /dev/null +++ b/.github/actions/target-pytest/action.yml @@ -0,0 +1,52 @@ +name: Target Pytest run +description: Run pytest test cases + +inputs: + target: + required: true + description: Target platform + app_name: + required: true + description: Application name + app_path: + required: true + description: Path to the application + build_dir: + required: false + description: Directory for build artifacts + +runs: + using: "composite" + steps: + - name: Install Python packages + shell: bash + env: + PIP_EXTRA_INDEX_URL: "https://dl.espressif.com/pypi/" + run: pip install --prefer-binary cryptography pytest-embedded pytest-embedded-serial-esp pytest-embedded-idf pytest-custom_exit_code + - name: Run apps + shell: bash + run: | + pytest ${{inputs.app_path}} --ignore-glob '*/managed_components/*' --ignore=.github --target=${{ inputs.target }} --embedded-services esp,idf --build-dir build_esp32_default + # - name: Upload test results + # uses: actions/upload-artifact@v4 + # if: always() + # with: + # name: ${{ env.TEST_RESULT_NAME }} + # path: ${{ env.TEST_RESULT_FILE }} + + # publish-results: + # name: Publish Test results + # needs: + # - run-target + # if: github.repository_owner == 'espressif' && always() && github.event_name == 'pull_request' && needs.prepare.outputs.build_only == '0' + # runs-on: ubuntu-22.04 + # steps: + # - name: Download Test results + # uses: actions/download-artifact@v4 + # with: + # pattern: test_results_* + # path: test_results + # - name: Publish Test Results + # uses: EnricoMi/publish-unit-test-result-action@v2 + # with: + # files: test_results/**/*.xml path: build/*.xml diff --git a/.github/workflows/build-and-target-test.yml b/.github/workflows/build-and-target-test.yml index dad45e5..8116fbc 100644 --- a/.github/workflows/build-and-target-test.yml +++ b/.github/workflows/build-and-target-test.yml @@ -16,22 +16,20 @@ on: type: string required: true - jobs: build-app: uses: "./.github/workflows/build-app.yml" with: - idf_version: ${{inputs.idf_version}} - target: ${{inputs.target}} - app_name: ${{inputs.app_name}} - app_path: ${{inputs.app_path}} - - # run-on-target: - # needs: build-app - # uses: "./.github/workflows/run-on-target.yml" - # with: - # idf_version: ${{inputs.idf_version}} - # target: ${{inputs.target}} - # app_name: ${{inputs.app_name}} - # app_path: ${{inputs.app_path}} + idf_version: ${{inputs.idf_version}} + target: ${{inputs.target}} + app_name: ${{inputs.app_name}} + app_path: ${{inputs.app_path}} + run-on-target: + needs: build-app + uses: "./.github/workflows/run-on-target.yml" + with: + idf_version: ${{inputs.idf_version}} + target: ${{inputs.target}} + app_name: ${{inputs.app_name}} + app_path: ${{inputs.app_path}} diff --git a/.github/workflows/build-app.yml b/.github/workflows/build-app.yml index 4566def..0215dee 100644 --- a/.github/workflows/build-app.yml +++ b/.github/workflows/build-app.yml @@ -22,38 +22,38 @@ on: jobs: build: name: Build App - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 container: espressif/idf:${{inputs.idf_version}} steps: - - if: ${{ env.ACT }} - name: Add node for local tests - run: | - curl -fsSL https://deb.nodesource.com/setup_14.x | bash - - apt-get install -y nodejs - - name: Checkout esp-mqtt - uses: actions/checkout@v4 - - name: ccache - uses: hendrikmuhs/ccache-action@v1.2 - with: - key: ${{inputs.idf_version}}-${{inputs.target}} - - name: Build ${{ inputs.app_name }} with IDF-${{ inputs.idf_version }} - shell: bash - run: | - ${IDF_PATH}/install.sh --enable-pytest - . ${IDF_PATH}/export.sh - python -m pip install idf-build-apps - rm -rf $IDF_PATH/components/mqtt/esp-mqtt - cp -r . $IDF_PATH/components/mqtt/esp-mqtt - IDF_CCACHE_ENABLE=1 idf-build-apps build --config-file ci/idf_build_apps.toml -p ${{inputs.app_path}} -t ${{inputs.target}} - - name: Upload files to artifacts for run-target job - uses: actions/upload-artifact@v4 - if: ${{inputs.upload_artifacts}} - with: - name: mqtt_bin_${{inputs.target}}_${{ inputs.idf_version }}_${{ inputs.app_name }} - path: | - build_${{inputs.target}}_${{inputs.app_name}}/bootloader/bootloader.bin - build_${{inputs.target}}_${{inputs.app_name}}/partition_table/partition-table.bin - build_${{inputs.target}}_${{inputs.app_name}}/*.bin - build_${{inputs.target}}_${{inputs.app_name}}/*.elf - build_${{inputs.target}}_${{inputs.app_name}}/flasher_args.json - if-no-files-found: error + - if: ${{ env.ACT }} + name: Add node for local tests + run: | + curl -fsSL https://deb.nodesource.com/setup_18.x | bash - + apt-get install -y nodejs + - name: Checkout esp-mqtt + uses: actions/checkout@v4 + - name: ccache + uses: hendrikmuhs/ccache-action@v1.2 + with: + key: ${{inputs.idf_version}}-${{inputs.target}} + - name: Build ${{ inputs.app_name }} with IDF-${{ inputs.idf_version }} + shell: bash + run: | + ${IDF_PATH}/install.sh + . ${IDF_PATH}/export.sh + python -m pip install idf-build-apps + rm -rf $IDF_PATH/components/mqtt/esp-mqtt + cp -r . $IDF_PATH/components/mqtt/esp-mqtt + IDF_CCACHE_ENABLE=1 idf-build-apps build --config-file ci/idf_build_apps.toml -p ${{inputs.app_path}} -t ${{inputs.target}} + - name: Upload files to artifacts for run-target job + uses: actions/upload-artifact@v4 + if: ${{inputs.upload_artifacts}} + with: + name: mqtt_bin_${{inputs.target}}_${{ inputs.idf_version }}_${{ inputs.app_name }} + path: | + build_${{inputs.target}}_${{inputs.app_name}}/bootloader/bootloader.bin + build_${{inputs.target}}_${{inputs.app_name}}/partition_table/partition-table.bin + build_${{inputs.target}}_${{inputs.app_name}}/*.bin + build_${{inputs.target}}_${{inputs.app_name}}/*.elf + build_${{inputs.target}}_${{inputs.app_name}}/flasher_args.json + if-no-files-found: error diff --git a/.github/workflows/mqtt__host-tests.yml b/.github/workflows/mqtt__host-tests.yml index 7af556d..fc551f7 100644 --- a/.github/workflows/mqtt__host-tests.yml +++ b/.github/workflows/mqtt__host-tests.yml @@ -1,80 +1,80 @@ name: "esp-mqtt: host-tests" on: - push: - branches: - - master - pull_request: - types: [opened, synchronize, reopened, labeled] + push: + branches: + - master + pull_request: + types: [opened, synchronize, reopened, labeled] jobs: - host_test_esp_mqtt: - name: Host Tests - runs-on: ubuntu-22.04 - permissions: - contents: write - container: espressif/idf:latest - env: - COMP_DIR: components/mqtt/esp-mqtt - steps: - - name: Checkout esp-mqtt - uses: actions/checkout@v4 - - name: Build and Test - shell: bash - run: | - apt-get update && apt-get install -y gcc g++ python3-pip rsync - ${IDF_PATH}/install.sh - . ${IDF_PATH}/export.sh - echo "IDF_PATH=${IDF_PATH}" >> $GITHUB_ENV - rm -rf $IDF_PATH/${{ env.COMP_DIR }} - cp -r . $IDF_PATH/${{ env.COMP_DIR }} - cd $IDF_PATH/${{ env.COMP_DIR }}/host_test - idf.py build - ./build/host_mqtt_client_test.elf -r junit -o junit.xml - - name: Build with Coverage Enabled - shell: bash - run: | - . ${IDF_PATH}/export.sh - cd $IDF_PATH/${{ env.COMP_DIR }}/host_test - cat sdkconfig.ci.coverage >> sdkconfig.defaults - rm -rf build sdkconfig - idf.py build - ./build/host_mqtt_client_test.elf - - name: Run gcovr - shell: bash - run: | - python -m pip install gcovr --break-system-packages - cd $IDF_PATH/${{ env.COMP_DIR }} - gcov -b host_test/main/mqtt_client.c. -o `find . -name "mqtt_client*gcda" -exec dirname {} \;` - gcovr --gcov-ignore-parse-errors -g -k -r . --html index.html -x esp_mqtt_coverage.xml - mkdir docs_gcovr - mv index.html docs_gcovr - touch docs_gcovr/.nojekyll - cp -r docs_gcovr esp_mqtt_coverage.xml $GITHUB_WORKSPACE - - name: Code Coverage Summary Report - uses: irongut/CodeCoverageSummary@v1.3.0 - with: - filename: ${{ env.GITHUB_WORKSPACE }}/**/esp_mqtt_coverage.xml - badge: true - fail_below_min: false - format: markdown - hide_branch_rate: false - hide_complexity: false - indicators: true - output: both - thresholds: '60 80' - - name: Write to Job Summary - run: cat code-coverage-results.md >> $GITHUB_STEP_SUMMARY - - name: Upload artifacts - uses: actions/upload-artifact@v4 - if: always() - with: - name: docs_gcovr - path: ${{ env.IDF_PATH }}/${{ env.COMP_DIR }}/docs_gcovr - if-no-files-found: error - - name: Deploy coverage summary - if: github.ref == 'refs/heads/master' - uses: JamesIves/github-pages-deploy-action@v4.4.1 - with: - branch: gh-pages - folder: ${{ env.IDF_PATH }}/${{ env.COMP_DIR }}/docs_gcovr + host_test_esp_mqtt: + name: Host Tests + runs-on: ubuntu-24.04 + permissions: + contents: write + container: espressif/idf:latest + env: + COMP_DIR: components/mqtt/esp-mqtt + steps: + - name: Checkout esp-mqtt + uses: actions/checkout@v4 + - name: Build and Test + shell: bash + run: | + apt-get update && apt-get install -y gcc g++ python3-pip rsync + ${IDF_PATH}/install.sh + . ${IDF_PATH}/export.sh + echo "IDF_PATH=${IDF_PATH}" >> $GITHUB_ENV + rm -rf $IDF_PATH/${{ env.COMP_DIR }} + cp -r . $IDF_PATH/${{ env.COMP_DIR }} + cd $IDF_PATH/${{ env.COMP_DIR }}/host_test + idf.py build + ./build/host_mqtt_client_test.elf -r junit -o junit.xml + - name: Build with Coverage Enabled + shell: bash + run: | + . ${IDF_PATH}/export.sh + cd $IDF_PATH/${{ env.COMP_DIR }}/host_test + cat sdkconfig.ci.coverage >> sdkconfig.defaults + rm -rf build sdkconfig + idf.py build + ./build/host_mqtt_client_test.elf + - name: Run gcovr + shell: bash + run: | + python -m pip install gcovr --break-system-packages + cd $IDF_PATH/${{ env.COMP_DIR }} + gcov -b host_test/main/mqtt_client.c. -o `find . -name "mqtt_client*gcda" -exec dirname {} \;` + gcovr --gcov-ignore-parse-errors -g -k -r . --html index.html -x esp_mqtt_coverage.xml + mkdir docs_gcovr + mv index.html docs_gcovr + touch docs_gcovr/.nojekyll + cp -r docs_gcovr esp_mqtt_coverage.xml $GITHUB_WORKSPACE + - name: Code Coverage Summary Report + uses: irongut/CodeCoverageSummary@v1.3.0 + with: + filename: ${{ env.GITHUB_WORKSPACE }}/**/esp_mqtt_coverage.xml + badge: true + fail_below_min: false + format: markdown + hide_branch_rate: false + hide_complexity: false + indicators: true + output: both + thresholds: "60 80" + - name: Write to Job Summary + run: cat code-coverage-results.md >> $GITHUB_STEP_SUMMARY + - name: Upload artifacts + uses: actions/upload-artifact@v4 + if: always() + with: + name: docs_gcovr + path: ${{ env.IDF_PATH }}/${{ env.COMP_DIR }}/docs_gcovr + if-no-files-found: error + - name: Deploy coverage summary + if: github.ref == 'refs/heads/master' + uses: JamesIves/github-pages-deploy-action@v4.4.1 + with: + branch: gh-pages + folder: ${{ env.IDF_PATH }}/${{ env.COMP_DIR }}/docs_gcovr diff --git a/.github/workflows/publish-connect.yml b/.github/workflows/publish-connect.yml new file mode 100644 index 0000000..206ad10 --- /dev/null +++ b/.github/workflows/publish-connect.yml @@ -0,0 +1,137 @@ +name: "Publish connect tests" +on: + push: + branches: + - master + pull_request: + types: [opened, synchronize, reopened, labeled] + +env: + target: esp32 + idf_version: latest + app_name: publish_connect_test + app_path: $IDF_PATH/tools/test_apps/protocols/mqtt/publish_connect_test + +jobs: + build: + name: Build Test App + runs-on: ubuntu-22.04 + env: + EXAMPLE_MQTT_BROKER_SSL: "mqtt.eclipseprojects.io:1883" + EXAMPLE_MQTT_BROKER_TCP: "mqtt.eclipseprojects.io:8883" + EXAMPLE_MQTT_BROKER_WS: "mqtt.eclipseprojects.io" + EXAMPLE_MQTT_BROKER_WSS: "mqtt.eclipseprojects.io" + outputs: + build_path: ${{steps.build.outputs.artifacts_path}} + container: espressif/idf:latest + steps: + - name: Add node for local tests + if: ${{ env.ACT }} + shell: bash + run: | + curl -fsSL https://deb.nodesource.com/setup_18.x | bash - + apt-get install -y nodejs + - name: Checkout esp-mqtt + uses: actions/checkout@v4 + - name: Build App + id: build + uses: ./.github/actions/build-app + with: + idf_version: latest + target: ${{env.target}} + app_name: ${{env.app_name}} + app_path: ${{env.app_path}} + build_dir: build_@t_@w + - name: Upload files to artifacts for run-target job + uses: actions/upload-artifact@v4 + with: + name: mqtt_bin_${{env.target}}_${{ env.idf_version }}_${{ env.app_name }} + path: | + ${{steps.build.outputs.artifacts_path}}/build_*/bootloader/bootloader.bin + ${{steps.build.outputs.artifacts_path}}/build_*/partition_table/partition-table.bin + ${{steps.build.outputs.artifacts_path}}/build_*/*.bin + ${{steps.build.outputs.artifacts_path}}/build_*/flasher_args.json + ${{steps.build.outputs.artifacts_path}}/build_*/config/sdkconfig.json + ${{steps.build.outputs.artifacts_path}}/sdkconfig + if-no-files-found: error + + run-on-target: + # if: github.repository == 'espressif/esp-mqtt' + name: Publish and Connect target test + needs: build + # strategy: + # fail-fast: false + # matrix: + # idf_ver: + # - "release-v5.0" + # - "release-v5.1" + # - "release-v5.2" + # - "release-v5.3" + # - "release-v5.4" + # - "release-v5.5" + # - "latest" + # runner: + # - runs-on: "esp32" + # marker: "generic" + # target: "esp32" + # - runs-on: "ESP32-ETHERNET-KIT" + # marker: "ethernet" + # target: "esp32" + # - runs-on: "spi_nand_flash" + # marker: "spi_nand_flash" + # target: "esp32" + # env: + # TEST_RESULT_NAME: test_results_${{ matrix.runner.target }}_${{ matrix.runner.marker }}_${{ matrix.idf_ver }} + # TEST_RESULT_FILE: test_results_${{ matrix.runner.target }}_${{ matrix.runner.marker }}_${{ matrix.idf_ver }}.xml + # runs-on: [self-hosted, linux, docker, "${{ matrix.runner.runs-on }}"] + container: + image: python:3.11-bookworm + options: --privileged # Privileged mode has access to serial ports + runs-on: [self-hosted, linux, docker, ESP32-ETHERNET-KIT] + + strategy: + matrix: + idf_version: ["latest"] + target: ["esp32"] + example: + [ + { + name: publish_connect_test, + path: "publish_connect_test", + }, + ] + steps: + - name: Add node for local tests + if: ${{ env.ACT }} + shell: bash + run: | + curl -fsSL https://deb.nodesource.com/setup_18.x | bash - + apt-get install -y nodejs + - uses: actions/checkout@v4 + - name: Checkout IDF ${{inputs.idf_version}} + uses: actions/checkout@v4 + with: + repository: espressif/esp-idf + path: idf + ref: master + - name: Install Python packages + shell: bash + env: + PIP_EXTRA_INDEX_URL: "https://dl.espressif.com/pypi/" + run: pip install --prefer-binary -r idf/tools/requirements/requirements.pytest.txt + - name: Download artifacts + uses: actions/download-artifact@v4 + id: artifacts + with: + name: mqtt_bin_${{env.target}}_${{ env.idf_version }}_${{ env.app_name }} + path: idf/tools/test_apps/protocols/mqtt/publish_connect_test + - name: Check json + shell: bash + run: cat idf/tools/test_apps/protocols/mqtt/publish_connect_test/build_esp32_default/config/sdkconfig.json + + - name: Run app + uses: ./.github/actions/target-pytest + with: + target: esp32 + app_name: publish_connnect_test + app_path: idf/tools/test_apps/protocols/mqtt/publish_connect_test diff --git a/.github/workflows/run-on-target.yml b/.github/workflows/run-on-target.yml index c67cc6b..0a95819 100644 --- a/.github/workflows/run-on-target.yml +++ b/.github/workflows/run-on-target.yml @@ -24,41 +24,41 @@ jobs: IDF_PATH: idf runs-on: [self-hosted, ESP32-ETHERNET-KIT] steps: - - name: Select idf ref - id: detect_version - run: | - if echo "${{inputs.idf_version}}" | grep "latest" -> /dev/null ; then - echo ref="master" >> "$GITHUB_OUTPUT" - else - echo ref="`echo ${{matrix.idf_version}} | sed -s "s/-/\//"`" >> "$GITHUB_OUTPUT" - fi - - name: IP discovery - id: detect_ip - run: | - apt-get update && apt-get install -y iproute2 - ip route - echo runner_ip ="`ip -4 addr show eth0 | grep -oP '(?<=inet\s)\d+(\.\d+){3}'`" >> "$GITHUB_OUTPUT" - - name: Checkout IDF ${{inputs.idf_version}} - uses: actions/checkout@v4 - with: - repository: espressif/esp-idf - path: ${{env.IDF_PATH}} - ref: ${{steps.detect_version.outputs.ref}} - - name: Install Python packages - env: - PIP_EXTRA_INDEX_URL: "https://dl.espressif.com/pypi/" - run: | - pip install --only-binary cryptography -r ${{env.IDF_PATH}}/tools/requirements/requirements.pytest.txt - - uses: actions/download-artifact@v4 - with: - name: mqtt_bin_${{inputs.target}}_${{ inputs.idf_version }}_${{ inputs.app_name }} - path: build + - name: Select idf ref + id: detect_version + run: | + if echo "${{inputs.idf_version}}" | grep "latest" -> /dev/null ; then + echo ref="master" >> "$GITHUB_OUTPUT" + else + echo ref="`echo ${{matrix.idf_version}} | sed -s "s/-/\//"`" >> "$GITHUB_OUTPUT" + fi + - name: IP discovery + id: detect_ip + run: | + apt-get update && apt-get install -y iproute2 + ip route + echo runner_ip ="`ip -4 addr show eth0 | grep -oP '(?<=inet\s)\d+(\.\d+){3}'`" >> "$GITHUB_OUTPUT" + - name: Checkout IDF ${{inputs.idf_version}} + uses: actions/checkout@v4 + with: + repository: espressif/esp-idf + path: ${{env.IDF_PATH}} + ref: ${{steps.detect_version.outputs.ref}} + - name: Install Python packages + env: + PIP_EXTRA_INDEX_URL: "https://dl.espressif.com/pypi/" + run: | + pip install --only-binary cryptography -r ${{env.IDF_PATH}}/tools/requirements/requirements.pytest.txt + - uses: actions/download-artifact@v4 + with: + name: mqtt_bin_${{inputs.target}}_${{ inputs.idf_version }}_${{ inputs.app_name }} + path: build - - name: Run ${{inputs.app_name}} application on ${{inputs.target}} - run: | - python -m pytest ${{inputs.app_path}} --log-cli-level DEBUG --app-path . --junit-xml=./results_${{inputs.app_name}}_${{inputs.idf_version}}.xml --target=${{inputs.target}} - - uses: actions/upload-artifact@v4 - if: always() - with: - name: results_${{inputs.app_name}}_${{inputs.idf_version}}.xml - path: build/*.xml + - name: Run ${{inputs.app_name}} application on ${{inputs.target}} + run: | + python -m pytest ${{inputs.app_path}} --log-cli-level DEBUG --app-path . --junit-xml=./results_${{inputs.app_name}}_${{inputs.idf_version}}.xml --target=${{inputs.target}} + - uses: actions/upload-artifact@v4 + if: always() + with: + name: results_${{inputs.app_name}}_${{inputs.idf_version}}.xml + path: build/*.xml diff --git a/.github/workflows/test-examples.yml b/.github/workflows/test-examples.yml index 84dd070..08f0bfd 100644 --- a/.github/workflows/test-examples.yml +++ b/.github/workflows/test-examples.yml @@ -1,52 +1,136 @@ name: "Build example apps" on: - push: - branches: - - master - pull_request: - types: [opened, synchronize, reopened, labeled] + push: + branches: + - master + pull_request: + types: [opened, synchronize, reopened, labeled] jobs: - cpp-compatibility: - name: Cpp compatibility + build: + name: Build Examples strategy: matrix: - idf_version: ["release-v5.0", "release-v5.1", "latest"] - target: ["esp32"] - example: [{name: cpp_compatibility, path: "build_test"}] - uses: "./.github/workflows/build-app.yml" - with: - idf_version: ${{matrix.idf_version}} - target: ${{matrix.target}} - app_name: ${{matrix.example.name}} - app_path: $IDF_PATH/tools/test_apps/protocols/mqtt/${{matrix.example.path}} - upload_artifacts: false - build-only-example: - name: Build Only Apps - strategy: - matrix: - idf_version: ["release-v5.0", "release-v5.1", "latest"] - target: ["esp32s2", "esp32c3", "esp32s3"] - example: [{name: ssl_psk, path: "mqtt/ssl_psk"}, {name: ssl_ds, path: "mqtt/ssl_ds"}] - uses: "./.github/workflows/build-app.yml" - with: - idf_version: ${{matrix.idf_version}} - target: ${{matrix.target}} - app_name: ${{matrix.example.name}} - app_path: $IDF_PATH/examples/protocols/${{matrix.example.path}} + idf_version: + [ + "release-v5.1", + "release-v5.2", + "release-v5.3", + "release-v5.4", + "release-v5.5", + "latest", + ] + target: ["esp32", "esp32c6"] + example: + [ + { + name: tcp, + path: "mqtt/tcp", + base_path: "examples/protocols", + }, + { + name: ssl, + path: "mqtt/ssl", + base_path: "examples/protocols", + }, + { + name: ssl_mutual_auth, + path: "mqtt/ssl_mutual_auth", + base_path: "examples/protocols", + }, + { + name: ws, + path: "mqtt/ws", + base_path: "examples/protocols", + }, + { + name: wss, + path: "mqtt/wss", + base_path: "examples/protocols", + }, + { + name: ssl_psk, + path: "mqtt/ssl_psk", + base_path: "examples/protocols", + }, + { + name: ssl_ds, + path: "mqtt/ssl_ds", + base_path: "examples/protocols", + }, + { + name: cpp_compatibility, + path: "build_test", + base_path: "tools/test_apps/protocols/mqtt", + }, + ] + runs-on: ubuntu-22.04 + container: espressif/idf:${{ matrix.idf_version }} + steps: + - name: Use Build App Composite Action + uses: "./.github/actions/build-app" + with: + idf_version: ${{matrix.idf_version}} + target: ${{matrix.target}} + app_name: ${{matrix.example.name}} + app_path: $IDF_PATH/${{matrix.example.base_path}}/${{matrix.example.path}} - build-examples: - name: Build and Run on target + build_publish_connect: + name: Build Publish Connect Test strategy: matrix: - idf_version: ["release-v5.0", "release-v5.1", "latest"] + idf_version: ["latest"] target: ["esp32"] - example: [{name: tcp, path: "mqtt/tcp"}, {name: ssl, path: "mqtt/ssl"},{name: ssl_mutual_auth, path: "mqtt/ssl_mutual_auth"},{name: ws, path: "mqtt/ws"},{name: wss, path: "mqtt/wss"}] - uses: "./.github/workflows/build-and-target-test.yml" - with: - idf_version: ${{matrix.idf_version}} - target: ${{matrix.target}} - app_name: ${{matrix.example.name}} - app_path: $IDF_PATH/examples/protocols/${{matrix.example.path}} + app: + [ + { + name: publish_connect_test, + path: "publish_connect_test", + }, + ] + runs-on: ubuntu-22.04 + container: espressif/idf:${{ matrix.idf_version }} + steps: + - name: Use Build App Composite Action + uses: "./.github/actions/build-app" + with: + idf_version: ${{matrix.idf_version}} + target: ${{matrix.target}} + app_name: ${{matrix.app.name}} + app_path: $IDF_PATH/tools/test_apps/protocols/mqtt/${{matrix.app.path}} + - name: Upload files to artifacts for run-target job + if: ${{ inputs.upload_artifacts }} + uses: actions/upload-artifact@v4 + with: + name: mqtt_bin_${{ inputs.target }}_${{ inputs.idf_version }}_${{ inputs.app_name }} + path: | + build_${{ inputs.target }}_${{ inputs.app_name }}/bootloader/bootloader.bin + build_${{ inputs.target }}_${{ inputs.app_name }}/partition_table/partition-table.bin + build_${{ inputs.target }}_${{ inputs.app_name }}/*.bin + build_${{ inputs.target }}_${{ inputs.app_name }}/*.elf + build_${{ inputs.target }}_${{ inputs.app_name }}/flasher_args.json + if-no-files-found: error + publish_connect_test: + name: Publish and Connect test + needs: build_publish_connect + strategy: + matrix: + idf_version: ["latest"] + target: ["esp32"] + example: + [ + { + name: publish_connect_test, + path: "publish_connect_test", + }, + ] + steps: + - name: Use Run on Target Composite Action + uses: "./.github/workflows/run-on-target.yml" + with: + idf_version: ${{matrix.idf_version}} + target: ${{matrix.target}} + app_name: ${{matrix.example.name}} + app_path: $IDF_PATH/tools/test_apps/protocols/mqtt/${{matrix.example.path}}