From dcb7e40e8a952486c9a6ecc9275cac66fb09c7e5 Mon Sep 17 00:00:00 2001 From: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com> Date: Wed, 3 Sep 2025 14:51:20 -0300 Subject: [PATCH 1/2] ci(component): Enable ESP32-C5 for component testing --- .github/scripts/on-push-idf.sh | 4 +- .github/workflows/build_component.yml | 95 +++++++++++++++++++-------- 2 files changed, 69 insertions(+), 30 deletions(-) diff --git a/.github/scripts/on-push-idf.sh b/.github/scripts/on-push-idf.sh index 72e7c7f574e..12d8d05fc34 100644 --- a/.github/scripts/on-push-idf.sh +++ b/.github/scripts/on-push-idf.sh @@ -20,7 +20,7 @@ for example in $idf_component_examples; do fi fi - idf.py -C "$example" set-target "$IDF_TARGET" + idf.py --preview -C "$example" set-target "$IDF_TARGET" has_requirements=$(${CHECK_REQUIREMENTS} "$example" "$example/sdkconfig") if [ "$has_requirements" -eq 0 ]; then @@ -29,5 +29,5 @@ for example in $idf_component_examples; do fi printf "\n\033[95mBuilding %s\033[0m\n\n" "$example" - idf.py -C "$example" -DEXTRA_COMPONENT_DIRS="$PWD/components" build + idf.py --preview -C "$example" -DEXTRA_COMPONENT_DIRS="$PWD/components" build done diff --git a/.github/workflows/build_component.yml b/.github/workflows/build_component.yml index 6d5dd38c626..527fd6cd9c2 100644 --- a/.github/workflows/build_component.yml +++ b/.github/workflows/build_component.yml @@ -12,7 +12,7 @@ on: description: "IDF Targets" default: "esp32,esp32s2,esp32s3,esp32c2,esp32c3,esp32c6,esp32h2,esp32p4" type: "string" - required: true + required: false push: branches: - master @@ -66,35 +66,80 @@ jobs: 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 }} + matrix: ${{ steps.set-matrix.outputs.matrix }} steps: - - name: Get IDF Version and Targets + - name: Get Matrix Combinations 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" + # Define version-specific target configurations + get_targets_for_version() { + case "$1" in + "release-v5.3") + echo "esp32,esp32s2,esp32s3,esp32c2,esp32c3,esp32c6,esp32h2,esp32p4" + ;; + "release-v5.4") + echo "esp32,esp32s2,esp32s3,esp32c2,esp32c3,esp32c6,esp32h2,esp32p4" + ;; + "release-v5.5") + echo "esp32,esp32s2,esp32s3,esp32c2,esp32c3,esp32c5,esp32c6,esp32h2,esp32p4" + ;; + *) + echo "" + ;; + esac + } + + # Default versions if not provided via inputs + DEFAULT_VERSIONS="release-v5.3,release-v5.4,release-v5.5" - # Override with inputs if provided + # Use inputs if provided, otherwise use defaults if [[ -n "${{ inputs.idf_ver }}" ]]; then - idf_ver="${{ inputs.idf_ver }}" - fi - if [[ -n "${{ inputs.idf_targets }}" ]]; then - idf_targets="${{ inputs.idf_targets }}" + VERSIONS="${{ inputs.idf_ver }}" + else + VERSIONS="$DEFAULT_VERSIONS" 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 .) + # Generate matrix combinations + echo '{"include": [' > matrix.json + first=true + IFS=',' read -ra VERSION_ARRAY <<< "$VERSIONS" + + for version in "${VERSION_ARRAY[@]}"; do + # Trim whitespace + version=$(echo "$version" | xargs) + + # Get targets for this version + if [[ -n "${{ inputs.idf_targets }}" ]]; then + # Use provided targets for all versions + targets="${{ inputs.idf_targets }}" + else + # Use version-specific targets + targets=$(get_targets_for_version "$version") + fi + + if [[ -n "$targets" ]]; then + IFS=',' read -ra TARGET_ARRAY <<< "$targets" + for target in "${TARGET_ARRAY[@]}"; do + # Trim whitespace + target=$(echo "$target" | xargs) + + if [ "$first" = true ]; then + first=false + else + echo ',' >> matrix.json + fi + echo "{\"idf_ver\": \"$version\", \"idf_target\": \"$target\"}" >> matrix.json + done + fi + done + echo ']}' >> matrix.json - # Debug: Print the JSON for verification - echo "Debug - idf_ver_json: $idf_ver_json" - echo "Debug - idf_targets_json: $idf_targets_json" + # Debug: Print the matrix for verification + echo "Debug - Generated matrix:" + cat matrix.json | jq . - # 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 + # Set output + printf "matrix=%s\n" "$(cat matrix.json | jq -c .)" >> $GITHUB_OUTPUT build-esp-idf-component: name: Build IDF ${{ matrix.idf_ver }} for ${{ matrix.idf_target }} @@ -102,13 +147,7 @@ jobs: 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) }} + matrix: ${{ fromJson(needs.set-matrix.outputs.matrix) }} container: espressif/idf:${{ matrix.idf_ver }} steps: - name: Check out arduino-esp32 as a component From 3e8fec62d09eb849260537c4e1d3a2c325aa2200 Mon Sep 17 00:00:00 2001 From: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com> Date: Thu, 4 Sep 2025 10:35:32 -0300 Subject: [PATCH 2/2] ci(idf): Fix regression --- .github/scripts/on-push-idf.sh | 4 ++-- .github/workflows/build_component.yml | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/scripts/on-push-idf.sh b/.github/scripts/on-push-idf.sh index 4b56b6df69c..166bfe13eb1 100644 --- a/.github/scripts/on-push-idf.sh +++ b/.github/scripts/on-push-idf.sh @@ -26,7 +26,7 @@ for example in $affected_examples; do fi fi - idf.py -C "$example_path" set-target "$IDF_TARGET" + idf.py --preview -C "$example_path" set-target "$IDF_TARGET" has_requirements=$(${CHECK_REQUIREMENTS} "$example_path" "$example_path/sdkconfig") if [ "$has_requirements" -eq 0 ]; then @@ -35,5 +35,5 @@ for example in $affected_examples; do fi printf "\n\033[95mBuilding %s\033[0m\n\n" "$example" - idf.py -C "$example_path" -DEXTRA_COMPONENT_DIRS="$PWD/components" build + idf.py --preview -C "$example_path" -DEXTRA_COMPONENT_DIRS="$PWD/components" build done diff --git a/.github/workflows/build_component.yml b/.github/workflows/build_component.yml index a2210bada81..bc32f7a8999 100644 --- a/.github/workflows/build_component.yml +++ b/.github/workflows/build_component.yml @@ -67,8 +67,6 @@ jobs: if: ${{ !(github.event_name == 'pull_request' && startsWith(github.head_ref, 'release/')) }} outputs: matrix: ${{ steps.set-matrix.outputs.matrix }} - idf_ver: ${{ steps.set-matrix.outputs.idf_ver }} - idf_target: ${{ steps.set-matrix.outputs.idf_target }} should_build: ${{ steps.affected-examples.outputs.should_build }} steps: - name: Install universal-ctags