From 2b9d7576fa918e3f27ebd743690489c0874c2309 Mon Sep 17 00:00:00 2001 From: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com> Date: Wed, 30 Jul 2025 10:27:31 -0300 Subject: [PATCH 1/2] ci(component): Move component compilation to a separate workflow --- .github/scripts/set_push_chunks.sh | 1 - .github/workflows/build_component.yml | 133 ++++++++++++++++++++++++++ .github/workflows/push.yml | 120 +++++------------------ .github/workflows/tests.yml | 11 +-- 4 files changed, 159 insertions(+), 106 deletions(-) create mode 100644 .github/workflows/build_component.yml diff --git a/.github/scripts/set_push_chunks.sh b/.github/scripts/set_push_chunks.sh index ff0af7da6e8..69cd9a7f7de 100644 --- a/.github/scripts/set_push_chunks.sh +++ b/.github/scripts/set_push_chunks.sh @@ -78,7 +78,6 @@ chunks+="]" echo "build_all=$build_all" echo "build_libraries=$BUILD_LIBRARIES" echo "build_static_sketches=$BUILD_STATIC_SKETCHES" - echo "build_idf=$BUILD_IDF" echo "chunk_count=$chunks_count" echo "chunks=$chunks" } >> "$GITHUB_OUTPUT" diff --git a/.github/workflows/build_component.yml b/.github/workflows/build_component.yml new file mode 100644 index 00000000000..5553b4b2024 --- /dev/null +++ b/.github/workflows/build_component.yml @@ -0,0 +1,133 @@ +name: Arduino as ESP-IDF Component + +on: + workflow_dispatch: + inputs: + idf_ver: + description: "IDF Versions" + default: "release-v5.3,release-v5.4,release-v5.5" + type: "string" + required: true + idf_targets: + description: "IDF Targets" + default: "esp32,esp32s2,esp32s3,esp32c2,esp32c3,esp32c6,esp32h2,esp32p4" + type: "string" + required: true + push: + branches: + - master + - release/* + pull_request: + paths: + - "cores/**" + - "libraries/**/*.cpp" + - "libraries/**/*.c" + - "libraries/**/*.h" + - "libraries/**/*.ino" + - "libraries/**/ci.json" + - "idf_component_examples/**" + - "idf_component.yml" + - "Kconfig.projbuild" + - "CMakeLists.txt" + - ".github/workflows/build_component.yml" + - ".github/scripts/check-cmakelists.sh" + - ".github/scripts/on-push-idf.sh" + - ".github/scripts/sketch_utils.sh" + - "variants/esp32/**" + - "variants/esp32c2/**" + - "variants/esp32c3/**" + - "variants/esp32c6/**" + - "variants/esp32h2/**" + - "variants/esp32p4/**" + - "variants/esp32s2/**" + - "variants/esp32s3/**" + - "!*.md" + - "!*.txt" + - "!*.properties" + +concurrency: + group: build-component-${{github.event.pull_request.number || github.ref}} + cancel-in-progress: true + +jobs: + cmake-check: + name: Check CMakeLists + runs-on: ubuntu-latest + if: ${{ !(github.event_name == 'pull_request' && startsWith(github.head_ref, 'release/')) }} + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - run: bash ./.github/scripts/check-cmakelists.sh + + set-matrix: + name: Set Matrix + runs-on: ubuntu-latest + if: ${{ !(github.event_name == 'pull_request' && startsWith(github.head_ref, 'release/')) }} + outputs: + idf_ver: ${{ steps.set-matrix.outputs.idf_ver }} + idf_target: ${{ steps.set-matrix.outputs.idf_target }} + steps: + - name: Get IDF Version and Targets + id: set-matrix + run: | + # Default values + idf_ver="release-v5.3,release-v5.4,release-v5.5" + idf_targets="esp32,esp32s2,esp32s3,esp32c2,esp32c3,esp32c6,esp32h2,esp32p4" + + # Override with inputs if provided + if [[ -n "${{ inputs.idf_ver }}" ]]; then + idf_ver="${{ inputs.idf_ver }}" + fi + if [[ -n "${{ inputs.idf_targets }}" ]]; then + idf_targets="${{ inputs.idf_targets }}" + fi + + # Convert comma-separated strings to JSON arrays using a more robust method + idf_ver_json=$(printf '%s\n' "$idf_ver" | tr ',' '\n' | jq -R . | jq -s . | jq -c .) + idf_targets_json=$(printf '%s\n' "$idf_targets" | tr ',' '\n' | jq -R . | jq -s . | jq -c .) + + # Debug: Print the JSON for verification + echo "Debug - idf_ver_json: $idf_ver_json" + echo "Debug - idf_targets_json: $idf_targets_json" + + # Set outputs - ensure no extra whitespace + printf "idf_ver=%s\n" "$idf_ver_json" >> $GITHUB_OUTPUT + printf "idf_target=%s\n" "$idf_targets_json" >> $GITHUB_OUTPUT + + build-esp-idf-component: + name: Build IDF ${{ matrix.idf_ver }} for ${{ matrix.idf_target }} + runs-on: ubuntu-latest + needs: set-matrix + strategy: + fail-fast: false + matrix: + # The version names here correspond to the versions of espressif/idf Docker image. + # See https://hub.docker.com/r/espressif/idf/tags and + # https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/tools/idf-docker-image.html + # for details. + idf_ver: ${{ fromJson(needs.set-matrix.outputs.idf_ver) }} + idf_target: ${{ fromJson(needs.set-matrix.outputs.idf_target) }} + container: espressif/idf:${{ matrix.idf_ver }} + steps: + - name: Check out arduino-esp32 as a component + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + submodules: recursive + path: components/arduino-esp32 + + - name: Setup jq + uses: dcarbone/install-jq-action@e397bd87438d72198f81efd21f876461183d383a # v3.0.1 + + - name: Build + env: + IDF_TARGET: ${{ matrix.idf_target }} + shell: bash + run: | + chmod a+x ./components/arduino-esp32/.github/scripts/* + ./components/arduino-esp32/.github/scripts/on-push-idf.sh + + - name: Upload generated sdkconfig files for debugging + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 + if: always() + with: + name: sdkconfig-${{ matrix.idf_ver }}-${{ matrix.idf_target }} + path: ./components/arduino-esp32/idf_component_examples/**/sdkconfig diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 1523b7231be..fc85566aa8b 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -25,34 +25,32 @@ on: pull_request: paths: - "cores/**" - - "libraries/**" - - "!libraries/**.md" - - "!libraries/**.txt" - - "!libraries/**.properties" - - "!libraries/**.py" + - "libraries/**/*.cpp" + - "libraries/**/*.c" + - "libraries/**/*.h" + - "libraries/**/*.ino" + - "libraries/**/ci.json" - "package/**" - - "idf_component_examples/**" - - "tools/**.py" + - "tools/get.*" - "platform.txt" - "programmers.txt" - - "idf_component.yml" - - "Kconfig.projbuild" - "package.json" - - "CMakeLists.txt" - ".github/workflows/push.yml" - - ".github/scripts/**" - - "!.github/scripts/find_*" - - "!.github/scripts/on-release.sh" - - "!.github/scripts/tests_*" - - "!.github/scripts/upload_*" - - "variants/esp32/**/*" - - "variants/esp32c3/**/*" - - "variants/esp32c5/**/*" - - "variants/esp32c6/**/*" - - "variants/esp32h2/**/*" - - "variants/esp32p4/**/*" - - "variants/esp32s2/**/*" - - "variants/esp32s3/**/*" + - ".github/scripts/install-*" + - ".github/scripts/on-push.sh" + - ".github/scripts/set_push_chunks.sh" + - ".github/scripts/sketch_utils.sh" + - "variants/esp32/**" + - "variants/esp32c3/**" + - "variants/esp32c5/**" + - "variants/esp32c6/**" + - "variants/esp32h2/**" + - "variants/esp32p4/**" + - "variants/esp32s2/**" + - "variants/esp32s3/**" + - "!*.md" + - "!*.txt" + - "!*.properties" concurrency: group: build-${{github.event.pull_request.number || github.ref}} @@ -62,14 +60,6 @@ env: MAX_CHUNKS: 15 jobs: - cmake-check: - name: Check cmake file - runs-on: ubuntu-latest - if: ${{ !(github.event_name == 'pull_request' && startsWith(github.head_ref, 'release/')) }} - steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - run: bash ./.github/scripts/check-cmakelists.sh - gen-chunks: name: Generate chunks runs-on: ubuntu-latest @@ -78,7 +68,6 @@ jobs: build_all: ${{ steps.set-chunks.outputs.build_all }} build_libraries: ${{ steps.set-chunks.outputs.build_libraries }} build_static_sketches: ${{ steps.set-chunks.outputs.build_static_sketches }} - build_idf: ${{ steps.set-chunks.outputs.build_idf }} chunk_count: ${{ steps.set-chunks.outputs.chunk_count }} chunks: ${{ steps.set-chunks.outputs.chunks }} steps: @@ -99,13 +88,7 @@ jobs: - 'tools/**' - 'platform.txt' - 'programmers.txt' - - "variants/esp32/**/*" - - "variants/esp32c3/**/*" - - "variants/esp32c6/**/*" - - "variants/esp32h2/**/*" - - "variants/esp32p4/**/*" - - "variants/esp32s2/**/*" - - "variants/esp32s3/**/*" + - "variants/**" libraries: - 'libraries/**/examples/**' - 'libraries/**/src/**' @@ -121,11 +104,6 @@ jobs: - 'libraries/NetworkClientSecure/src/**' - 'libraries/BLE/src/**' - 'libraries/Insights/src/**' - idf: - - 'idf_component.yml' - - 'Kconfig.projbuild' - - 'CMakeLists.txt' - - "idf_component_examples/**" - name: Set chunks id: set-chunks @@ -133,7 +111,6 @@ jobs: LIB_FILES: ${{ steps.changed-files.outputs.libraries_all_changed_files }} IS_PR: ${{ github.event_name == 'pull_request' }} MAX_CHUNKS: ${{ env.MAX_CHUNKS }} - BUILD_IDF: ${{ steps.changed-files.outputs.idf_any_changed == 'true' }} BUILD_LIBRARIES: ${{ steps.changed-files.outputs.libraries_any_changed == 'true' }} BUILD_STATIC_SKETCHES: ${{ steps.changed-files.outputs.static_sketeches_any_changed == 'true' }} FS_CHANGED: ${{ steps.changed-files.outputs.fs_any_changed == 'true' }} @@ -233,59 +210,6 @@ jobs: - name: Build Sketches run: bash ./.github/scripts/on-push.sh - build-esp-idf-component: - name: Build with ESP-IDF ${{ matrix.idf_ver }} for ${{ matrix.idf_target }} - needs: gen-chunks - if: | - needs.gen-chunks.outputs.build_all == 'true' || - needs.gen-chunks.outputs.build_libraries == 'true' || - needs.gen-chunks.outputs.build_idf == 'true' - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - # The version names here correspond to the versions of espressif/idf Docker image. - # See https://hub.docker.com/r/espressif/idf/tags and - # https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/tools/idf-docker-image.html - # for details. - idf_ver: ["release-v5.3","release-v5.4","release-v5.5"] - idf_target: - [ - "esp32", - "esp32s2", - "esp32s3", - "esp32c2", - "esp32c3", - "esp32c6", - "esp32h2", - "esp32p4" - ] - container: espressif/idf:${{ matrix.idf_ver }} - steps: - - name: Check out arduino-esp32 as a component - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - with: - submodules: recursive - path: components/arduino-esp32 - - - name: Setup jq - uses: dcarbone/install-jq-action@e397bd87438d72198f81efd21f876461183d383a # v3.0.1 - - - name: Build - env: - IDF_TARGET: ${{ matrix.idf_target }} - shell: bash - run: | - chmod a+x ./components/arduino-esp32/.github/scripts/* - ./components/arduino-esp32/.github/scripts/on-push-idf.sh - - - name: Upload generated sdkconfig files for debugging - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 - if: always() - with: - name: sdkconfig-${{ matrix.idf_ver }}-${{ matrix.idf_target }} - path: ./components/arduino-esp32/idf_component_examples/**/sdkconfig - # Save artifacts to gh-pages save-master-artifacts: name: Save master artifacts diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ddc9b64aace..058d9a3a793 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -16,20 +16,17 @@ on: pull_request: types: [opened, reopened, closed, synchronize, labeled, unlabeled] paths: + - ".github/scripts/install*.sh" - ".github/workflows/tests*" - - ".github/scripts/*.sh" - - "!.github/scripts/check-cmakelists.sh" - - "!.github/scripts/find_*" - - "!.github/scripts/on-*.sh" - - "!.github/scripts/set_push_chunks.sh" - - "!.github/scripts/update-version.sh" - - "!.github/scripts/upload_py_tools.sh" + - ".github/scripts/sketch_utils.sh" - "tests/**" - "cores/**" - "libraries/*/src/**.cpp" - "libraries/*/src/**.h" - "libraries/*/src/**.c" - "package/**" + - "!*.md" + - "!*.properties" schedule: - cron: "0 2 * * *" From 81cc594e63f50d5f3c2045b0cb069f06ff46fc27 Mon Sep 17 00:00:00 2001 From: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com> Date: Sun, 3 Aug 2025 17:32:18 -0300 Subject: [PATCH 2/2] fix(push): Fix typo in yaml --- .github/workflows/push.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index fc85566aa8b..48530e30bc9 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -96,7 +96,7 @@ jobs: - 'libraries/Network/src/**' fs: - 'libraries/FS/src/**' - static_sketeches: + static_sketches: - 'libraries/NetworkClientSecure/examples/WiFiClientSecure/WiFiClientSecure.ino' - 'libraries/BLE/examples/Server/Server.ino' - 'libraries/ESP32/examples/Camera/CameraWebServer/CameraWebServer.ino' @@ -112,7 +112,7 @@ jobs: IS_PR: ${{ github.event_name == 'pull_request' }} MAX_CHUNKS: ${{ env.MAX_CHUNKS }} BUILD_LIBRARIES: ${{ steps.changed-files.outputs.libraries_any_changed == 'true' }} - BUILD_STATIC_SKETCHES: ${{ steps.changed-files.outputs.static_sketeches_any_changed == 'true' }} + BUILD_STATIC_SKETCHES: ${{ steps.changed-files.outputs.static_sketches_any_changed == 'true' }} FS_CHANGED: ${{ steps.changed-files.outputs.fs_any_changed == 'true' }} NETWORKING_CHANGED: ${{ steps.changed-files.outputs.networking_any_changed == 'true' }} CORE_CHANGED: ${{ steps.changed-files.outputs.core_any_changed == 'true' }}