@@ -148,31 +148,93 @@ jobs:
148
148
apt-get -qq update && apt-get -qq -y install curl
149
149
curl -s https://raw.githubusercontent.com/apple/swift-nio/main/scripts/check-matrix-job.sh | bash
150
150
151
+ generate-matrix :
152
+ runs-on : ubuntu-latest
153
+ outputs :
154
+ linux-matrix : ${{ steps.set-matrix.outputs.linux-matrix }}
155
+ windows-matrix : ${{ steps.set-matrix.outputs.windows-matrix }}
156
+ windows-nightly-matrix : ${{ steps.set-matrix.outputs.windows-nightly-matrix }}
157
+ steps :
158
+ - id : set-matrix
159
+ env :
160
+ LINUX_5_9_ENABLED : ${{ inputs.matrix_linux_5_9_enabled }}
161
+ LINUX_5_10_ENABLED : ${{ inputs.matrix_linux_5_10_enabled }}
162
+ LINUX_6_0_ENABLED : ${{ inputs.matrix_linux_6_0_enabled }}
163
+ LINUX_NIGHTLY_6_0_ENABLED : ${{ inputs.matrix_linux_nightly_6_0_enabled }}
164
+ LINUX_NIGHTLY_MAIN_ENABLED : ${{ inputs.matrix_linux_nightly_main_enabled }}
165
+ WINDOWS_6_0_ENABLED : ${{ inputs.matrix_windows_6_0_enabled }}
166
+ WINDOWS_NIGHTLY_6_0_ENABLED : ${{ inputs.matrix_windows_nightly_6_0_enabled }}
167
+ WINDOWS_NIGHTLY_MAIN_ENABLED : ${{ inputs.matrix_windows_nightly_main_enabled }}
168
+ run : |
169
+ # Linux matrix
170
+ linux_matrix='{"swift": []}'
171
+ if [[ "${LINUX_5_9_ENABLED}" == "true" ]]; then
172
+ linux_matrix=$(echo "$linux_matrix" | jq '.swift[.swift| length] |= . + { "image": "${{ inputs.matrix_linux_5_9_container_image }}", "swift_version": "5.9" }')
173
+ elif [[ "${LINUX_5_10_ENABLED}" == "true" ]]; then
174
+ linux_matrix=$(echo "$linux_matrix" | jq '.swift[.swift| length] |= . + { "image": "${{ inputs.matrix_linux_5_10_container_image }}", "swift_version": "5.10" }')
175
+ elif [[ "${LINUX_6_0_ENABLED}" == "true" ]]; then
176
+ linux_matrix=$(echo "$linux_matrix" | jq '.swift[.swift| length] |= . + { "image": "${{ inputs.matrix_linux_6_0_container_image }}", "swift_version": "6.0" }')
177
+ elif [[ "${LINUX_NIGHTLY_6_0_ENABLED}" == "true" ]]; then
178
+ linux_matrix=$(echo "$linux_matrix" | jq '.swift[.swift| length] |= . + { "image": "${{ inputs.matrix_linux_nightly_6_0_container_image }}", "swift_version": "nightly-6.0" }')
179
+ elif [[ "${LINUX_NIGHTLY_MAIN_ENABLED}" == "true" ]]; then
180
+ linux_matrix=$(echo "$linux_matrix" | jq '.swift[.swift| length] |= . + { "image": "${{ inputs.matrix_linux_nightly_main_container_image }}", "swift_version": "nightly-main" }')
181
+ fi
182
+
183
+ {
184
+ echo 'linx-matrix<<EOF'
185
+ echo $linux_matrix
186
+ echo EOF
187
+ } >> "$GITHUB_OUTPUT"
188
+
189
+ # Windows matrix
190
+ windows_matrix='{"swift": []}'
191
+ if [[ "${WINDOWS_6_0_ENABLED}" == "true" ]]; then
192
+ windows_matrix=$(echo "$windows_matrix" | jq '.swift[.swift| length] |= . + { "image": "swift:6.0-windowsservercore-ltsc2022", "swift_version": "6.0" }')
193
+ fi
194
+
195
+ {
196
+ echo 'windows-matrix<<EOF'
197
+ echo $windows_matrix
198
+ echo EOF
199
+ } >> "$GITHUB_OUTPUT"
200
+
201
+ # Windows nightly matrix
202
+ windows_nightly_matrix='{"swift": []}'
203
+ if [[ "${WINDOWS_NIGHTLY_6_0_ENABLED}" == "true" ]]; then
204
+ windows_nightly_matrix=$(echo "$windows_nightly_matrix" | jq '.swift[.swift| length] |= . + { "image": "swiftlang/swift:nightly-6.0-windowsservercore-1809", "swift_version": "nightly-6.0" }')
205
+ elif [[ "${WINDOWS_NIGHTLY_MAIN_ENABLED}" == "true" ]]; then
206
+ windows_nightly_matrix=$(echo "$windows_nightly_matrix" | jq '.swift[.swift| length] |= . + { "image": "swiftlang/swift:nightly-main-windowsservercore-1809", "swift_version": "nightly-main" }')
207
+ fi
208
+
209
+ {
210
+ echo 'windows-nightly-matrix<<EOF'
211
+ echo $windows_nightly_matrix
212
+ echo EOF
213
+ } >> "$GITHUB_OUTPUT"
214
+
215
+ echo "$GITHUB_OUTPUT"
216
+ - run : |
217
+ echo "${{ steps.set-matrix.outputs.linux-matrix }}"
218
+ echo "${{ steps.set-matrix.outputs.windows-matrix }}"
219
+ echo "${{ steps.set-matrix.outputs.windows-nightly-matrix }}"
220
+
151
221
windows :
152
222
name : Windows (${{ matrix.swift.swift_version }})
223
+ needs : generate-matrix
153
224
runs-on : windows-2022
154
225
strategy :
155
226
fail-fast : false
156
- matrix :
157
- # We are specifying only the major and minor of the docker images to automatically pick up the latest patch release
158
- swift :
159
- - image : swift:6.0-windowsservercore-ltsc2022
160
- swift_version : " 6.0"
161
- enabled : ${{ inputs.matrix_windows_6_0_enabled }}
227
+ matrix : ${{fromJson(needs.generate-matrix.outputs.windows-matrix)}}
162
228
steps :
163
229
- name : Pull Docker image
164
- if : ${{ matrix.swift.enabled }}
165
230
run : docker pull ${{ matrix.swift.image }}
166
231
- name : Checkout repository
167
- if : ${{ matrix.swift.enabled }}
168
232
uses : actions/checkout@v4
169
233
with :
170
234
persist-credentials : false
171
235
- name : Donwload matrix script
172
- if : ${{ matrix.swift.enabled }}
173
236
run : curl -s https://raw.githubusercontent.com/apple/swift-nio/main/scripts/check-matrix-job.ps1 -o __check-matrix-job.ps1
174
237
- name : Run matrix job
175
- if : ${{ matrix.swift.enabled }}
176
238
run : |
177
239
docker run --env SWIFT_VERSION="${{ matrix.swift.swift_version }}" --env COMMAND="${{ inputs.matrix_windows_command }}" --env COMMAND_OVERRIDE_6_0="${{ inputs.matrix_windows_6_0_command_override }}" -v ${{ github.workspace }}:C:\source ${{ matrix.swift.image }} cmd /s /c "swift --version & cd C:\source\ & powershell -File __check-matrix-job.ps1"
178
240
0 commit comments