Skip to content

Commit cb04e89

Browse files
authored
Merge pull request #11794 from lucasssvaz/ci/esp32c5_component
ci(component): Enable ESP32-C5 for component testing
2 parents 9a127fc + 3e8fec6 commit cb04e89

File tree

2 files changed

+72
-33
lines changed

2 files changed

+72
-33
lines changed

.github/scripts/on-push-idf.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ for example in $affected_examples; do
2626
fi
2727
fi
2828

29-
idf.py -C "$example_path" set-target "$IDF_TARGET"
29+
idf.py --preview -C "$example_path" set-target "$IDF_TARGET"
3030

3131
has_requirements=$(${CHECK_REQUIREMENTS} "$example_path" "$example_path/sdkconfig")
3232
if [ "$has_requirements" -eq 0 ]; then
@@ -35,5 +35,5 @@ for example in $affected_examples; do
3535
fi
3636

3737
printf "\n\033[95mBuilding %s\033[0m\n\n" "$example"
38-
idf.py -C "$example_path" -DEXTRA_COMPONENT_DIRS="$PWD/components" build
38+
idf.py --preview -C "$example_path" -DEXTRA_COMPONENT_DIRS="$PWD/components" build
3939
done

.github/workflows/build_component.yml

Lines changed: 70 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ on:
1212
description: "IDF Targets"
1313
default: "esp32,esp32s2,esp32s3,esp32c2,esp32c3,esp32c6,esp32h2,esp32p4"
1414
type: "string"
15-
required: true
15+
required: false
1616
push:
1717
branches:
1818
- master
@@ -66,8 +66,7 @@ jobs:
6666
runs-on: ubuntu-latest
6767
if: ${{ !(github.event_name == 'pull_request' && startsWith(github.head_ref, 'release/')) }}
6868
outputs:
69-
idf_ver: ${{ steps.set-matrix.outputs.idf_ver }}
70-
idf_target: ${{ steps.set-matrix.outputs.idf_target }}
69+
matrix: ${{ steps.set-matrix.outputs.matrix }}
7170
should_build: ${{ steps.affected-examples.outputs.should_build }}
7271
steps:
7372
- name: Install universal-ctags
@@ -113,32 +112,78 @@ jobs:
113112
dependencies_reverse.json
114113
if-no-files-found: warn
115114

116-
- name: Get IDF Version and Targets
115+
- name: Get Matrix Combinations
117116
id: set-matrix
118117
run: |
119-
# Default values
120-
idf_ver="release-v5.3,release-v5.4,release-v5.5"
121-
idf_targets="esp32,esp32s2,esp32s3,esp32c2,esp32c3,esp32c6,esp32h2,esp32p4"
122-
123-
# Override with inputs if provided
118+
# Define version-specific target configurations
119+
get_targets_for_version() {
120+
case "$1" in
121+
"release-v5.3")
122+
echo "esp32,esp32s2,esp32s3,esp32c2,esp32c3,esp32c6,esp32h2,esp32p4"
123+
;;
124+
"release-v5.4")
125+
echo "esp32,esp32s2,esp32s3,esp32c2,esp32c3,esp32c6,esp32h2,esp32p4"
126+
;;
127+
"release-v5.5")
128+
echo "esp32,esp32s2,esp32s3,esp32c2,esp32c3,esp32c5,esp32c6,esp32h2,esp32p4"
129+
;;
130+
*)
131+
echo ""
132+
;;
133+
esac
134+
}
135+
136+
# Default versions if not provided via inputs
137+
DEFAULT_VERSIONS="release-v5.3,release-v5.4,release-v5.5"
138+
139+
# Use inputs if provided, otherwise use defaults
124140
if [[ -n "${{ inputs.idf_ver }}" ]]; then
125-
idf_ver="${{ inputs.idf_ver }}"
126-
fi
127-
if [[ -n "${{ inputs.idf_targets }}" ]]; then
128-
idf_targets="${{ inputs.idf_targets }}"
141+
VERSIONS="${{ inputs.idf_ver }}"
142+
else
143+
VERSIONS="$DEFAULT_VERSIONS"
129144
fi
130145
131-
# Convert comma-separated strings to JSON arrays using a more robust method
132-
idf_ver_json=$(printf '%s\n' "$idf_ver" | tr ',' '\n' | jq -R . | jq -s . | jq -c .)
133-
idf_targets_json=$(printf '%s\n' "$idf_targets" | tr ',' '\n' | jq -R . | jq -s . | jq -c .)
134-
135-
# Debug: Print the JSON for verification
136-
echo "Debug - idf_ver_json: $idf_ver_json"
137-
echo "Debug - idf_targets_json: $idf_targets_json"
138-
139-
# Set outputs - ensure no extra whitespace
140-
printf "idf_ver=%s\n" "$idf_ver_json" >> $GITHUB_OUTPUT
141-
printf "idf_target=%s\n" "$idf_targets_json" >> $GITHUB_OUTPUT
146+
# Generate matrix combinations
147+
echo '{"include": [' > matrix.json
148+
first=true
149+
IFS=',' read -ra VERSION_ARRAY <<< "$VERSIONS"
150+
151+
for version in "${VERSION_ARRAY[@]}"; do
152+
# Trim whitespace
153+
version=$(echo "$version" | xargs)
154+
155+
# Get targets for this version
156+
if [[ -n "${{ inputs.idf_targets }}" ]]; then
157+
# Use provided targets for all versions
158+
targets="${{ inputs.idf_targets }}"
159+
else
160+
# Use version-specific targets
161+
targets=$(get_targets_for_version "$version")
162+
fi
163+
164+
if [[ -n "$targets" ]]; then
165+
IFS=',' read -ra TARGET_ARRAY <<< "$targets"
166+
for target in "${TARGET_ARRAY[@]}"; do
167+
# Trim whitespace
168+
target=$(echo "$target" | xargs)
169+
170+
if [ "$first" = true ]; then
171+
first=false
172+
else
173+
echo ',' >> matrix.json
174+
fi
175+
echo "{\"idf_ver\": \"$version\", \"idf_target\": \"$target\"}" >> matrix.json
176+
done
177+
fi
178+
done
179+
echo ']}' >> matrix.json
180+
181+
# Debug: Print the matrix for verification
182+
echo "Debug - Generated matrix:"
183+
cat matrix.json | jq .
184+
185+
# Set output
186+
printf "matrix=%s\n" "$(cat matrix.json | jq -c .)" >> $GITHUB_OUTPUT
142187
143188
build-esp-idf-component:
144189
name: Build IDF ${{ matrix.idf_ver }} for ${{ matrix.idf_target }}
@@ -147,13 +192,7 @@ jobs:
147192
if: ${{ needs.set-matrix.outputs.should_build == '1' }}
148193
strategy:
149194
fail-fast: false
150-
matrix:
151-
# The version names here correspond to the versions of espressif/idf Docker image.
152-
# See https://hub.docker.com/r/espressif/idf/tags and
153-
# https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/tools/idf-docker-image.html
154-
# for details.
155-
idf_ver: ${{ fromJson(needs.set-matrix.outputs.idf_ver) }}
156-
idf_target: ${{ fromJson(needs.set-matrix.outputs.idf_target) }}
195+
matrix: ${{ fromJson(needs.set-matrix.outputs.matrix) }}
157196
container: espressif/idf:${{ matrix.idf_ver }}
158197
steps:
159198
- name: Check out arduino-esp32 as a component

0 commit comments

Comments
 (0)