diff --git a/.github/workflows/asio__build-target-test.yml b/.github/workflows/asio__build-target-test.yml new file mode 100644 index 000000000..74d12ad99 --- /dev/null +++ b/.github/workflows/asio__build-target-test.yml @@ -0,0 +1,98 @@ +name: "asio: build/target-tests" + +on: + push: + branches: + - master + pull_request: + types: [opened, synchronize, reopened, labeled] + +jobs: + build_asio: + if: contains(github.event.pull_request.labels.*.name, 'asio') + name: Build + strategy: + matrix: + idf_ver: ["latest", "release-v5.0"] + idf_target: ["esp32", "esp32s2"] + example: ["asio_chat", "async_request", "socks4", "ssl_client_server", "tcp_echo_server", "udp_echo_server"] + runs-on: ubuntu-20.04 + container: espressif/idf:${{ matrix.idf_ver }} + env: + TEST_DIR: components/asio/examples + steps: + - name: Checkout esp-protocols + uses: actions/checkout@v3 + with: + submodules: recursive + - name: Build ${{ matrix.example }} with IDF-${{ matrix.idf_ver }} for ${{ matrix.idf_target }} + working-directory: ${{ env.TEST_DIR }}/${{ matrix.example }} + env: + IDF_TARGET: ${{ matrix.idf_target }} + shell: bash + run: | + . ${IDF_PATH}/export.sh + test -f sdkconfig.ci && cat sdkconfig.ci >> sdkconfig.defaults || echo "No sdkconfig.ci" + idf.py set-target ${{ matrix.idf_target }} + idf.py build + - name: Merge binaries with IDF-${{ matrix.idf_ver }} for ${{ matrix.idf_target }} for ${{ matrix.example }} + working-directory: ${{ env.TEST_DIR }}/${{ matrix.example }}/build + env: + IDF_TARGET: ${{ matrix.idf_target }} + shell: bash + run: | + . ${IDF_PATH}/export.sh + esptool.py --chip ${{ matrix.idf_target }} merge_bin --fill-flash-size 4MB -o flash_image.bin @flash_args + - uses: actions/upload-artifact@v3 + with: + name: examples_app_bin_${{ matrix.idf_target }}_${{ matrix.idf_ver }}_${{ matrix.example }} + path: | + ${{ env.TEST_DIR }}/${{ matrix.example }}/build/bootloader/bootloader.bin + ${{ env.TEST_DIR }}/${{ matrix.example }}/build//partition_table/partition-table.bin + ${{ env.TEST_DIR }}/${{ matrix.example }}/build/*.bin + ${{ env.TEST_DIR }}/${{ matrix.example }}/build/*.elf + ${{ env.TEST_DIR }}/${{ matrix.example }}/build/flasher_args.json + ${{ env.TEST_DIR }}/${{ matrix.example }}/build/config/sdkconfig.h + ${{ env.TEST_DIR }}/${{ matrix.example }}/build/config/sdkconfig.json + if-no-files-found: error + + target_tests_asio: + # Skip running on forks since it won't have access to secrets + if: ${{ contains(github.event.pull_request.labels.*.name, 'asio') && (github.repository == 'espressif/esp-protocols') }} + name: Target tests + strategy: + matrix: + idf_ver: ["latest", "release-v5.0"] + idf_target: ["esp32"] + example: ["asio_chat", "tcp_echo_server", "udp_echo_server", "ssl_client_server"] + needs: build_asio + runs-on: + - self-hosted + - ESP32-ETHERNET-KIT + env: + TEST_DIR: components/asio/examples + steps: + - name: Clear repository + run: sudo rm -fr $GITHUB_WORKSPACE && mkdir $GITHUB_WORKSPACE + - uses: actions/checkout@v3 + - uses: actions/download-artifact@v3 + with: + name: examples_app_bin_${{ matrix.idf_target }}_${{ matrix.idf_ver }}_${{ matrix.example }} + path: ${{ env.TEST_DIR }}/${{ matrix.example }}/build + - name: Install Python packages + env: + PIP_EXTRA_INDEX_URL: "https://www.piwheels.org/simple" + run: | + sudo apt-get install -y dnsutils + - name: Download Example Test to target ${{ matrix.config }} + run: | + python -m esptool --chip ${{ matrix.idf_target }} write_flash 0x0 ${{ env.TEST_DIR }}/${{ matrix.example }}/build/flash_image.bin + - name: Run Example Test ${{ matrix.example }} on target + working-directory: ${{ env.TEST_DIR }}/${{ matrix.example }} + run: | + python -m pytest --log-cli-level DEBUG --junit-xml=./examples_results_${{ matrix.idf_target }}_${{ matrix.idf_ver }}_${{ matrix.config }}.xml --target=${{ matrix.idf_target }} + - uses: actions/upload-artifact@v3 + if: always() + with: + name: examples_results_${{ matrix.idf_target }}_${{ matrix.idf_ver }}_${{ matrix.example }} + path: ${{ env.TEST_DIR }}/${{ matrix.example }}/*.xml diff --git a/.github/workflows/gcov_analyzer.yml b/.github/workflows/gcov_analyzer.yml deleted file mode 100644 index 322f8f285..000000000 --- a/.github/workflows/gcov_analyzer.yml +++ /dev/null @@ -1,92 +0,0 @@ -name: Code Coverage Analyzer - -on: [push, pull_request] - -jobs: - gcovr_analyzer_esp_modem: - name: Run gcovr on esp modem host test - runs-on: ubuntu-22.04 - container: espressif/idf:release-v4.3 - env: - lwip: lwip-2.1.2 - lwip_contrib: contrib-2.1.0 - lwip_uri: http://download.savannah.nongnu.org/releases/lwip - COMP_DIR: esp-protocols/components/esp_modem - steps: - - name: Checkout esp-protocols - uses: actions/checkout@v3 - with: - path: esp-protocols - persist-credentials: false - - name: Build and Test - shell: bash - run: | - apt-get update - apt-get update && apt-get install -y gcc-8 g++-8 python3-pip - apt-get install -y rsync - update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 800 --slave /usr/bin/g++ g++ /usr/bin/g++-8 - export DEBIAN_FRONTEND=noninteractive - export LWIP_PATH=`pwd`/${{ env.lwip }} - export LWIP_CONTRIB_PATH=`pwd`/${{ env.lwip_contrib }} - . ${IDF_PATH}/export.sh - ${{ env.COMP_DIR }}/test/host_test/env.sh $lwip $lwip_uri $lwip_contrib - cd $GITHUB_WORKSPACE/${{ env.COMP_DIR }}/test/host_test - cat sdkconfig.ci.coverage >> sdkconfig.defaults - idf.py build - ./build/host_modem_test.elf - - name: Run gcovr - shell: bash - run: | - python -m pip install gcovr - cd $GITHUB_WORKSPACE/${{ env.COMP_DIR }} - gcov-8 `find . -name "esp_modem*gcda" -printf '%h\n' | head -n 1`/* - gcovr --gcov-ignore-parse-errors -g -k -r . --html index.html -x esp_modem_coverage.xml - mkdir docs_gcovr - cp $GITHUB_WORKSPACE/${{ env.COMP_DIR }}/index.html docs_gcovr - touch docs_gcovr/.nojekyll - - - name: Code Coverage Summary Report - uses: irongut/CodeCoverageSummary@v1.3.0 - with: - filename: esp-protocols/**/esp_modem_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@v3 - if: always() - with: - name: docs_gcovr - path: | - ${{ env.COMP_DIR }}/docs_gcovr - if-no-files-found: error - -# show_report_data: -# name: Publish-Results -# if: github.ref == 'refs/heads/master' || github.repository != 'espressif/esp-protocols' -# runs-on: ubuntu-22.04 -# needs: gcovr_analyzer_esp_modem -# steps: -# - name: Checkout 🛎️ -# uses: actions/checkout@v3 -# with: -# persist-credentials: false -# - name: Download Artifacts -# uses: actions/download-artifact@v1 -# with: -# name: docs_gcovr -# -# - name: Deploy generated docs -# uses: JamesIves/github-pages-deploy-action@v4 -# with: -# branch: gh-pages -# folder: 'docs_gcovr' diff --git a/.github/workflows/mdns__build-host-tests.yml b/.github/workflows/mdns__build-host-tests.yml deleted file mode 100644 index 6dc7ef7d3..000000000 --- a/.github/workflows/mdns__build-host-tests.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: "mdns: Build and Host tests" - -on: - push: - paths: - - 'components/mdns/**' - pull_request: - types: [opened, synchronize, reopened, labeled] - -jobs: - host_test_mdns: - if: contains(github.event.pull_request.labels.*.name, 'mdns') - name: Host test - runs-on: ubuntu-20.04 - container: espressif/idf:latest - - steps: - - name: Checkout esp-protocols - uses: actions/checkout@master - with: - path: esp-protocols - - - name: Build and Test - shell: bash - run: | - apt-get update && apt-get install -y dnsutils gcc g++ - . ${IDF_PATH}/export.sh - cd $GITHUB_WORKSPACE/esp-protocols/components/mdns/tests/host_test - idf.py build - ./build/mdns_host.elf & - dig +short -p 5353 @224.0.0.251 myesp.local > ip.txt - cat ip.txt | xargs dig +short -p 5353 @224.0.0.251 -x - cat ip.txt diff --git a/.github/workflows/test_apps.yml b/.github/workflows/mdns__build-target-test.yml similarity index 50% rename from .github/workflows/test_apps.yml rename to .github/workflows/mdns__build-target-test.yml index 2b5fc4b1e..d5f76171d 100644 --- a/.github/workflows/test_apps.yml +++ b/.github/workflows/mdns__build-target-test.yml @@ -1,15 +1,49 @@ -name: Build and Run Test apps +name: "mdns: build/target-tests" on: - push: - paths: - - 'components/mdns/**' - pull_request: - paths: - - 'components/mdns/**' + push: + branches: + - master + pull_request: + types: [opened, synchronize, reopened, labeled] jobs: + build_mdns: + if: contains(github.event.pull_request.labels.*.name, 'mdns') + name: Build + strategy: + matrix: + idf_ver: ["latest"] + idf_target: ["esp32", "esp32s2", "esp32c3"] + test: [ { app: example, path: "components/mdns/examples" }, { app: unit_test, path: "components/mdns/tests/unit_test" } ] + runs-on: ubuntu-20.04 + container: espressif/idf:${{ matrix.idf_ver }} + steps: + - name: Checkout esp-protocols + uses: actions/checkout@v3 + with: + submodules: recursive + - name: Build ${{ matrix.test.app }} with IDF-${{ matrix.idf_ver }} for ${{ matrix.idf_target }} + shell: bash + working-directory: ${{ matrix.test.path }} + run: | + ${IDF_PATH}/install.sh --enable-pytest + . ${IDF_PATH}/export.sh + python $IDF_PATH/tools/ci/ci_build_apps.py . --target ${{ matrix.idf_target }} -vv --preserve-all --pytest-app + for dir in `ls -d build_*`; do + $GITHUB_WORKSPACE/ci/clean_build_artifacts.sh `pwd`/$dir + zip -qur artifacts.zip $dir + done + - uses: actions/upload-artifact@v3 + if: ${{ matrix.idf_target }} == "esp32" + with: + name: mdns_bin_${{ matrix.idf_target }}_${{ matrix.idf_ver }}_${{ matrix.test.app }} + path: ${{ matrix.test.path }}/artifacts.zip + if-no-files-found: error + build_mdns_app: + if: contains(github.event.pull_request.labels.*.name, 'mdns') + name: Build Test Apps strategy: matrix: idf_ver: ["latest"] @@ -55,18 +89,18 @@ jobs: components/mdns/tests/test_apps/build_${{ matrix.idf_target }}_default/config/sdkconfig.json if-no-files-found: error - run-target-mdns-app: + target_test_apps_mdns: + # Skip running on forks since it won't have access to secrets + if: ${{ contains(github.event.pull_request.labels.*.name, 'mdns') && (github.repository == 'espressif/esp-protocols') }} + name: Target Test Apps strategy: matrix: idf_ver: ["latest"] idf_target: ["esp32"] - name: Run mDNS Test apps on target needs: build_mdns_app runs-on: - self-hosted - ESP32-ETHERNET-KIT - # Skip running on forks since it won't have access to secrets - if: github.repository == 'espressif/esp-protocols' steps: - name: Clear repository run: sudo rm -fr $GITHUB_WORKSPACE && mkdir $GITHUB_WORKSPACE @@ -92,3 +126,44 @@ jobs: with: name: test_apps_results_${{ matrix.idf_target }}_${{ matrix.idf_ver }} path: components/mdns/tests/test_apps/*.xml + + target_tests_mdns: + # Skip running on forks since it won't have access to secrets + if: ${{ contains(github.event.pull_request.labels.*.name, 'mdns') && (github.repository == 'espressif/esp-protocols') }} + name: Target Example and Unit tests + strategy: + matrix: + idf_ver: ["latest"] + idf_target: ["esp32"] + test: [ { app: example, path: "components/mdns/examples" }, { app: unit_test, path: "components/mdns/tests/unit_test" } ] + needs: build_mdns + runs-on: + - self-hosted + - ESP32-ETHERNET-KIT + steps: + - name: Clear repository + run: sudo rm -fr $GITHUB_WORKSPACE && mkdir $GITHUB_WORKSPACE + - uses: actions/checkout@v3 + - uses: actions/download-artifact@v3 + with: + name: mdns_bin_${{ matrix.idf_target }}_${{ matrix.idf_ver }}_${{ matrix.test.app }} + path: ${{ matrix.test.path }}/ci/ + - name: Install Python packages + env: + PIP_EXTRA_INDEX_URL: "https://www.piwheels.org/simple" + run: | + sudo apt-get install -y dnsutils + - name: Run ${{ matrix.test.app }} application on ${{ matrix.idf_target }} + working-directory: ${{ matrix.test.path }} + run: | + 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 --junit-xml=./results_${{ matrix.test.app }}_${{ matrix.idf_target }}_${{ matrix.idf_ver }}_${dir#"ci/build_"}.xml --target=${{ matrix.idf_target }} + done + - uses: actions/upload-artifact@v3 + if: always() + with: + name: results_${{ matrix.test.app }}_${{ matrix.idf_target }}_${{ matrix.idf_ver }}.xml + path: ${{ matrix.test.path }}/*.xml diff --git a/.github/workflows/mdns__host-tests.yml b/.github/workflows/mdns__host-tests.yml new file mode 100644 index 000000000..ffb5b37e6 --- /dev/null +++ b/.github/workflows/mdns__host-tests.yml @@ -0,0 +1,61 @@ +name: "mdns: host-tests" + +on: + push: + branches: + - master + pull_request: + types: [opened, synchronize, reopened, labeled] + +jobs: + host_test_mdns: + if: contains(github.event.pull_request.labels.*.name, 'mdns') + name: Host test + runs-on: ubuntu-20.04 + container: espressif/idf:latest + + steps: + - name: Checkout esp-protocols + uses: actions/checkout@master + with: + path: esp-protocols + + - name: Build and Test + shell: bash + run: | + apt-get update && apt-get install -y dnsutils gcc g++ + . ${IDF_PATH}/export.sh + cd $GITHUB_WORKSPACE/esp-protocols/components/mdns/tests/host_test + idf.py build + ./build/mdns_host.elf & + dig +short -p 5353 @224.0.0.251 myesp.local > ip.txt + cat ip.txt | xargs dig +short -p 5353 @224.0.0.251 -x + cat ip.txt + + build_afl_host_test_mdns: + if: contains(github.event.pull_request.labels.*.name, 'mdns') + name: Build AFL host test + strategy: + matrix: + idf_ver: ["latest"] + idf_target: ["esp32"] + + runs-on: ubuntu-20.04 + container: espressif/idf:${{ matrix.idf_ver }} + steps: + - name: Checkout esp-protocols + uses: actions/checkout@master + with: + path: esp-protocols + - name: Install Necessary Libs + run: | + apt-get update -y + apt-get install -y libbsd-dev + - name: Build ${{ matrix.example }} with IDF-${{ matrix.idf_ver }} for ${{ matrix.idf_target }} + env: + IDF_TARGET: ${{ matrix.idf_target }} + shell: bash + run: | + . ${IDF_PATH}/export.sh + cd $GITHUB_WORKSPACE/esp-protocols/components/mdns/tests/test_afl_fuzz_host/ + make INSTR=off diff --git a/.github/workflows/modem__build-host-tests.yml b/.github/workflows/modem__build-host-tests.yml index 5dd5785b2..64759ee2c 100644 --- a/.github/workflows/modem__build-host-tests.yml +++ b/.github/workflows/modem__build-host-tests.yml @@ -1,15 +1,16 @@ -name: "esp-modem: Build and Host tests" +name: "esp-modem: build/host-tests" on: push: - paths: - - 'components/esp_modem/**' + branches: + - master pull_request: types: [opened, synchronize, reopened, labeled] jobs: build_esp_modem: if: contains(github.event.pull_request.labels.*.name, 'modem') + name: Build strategy: matrix: idf_ver: ["latest", "release-v4.2", "release-v4.3", "release-v4.4", "release-v5.0"] @@ -46,7 +47,8 @@ jobs: python ./ci/build_apps.py components/esp_modem/examples/${{ matrix.example }} host_test_esp_modem: - name: esp-modem Build and Test on Host + if: contains(github.event.pull_request.labels.*.name, 'modem') + name: Host Tests runs-on: ubuntu-20.04 container: espressif/idf:release-v4.3 env: @@ -80,3 +82,92 @@ jobs: if: always() with: files: esp-protocols/components/esp_modem/test/host_test/junit.xml + + host_test_gcov_esp_modem: + if: contains(github.event.pull_request.labels.*.name, 'modem') + name: Run gcovr on esp modem host test + runs-on: ubuntu-22.04 + container: espressif/idf:release-v4.3 + env: + lwip: lwip-2.1.2 + lwip_contrib: contrib-2.1.0 + lwip_uri: http://download.savannah.nongnu.org/releases/lwip + COMP_DIR: esp-protocols/components/esp_modem + steps: + - name: Checkout esp-protocols + uses: actions/checkout@v3 + with: + path: esp-protocols + persist-credentials: false + - name: Build and Test + shell: bash + run: | + apt-get update + apt-get update && apt-get install -y gcc-8 g++-8 python3-pip + apt-get install -y rsync + update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 800 --slave /usr/bin/g++ g++ /usr/bin/g++-8 + export DEBIAN_FRONTEND=noninteractive + export LWIP_PATH=`pwd`/${{ env.lwip }} + export LWIP_CONTRIB_PATH=`pwd`/${{ env.lwip_contrib }} + . ${IDF_PATH}/export.sh + ${{ env.COMP_DIR }}/test/host_test/env.sh $lwip $lwip_uri $lwip_contrib + cd $GITHUB_WORKSPACE/${{ env.COMP_DIR }}/test/host_test + cat sdkconfig.ci.coverage >> sdkconfig.defaults + idf.py build + ./build/host_modem_test.elf + - name: Run gcovr + shell: bash + run: | + python -m pip install gcovr + cd $GITHUB_WORKSPACE/${{ env.COMP_DIR }} + gcov-8 `find . -name "esp_modem*gcda" -printf '%h\n' | head -n 1`/* + gcovr --gcov-ignore-parse-errors -g -k -r . --html index.html -x esp_modem_coverage.xml + mkdir docs_gcovr + cp $GITHUB_WORKSPACE/${{ env.COMP_DIR }}/index.html docs_gcovr + touch docs_gcovr/.nojekyll + + - name: Code Coverage Summary Report + uses: irongut/CodeCoverageSummary@v1.3.0 + with: + filename: esp-protocols/**/esp_modem_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@v3 + if: always() + with: + name: docs_gcovr + path: | + ${{ env.COMP_DIR }}/docs_gcovr + if-no-files-found: error + +# show_report_data: +# name: Publish-Results +# if: github.ref == 'refs/heads/master' || github.repository != 'espressif/esp-protocols' +# runs-on: ubuntu-22.04 +# needs: gcovr_analyzer_esp_modem +# steps: +# - name: Checkout 🛎️ +# uses: actions/checkout@v3 +# with: +# persist-credentials: false +# - name: Download Artifacts +# uses: actions/download-artifact@v1 +# with: +# name: docs_gcovr +# +# - name: Deploy generated docs +# uses: JamesIves/github-pages-deploy-action@v4 +# with: +# branch: gh-pages +# folder: 'docs_gcovr' diff --git a/.github/workflows/modem__target-test.yml b/.github/workflows/modem__target-test.yml new file mode 100644 index 000000000..cfb55e4c2 --- /dev/null +++ b/.github/workflows/modem__target-test.yml @@ -0,0 +1,73 @@ +name: "esp-modem: target-tests" + +on: + push: + branches: + - master + pull_request: + types: [opened, synchronize, reopened, labeled] + +jobs: + build_esp_modem_tests: + if: contains(github.event.pull_request.labels.*.name, 'modem') + name: Build Target tests + strategy: + matrix: + idf_ver: ["latest"] + idf_target: ["esp32c3"] + test: [ { app: pppd, path: test/target }, { app: sim800_c3, path: examples/pppos_client } ] + runs-on: ubuntu-20.04 + container: espressif/idf:${{ matrix.idf_ver }} + env: + TEST_DIR: components/esp_modem/${{ matrix.test.path }} + steps: + - name: Checkout esp-protocols + uses: actions/checkout@v3 + with: + submodules: recursive + - name: Build esp-modem target tests with IDF-${{ matrix.idf_ver }} for ${{ matrix.idf_target }} + env: + IDF_TARGET: ${{ matrix.idf_target }} + SDKCONFIG: sdkconfig.ci.${{ matrix.test.app }} + shell: bash + working-directory: ${{ env.TEST_DIR }} + run: | + . ${IDF_PATH}/export.sh + rm -rf sdkconfig build + [ -f ${SDKCONFIG} ] && cp ${SDKCONFIG} sdkconfig.defaults + idf.py set-target ${{ matrix.idf_target }} + idf.py build + $GITHUB_WORKSPACE/ci/clean_build_artifacts.sh ${GITHUB_WORKSPACE}/${TEST_DIR}/build + - uses: actions/upload-artifact@v3 + with: + name: modem_target_bin_${{ matrix.idf_target }}_${{ matrix.idf_ver }}_${{ matrix.test.app }} + path: ${{ env.TEST_DIR }}/build + if-no-files-found: error + + target_tests_esp_modem: + # Skip running on forks since it won't have access to secrets + if: ${{ contains(github.event.pull_request.labels.*.name, 'modem') && (github.repository == 'espressif/esp-protocols') }} + name: Run Target tests + strategy: + matrix: + idf_ver: ["latest"] + idf_target: ["esp32c3"] + test: [ { app: pppd, path: test/target }, { app: sim800_c3, path: examples/pppos_client } ] + needs: build_esp_modem_tests + runs-on: + - self-hosted + - BrnoRPI-GH006 + env: + TEST_DIR: components/esp_modem/${{ matrix.test.path }} + steps: + - name: Clear repository + run: sudo rm -fr $GITHUB_WORKSPACE && mkdir $GITHUB_WORKSPACE + - uses: actions/checkout@v3 + - uses: actions/download-artifact@v3 + with: + name: modem_target_bin_${{ matrix.idf_target }}_${{ matrix.idf_ver }}_${{ matrix.test.app }} + path: ${{ env.TEST_DIR }}/build + - name: Run Example Test on target + working-directory: ${{ env.TEST_DIR }} + run: | + python -m pytest --log-cli-level DEBUG --target=${{ matrix.idf_target }} diff --git a/.github/workflows/mqtt_cxx__build.yml b/.github/workflows/mqtt_cxx__build.yml new file mode 100644 index 000000000..0f265f500 --- /dev/null +++ b/.github/workflows/mqtt_cxx__build.yml @@ -0,0 +1,32 @@ +name: "mqtt-cxx: build-tests" + +on: + push: + branches: + - master + pull_request: + types: [opened, synchronize, reopened, labeled] + +jobs: + build_esp_mqtt_cxx: + if: contains(github.event.pull_request.labels.*.name, 'mqtt') + name: Build + strategy: + matrix: + idf_ver: ["latest", "release-v5.0"] + idf_target: ["esp32"] + test: [ { app: example, path: "components/esp_mqtt_cxx/examples" }] + runs-on: ubuntu-20.04 + container: espressif/idf:${{ matrix.idf_ver }} + steps: + - name: Checkout esp-protocols + uses: actions/checkout@v3 + with: + submodules: recursive + - name: Build ${{ matrix.test.app }} with IDF-${{ matrix.idf_ver }} for ${{ matrix.idf_target }} + shell: bash + working-directory: ${{matrix.test.path}} + run: | + ${IDF_PATH}/install.sh --enable-pytest + . ${IDF_PATH}/export.sh + python $IDF_PATH/tools/ci/ci_build_apps.py . --target ${{ matrix.idf_target }} -vv --preserve-all --pytest-app diff --git a/.github/workflows/pre_commit_check.yml b/.github/workflows/pre_commit_check.yml index c609c54d6..37e417c20 100644 --- a/.github/workflows/pre_commit_check.yml +++ b/.github/workflows/pre_commit_check.yml @@ -1,6 +1,9 @@ name: Check pre-commit rules on: + push: + branches: + - master pull_request: types: [opened, reopened, synchronize] diff --git a/.github/workflows/target-test.yml b/.github/workflows/target-test.yml deleted file mode 100644 index 17f721688..000000000 --- a/.github/workflows/target-test.yml +++ /dev/null @@ -1,329 +0,0 @@ -name: Build and Run Target tests - -on: [push, pull_request] - -jobs: - build_mdns: - strategy: - matrix: - idf_ver: ["latest"] - idf_target: ["esp32", "esp32s2", "esp32c3"] - test: [ { app: example, path: "components/mdns/examples" }, { app: unit_test, path: "components/mdns/tests/unit_test" } ] - runs-on: ubuntu-20.04 - container: espressif/idf:${{ matrix.idf_ver }} - steps: - - name: Checkout esp-protocols - uses: actions/checkout@v3 - with: - submodules: recursive - - name: Build ${{ matrix.test.app }} with IDF-${{ matrix.idf_ver }} for ${{ matrix.idf_target }} - shell: bash - working-directory: ${{ matrix.test.path }} - run: | - ${IDF_PATH}/install.sh --enable-pytest - . ${IDF_PATH}/export.sh - python $IDF_PATH/tools/ci/ci_build_apps.py . --target ${{ matrix.idf_target }} -vv --preserve-all --pytest-app - for dir in `ls -d build_*`; do - $GITHUB_WORKSPACE/ci/clean_build_artifacts.sh `pwd`/$dir - zip -qur artifacts.zip $dir - done - - uses: actions/upload-artifact@v3 - if: ${{ matrix.idf_target }} == "esp32" - with: - name: mdns_bin_${{ matrix.idf_target }}_${{ matrix.idf_ver }}_${{ matrix.test.app }} - path: ${{ matrix.test.path }}/artifacts.zip - if-no-files-found: error - - build_asio: - strategy: - matrix: - idf_ver: ["latest"] - idf_target: ["esp32", "esp32s2"] - example: ["asio_chat", "async_request", "socks4", "ssl_client_server", "tcp_echo_server", "udp_echo_server"] - runs-on: ubuntu-20.04 - container: espressif/idf:${{ matrix.idf_ver }} - env: - TEST_DIR: components/asio/examples - steps: - - name: Checkout esp-protocols - uses: actions/checkout@v3 - with: - submodules: recursive - - name: Build ${{ matrix.example }} with IDF-${{ matrix.idf_ver }} for ${{ matrix.idf_target }} - working-directory: ${{ env.TEST_DIR }}/${{ matrix.example }} - env: - IDF_TARGET: ${{ matrix.idf_target }} - shell: bash - run: | - . ${IDF_PATH}/export.sh - test -f sdkconfig.ci && cat sdkconfig.ci >> sdkconfig.defaults || echo "No sdkconfig.ci" - idf.py set-target ${{ matrix.idf_target }} - idf.py build - - name: Merge binaries with IDF-${{ matrix.idf_ver }} for ${{ matrix.idf_target }} for ${{ matrix.example }} - working-directory: ${{ env.TEST_DIR }}/${{ matrix.example }}/build - env: - IDF_TARGET: ${{ matrix.idf_target }} - shell: bash - run: | - . ${IDF_PATH}/export.sh - esptool.py --chip ${{ matrix.idf_target }} merge_bin --fill-flash-size 4MB -o flash_image.bin @flash_args - - uses: actions/upload-artifact@v3 - with: - name: examples_app_bin_${{ matrix.idf_target }}_${{ matrix.idf_ver }}_${{ matrix.example }} - path: | - ${{ env.TEST_DIR }}/${{ matrix.example }}/build/bootloader/bootloader.bin - ${{ env.TEST_DIR }}/${{ matrix.example }}/build//partition_table/partition-table.bin - ${{ env.TEST_DIR }}/${{ matrix.example }}/build/*.bin - ${{ env.TEST_DIR }}/${{ matrix.example }}/build/*.elf - ${{ env.TEST_DIR }}/${{ matrix.example }}/build/flasher_args.json - ${{ env.TEST_DIR }}/${{ matrix.example }}/build/config/sdkconfig.h - ${{ env.TEST_DIR }}/${{ matrix.example }}/build/config/sdkconfig.json - if-no-files-found: error - - - build_websocket: - strategy: - matrix: - idf_ver: ["release-v5.0", "latest"] - idf_target: ["esp32"] - runs-on: ubuntu-20.04 - container: espressif/idf:${{ matrix.idf_ver }} - env: - TEST_DIR: components/esp_websocket_client/examples - steps: - - name: Checkout esp-protocols - uses: actions/checkout@v3 - with: - submodules: recursive - - name: Build ${{ matrix.example }} with IDF-${{ matrix.idf_ver }} for ${{ matrix.idf_target }} - env: - IDF_TARGET: ${{ matrix.idf_target }} - shell: bash - working-directory: ${{ env.TEST_DIR }} - run: | - . ${IDF_PATH}/export.sh - cat sdkconfig.ci >> sdkconfig.defaults - idf.py build - - name: Merge binaries - working-directory: ${{ env.TEST_DIR }}/build - env: - IDF_TARGET: ${{ matrix.idf_target }} - shell: bash - run: | - . ${IDF_PATH}/export.sh - esptool.py --chip ${{ matrix.idf_target }} merge_bin --fill-flash-size 4MB -o flash_image.bin @flash_args - - uses: actions/upload-artifact@v3 - with: - name: examples_app_bin_${{ matrix.idf_target }}_${{ matrix.idf_ver }} - path: | - ${{ env.TEST_DIR }}/build/bootloader/bootloader.bin - ${{ env.TEST_DIR }}/build/partition_table/partition-table.bin - ${{ env.TEST_DIR }}/build/*.bin - ${{ env.TEST_DIR }}/build/*.elf - ${{ env.TEST_DIR }}/build/flasher_args.json - ${{ env.TEST_DIR }}/build/config/sdkconfig.h - ${{ env.TEST_DIR }}/build/config/sdkconfig.json - if-no-files-found: error - - build_esp_mqtt_cxx: - strategy: - matrix: - idf_ver: ["latest", "release-v5.0"] - idf_target: ["esp32"] - test: [ { app: example, path: "components/esp_mqtt_cxx/examples" }] - runs-on: ubuntu-20.04 - container: espressif/idf:${{ matrix.idf_ver }} - steps: - - name: Checkout esp-protocols - uses: actions/checkout@v3 - with: - submodules: recursive - - name: Build ${{ matrix.test.app }} with IDF-${{ matrix.idf_ver }} for ${{ matrix.idf_target }} - shell: bash - working-directory: ${{matrix.test.path}} - run: | - ${IDF_PATH}/install.sh --enable-pytest - . ${IDF_PATH}/export.sh - python $IDF_PATH/tools/ci/ci_build_apps.py . --target ${{ matrix.idf_target }} -vv --preserve-all --pytest-app - - run-target-websocket: - name: Run Websocket Example Test on target - needs: build_websocket - strategy: - fail-fast: false - matrix: - idf_ver: ["release-v5.0", "latest"] - idf_target: ["esp32"] - runs-on: - - self-hosted - - ESP32-ETHERNET-KIT - env: - TEST_DIR: components/esp_websocket_client/examples - # Skip running on forks since it won't have access to secrets - if: github.repository == 'espressif/esp-protocols' - steps: - - uses: actions/checkout@v3 - - uses: actions/download-artifact@v3 - with: - name: examples_app_bin_${{ matrix.idf_target }}_${{ matrix.idf_ver }} - path: ${{ env.TEST_DIR }}/build/ - - name: Install Python packages - env: - PIP_EXTRA_INDEX_URL: "https://www.piwheels.org/simple" - run: | - pip install --only-binary cryptography --extra-index-url https://dl.espressif.com/pypi/ -r $GITHUB_WORKSPACE/ci/requirements.txt - - name: Download Example Test to target - run: python -m esptool --chip ${{ matrix.idf_target }} write_flash 0x0 components/esp_websocket_client/examples/build/flash_image.bin - - name: Run Example Test on target - working-directory: ${{ env.TEST_DIR }} - run: | - python -m pytest --log-cli-level DEBUG --junit-xml=./examples_results_${{ matrix.idf_target }}_${{ matrix.idf_ver }}.xml --target=${{ matrix.idf_target }} - - uses: actions/upload-artifact@v3 - if: always() - with: - name: examples_results_${{ matrix.idf_target }}_${{ matrix.idf_ver }} - path: ${{ env.TEST_DIR }}/*.xml - - run-target-mdns: - strategy: - matrix: - idf_ver: ["latest"] - idf_target: ["esp32"] - test: [ { app: example, path: "components/mdns/examples" }, { app: unit_test, path: "components/mdns/tests/unit_test" } ] - name: Run mDNS target tests - needs: build_mdns - runs-on: - - self-hosted - - ESP32-ETHERNET-KIT - # Skip running on forks since it won't have access to secrets - if: github.repository == 'espressif/esp-protocols' - steps: - - name: Clear repository - run: sudo rm -fr $GITHUB_WORKSPACE && mkdir $GITHUB_WORKSPACE - - uses: actions/checkout@v3 - - uses: actions/download-artifact@v3 - with: - name: mdns_bin_${{ matrix.idf_target }}_${{ matrix.idf_ver }}_${{ matrix.test.app }} - path: ${{ matrix.test.path }}/ci/ - - name: Install Python packages - env: - PIP_EXTRA_INDEX_URL: "https://www.piwheels.org/simple" - run: | - sudo apt-get install -y dnsutils - - name: Run ${{ matrix.test.app }} application on ${{ matrix.idf_target }} - working-directory: ${{ matrix.test.path }} - run: | - 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 --junit-xml=./results_${{ matrix.test.app }}_${{ matrix.idf_target }}_${{ matrix.idf_ver }}_${dir#"ci/build_"}.xml --target=${{ matrix.idf_target }} - done - - uses: actions/upload-artifact@v3 - if: always() - with: - name: results_${{ matrix.test.app }}_${{ matrix.idf_target }}_${{ matrix.idf_ver }}.xml - path: ${{ matrix.test.path }}/*.xml - - run-target-asio: - strategy: - matrix: - idf_ver: ["latest"] - idf_target: ["esp32"] - example: ["asio_chat", "tcp_echo_server", "udp_echo_server", "ssl_client_server"] - name: Run ASIO Example Test on target - needs: build_asio - runs-on: - - self-hosted - - ESP32-ETHERNET-KIT - env: - TEST_DIR: components/asio/examples - # Skip running on forks since it won't have access to secrets - if: github.repository == 'espressif/esp-protocols' - steps: - - name: Clear repository - run: sudo rm -fr $GITHUB_WORKSPACE && mkdir $GITHUB_WORKSPACE - - uses: actions/checkout@v3 - - uses: actions/download-artifact@v3 - with: - name: examples_app_bin_${{ matrix.idf_target }}_${{ matrix.idf_ver }}_${{ matrix.example }} - path: ${{ env.TEST_DIR }}/${{ matrix.example }}/build - - name: Install Python packages - env: - PIP_EXTRA_INDEX_URL: "https://www.piwheels.org/simple" - run: | - sudo apt-get install -y dnsutils - - name: Download Example Test to target ${{ matrix.config }} - run: | - python -m esptool --chip ${{ matrix.idf_target }} write_flash 0x0 ${{ env.TEST_DIR }}/${{ matrix.example }}/build/flash_image.bin - - name: Run Example Test ${{ matrix.example }} on target - working-directory: ${{ env.TEST_DIR }}/${{ matrix.example }} - run: | - python -m pytest --log-cli-level DEBUG --junit-xml=./examples_results_${{ matrix.idf_target }}_${{ matrix.idf_ver }}_${{ matrix.config }}.xml --target=${{ matrix.idf_target }} - - uses: actions/upload-artifact@v3 - if: always() - with: - name: examples_results_${{ matrix.idf_target }}_${{ matrix.idf_ver }}_${{ matrix.example }} - path: ${{ env.TEST_DIR }}/${{ matrix.example }}/*.xml - - build_esp_modem_tests: - strategy: - matrix: - idf_ver: ["latest"] - idf_target: ["esp32c3"] - test: [ { app: pppd, path: test/target }, { app: sim800, path: examples/pppos_client } ] - runs-on: ubuntu-20.04 - container: espressif/idf:${{ matrix.idf_ver }} - env: - TEST_DIR: components/esp_modem/${{ matrix.test.path }} - steps: - - name: Checkout esp-protocols - uses: actions/checkout@v3 - with: - submodules: recursive - - name: Build esp-modem target tests with IDF-${{ matrix.idf_ver }} for ${{ matrix.idf_target }} - env: - IDF_TARGET: ${{ matrix.idf_target }} - SDKCONFIG: sdkconfig.ci.${{ matrix.test.app }} - shell: bash - working-directory: ${{ env.TEST_DIR }} - run: | - . ${IDF_PATH}/export.sh - rm -rf sdkconfig build - [ -f ${SDKCONFIG} ] && cp ${SDKCONFIG} sdkconfig.defaults - idf.py set-target ${{ matrix.idf_target }} - idf.py build - $GITHUB_WORKSPACE/ci/clean_build_artifacts.sh ${GITHUB_WORKSPACE}/${TEST_DIR}/build - - uses: actions/upload-artifact@v3 - with: - name: modem_target_bin_${{ matrix.idf_target }}_${{ matrix.idf_ver }}_${{ matrix.test.app }} - path: ${{ env.TEST_DIR }}/build - if-no-files-found: error - - run_esp_modem_tests: - strategy: - matrix: - idf_ver: ["latest"] - idf_target: ["esp32c3"] - test: [ { app: pppd, path: test/target }, { app: sim800, path: examples/pppos_client } ] - name: Run esp_modem Test on target - needs: build_esp_modem_tests - runs-on: - - self-hosted - - BrnoRPI-GH006 - env: - TEST_DIR: components/esp_modem/${{ matrix.test.path }} - # Skip running on forks since it won't have access to secrets - if: github.repository == 'espressif/esp-protocols' - steps: - - name: Clear repository - run: sudo rm -fr $GITHUB_WORKSPACE && mkdir $GITHUB_WORKSPACE - - uses: actions/checkout@v3 - - uses: actions/download-artifact@v3 - with: - name: modem_target_bin_${{ matrix.idf_target }}_${{ matrix.idf_ver }}_${{ matrix.test.app }} - path: ${{ env.TEST_DIR }}/build - - name: Run Example Test on target - working-directory: ${{ env.TEST_DIR }} - run: | - python -m pytest --log-cli-level DEBUG --target=${{ matrix.idf_target }} diff --git a/.github/workflows/test_afl_fuzzer.yml b/.github/workflows/test_afl_fuzzer.yml deleted file mode 100644 index a82e0096a..000000000 --- a/.github/workflows/test_afl_fuzzer.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: AFL fuzzer compilation test - -on: [push, pull_request] - -jobs: - build: - strategy: - matrix: - idf_ver: ["latest"] - idf_target: ["esp32"] - - runs-on: ubuntu-20.04 - container: espressif/idf:${{ matrix.idf_ver }} - steps: - - name: Checkout esp-protocols - uses: actions/checkout@master - with: - path: esp-protocols - - name: Install Necessary Libs - run: | - apt-get update -y - apt-get install -y libbsd-dev - - name: Build ${{ matrix.example }} with IDF-${{ matrix.idf_ver }} for ${{ matrix.idf_target }} - env: - IDF_TARGET: ${{ matrix.idf_target }} - shell: bash - run: | - . ${IDF_PATH}/export.sh - cd $GITHUB_WORKSPACE/esp-protocols/components/mdns/tests/test_afl_fuzz_host/ - make INSTR=off diff --git a/.github/workflows/websocket__build-target-test.yml b/.github/workflows/websocket__build-target-test.yml new file mode 100644 index 000000000..314fdbc90 --- /dev/null +++ b/.github/workflows/websocket__build-target-test.yml @@ -0,0 +1,93 @@ +name: "websocket: build/target-tests" + +on: + push: + branches: + - master + pull_request: + types: [opened, synchronize, reopened, labeled] + +jobs: + build_websocket: + if: contains(github.event.pull_request.labels.*.name, 'websocket') + name: Build + strategy: + matrix: + idf_ver: ["release-v5.0", "latest"] + idf_target: ["esp32"] + runs-on: ubuntu-20.04 + container: espressif/idf:${{ matrix.idf_ver }} + env: + TEST_DIR: components/esp_websocket_client/examples + steps: + - name: Checkout esp-protocols + uses: actions/checkout@v3 + with: + submodules: recursive + - name: Build ${{ matrix.example }} with IDF-${{ matrix.idf_ver }} for ${{ matrix.idf_target }} + env: + IDF_TARGET: ${{ matrix.idf_target }} + shell: bash + working-directory: ${{ env.TEST_DIR }} + run: | + . ${IDF_PATH}/export.sh + cat sdkconfig.ci >> sdkconfig.defaults + idf.py build + - name: Merge binaries + working-directory: ${{ env.TEST_DIR }}/build + env: + IDF_TARGET: ${{ matrix.idf_target }} + shell: bash + run: | + . ${IDF_PATH}/export.sh + esptool.py --chip ${{ matrix.idf_target }} merge_bin --fill-flash-size 4MB -o flash_image.bin @flash_args + - uses: actions/upload-artifact@v3 + with: + name: examples_app_bin_${{ matrix.idf_target }}_${{ matrix.idf_ver }} + path: | + ${{ env.TEST_DIR }}/build/bootloader/bootloader.bin + ${{ env.TEST_DIR }}/build/partition_table/partition-table.bin + ${{ env.TEST_DIR }}/build/*.bin + ${{ env.TEST_DIR }}/build/*.elf + ${{ env.TEST_DIR }}/build/flasher_args.json + ${{ env.TEST_DIR }}/build/config/sdkconfig.h + ${{ env.TEST_DIR }}/build/config/sdkconfig.json + if-no-files-found: error + + run-target-websocket: + # Skip running on forks since it won't have access to secrets + if: ${{ contains(github.event.pull_request.labels.*.name, 'websocket') && (github.repository == 'espressif/esp-protocols') }} + name: Target test + needs: build_websocket + strategy: + fail-fast: false + matrix: + idf_ver: ["release-v5.0", "latest"] + idf_target: ["esp32"] + runs-on: + - self-hosted + - ESP32-ETHERNET-KIT + env: + TEST_DIR: components/esp_websocket_client/examples + steps: + - uses: actions/checkout@v3 + - uses: actions/download-artifact@v3 + with: + name: examples_app_bin_${{ matrix.idf_target }}_${{ matrix.idf_ver }} + path: ${{ env.TEST_DIR }}/build/ + - name: Install Python packages + env: + PIP_EXTRA_INDEX_URL: "https://www.piwheels.org/simple" + run: | + pip install --only-binary cryptography --extra-index-url https://dl.espressif.com/pypi/ -r $GITHUB_WORKSPACE/ci/requirements.txt + - name: Download Example Test to target + run: python -m esptool --chip ${{ matrix.idf_target }} write_flash 0x0 components/esp_websocket_client/examples/build/flash_image.bin + - name: Run Example Test on target + working-directory: ${{ env.TEST_DIR }} + run: | + python -m pytest --log-cli-level DEBUG --junit-xml=./examples_results_${{ matrix.idf_target }}_${{ matrix.idf_ver }}.xml --target=${{ matrix.idf_target }} + - uses: actions/upload-artifact@v3 + if: always() + with: + name: examples_results_${{ matrix.idf_target }}_${{ matrix.idf_ver }} + path: ${{ env.TEST_DIR }}/*.xml diff --git a/components/esp_modem/examples/pppos_client/sdkconfig.ci.sim800 b/components/esp_modem/examples/pppos_client/sdkconfig.ci.sim800_c3 similarity index 100% rename from components/esp_modem/examples/pppos_client/sdkconfig.ci.sim800 rename to components/esp_modem/examples/pppos_client/sdkconfig.ci.sim800_c3