12
12
description : " IDF Targets"
13
13
default : " esp32,esp32s2,esp32s3,esp32c2,esp32c3,esp32c6,esp32h2,esp32p4"
14
14
type : " string"
15
- required : true
15
+ required : false
16
16
push :
17
17
branches :
18
18
- master
66
66
runs-on : ubuntu-latest
67
67
if : ${{ !(github.event_name == 'pull_request' && startsWith(github.head_ref, 'release/')) }}
68
68
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 }}
71
70
should_build : ${{ steps.affected-examples.outputs.should_build }}
72
71
steps :
73
72
- name : Install universal-ctags
@@ -113,32 +112,78 @@ jobs:
113
112
dependencies_reverse.json
114
113
if-no-files-found : warn
115
114
116
- - name : Get IDF Version and Targets
115
+ - name : Get Matrix Combinations
117
116
id : set-matrix
118
117
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
124
140
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"
129
144
fi
130
145
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
142
187
143
188
build-esp-idf-component :
144
189
name : Build IDF ${{ matrix.idf_ver }} for ${{ matrix.idf_target }}
@@ -147,13 +192,7 @@ jobs:
147
192
if : ${{ needs.set-matrix.outputs.should_build == '1' }}
148
193
strategy :
149
194
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) }}
157
196
container : espressif/idf:${{ matrix.idf_ver }}
158
197
steps :
159
198
- name : Check out arduino-esp32 as a component
0 commit comments