@@ -148,31 +148,66 @@ 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='{"swift": []}'
170
+ if [[ "${LINUX_5_9_ENABLED}" == "true" ]]; then
171
+ linux_matrix=$(echo "$linux_matrix" | jq '.swift[.swift| length] |= . + { "image": "${{ inputs.matrix_linux_5_9_container_image }}", "swift_version": "5.9" }')
172
+ elif [[ "${LINUX_5_10_ENABLED}" == "true" ]]; then
173
+ linux_matrix=$(echo "$linux_matrix" | jq '.swift[.swift| length] |= . + { "image": "${{ inputs.matrix_linux_5_10_container_image }}", "swift_version": "5.10" }')
174
+ elif [[ "${LINUX_6_0_ENABLED}" == "true" ]]; then
175
+ linux_matrix=$(echo "$linux_matrix" | jq '.swift[.swift| length] |= . + { "image": "${{ inputs.matrix_linux_6_0_container_image }}", "swift_version": "6.0" }')
176
+ elif [[ "${LINUX_NIGHTLY_6_0_ENABLED}" == "true" ]]; then
177
+ linux_matrix=$(echo "$linux_matrix" | jq '.swift[.swift| length] |= . + { "image": "${{ inputs.matrix_linux_nightly_6_0_container_image }}", "swift_version": "nightly-6.0" }')
178
+ elif [[ "${LINUX_NIGHTLY_MAIN_ENABLED}" == "true" ]]; then
179
+ linux_matrix=$(echo "$linux_matrix" | jq '.swift[.swift| length] |= . + { "image": "${{ inputs.matrix_linux_nightly_main_container_image }}", "swift_version": "nightly-main" }')
180
+ fi
181
+
182
+ {
183
+ echo 'linx-matrix<<EOF'
184
+ echo $linux_matrix
185
+ echo EOF
186
+ } >> "$GITHUB_OUTPUT"
187
+
188
+ echo "$GITHUB_OUTPUT"
189
+ - run : |
190
+ echo "${{ steps.set-matrix.outputs.linux-matrix }}"
191
+ echo "${{ steps.set-matrix.outputs.windows-matrix }}"
192
+ echo "${{ steps.set-matrix.outputs.windows-nightly-matrix }}"
193
+
151
194
windows :
152
195
name : Windows (${{ matrix.swift.swift_version }})
196
+ needs : generate-matrix
153
197
runs-on : windows-2022
154
198
strategy :
155
199
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 }}
200
+ matrix : ${{fromJson(needs.generate-matrix.outputs.windows-matrix)}}
162
201
steps :
163
202
- name : Pull Docker image
164
- if : ${{ matrix.swift.enabled }}
165
203
run : docker pull ${{ matrix.swift.image }}
166
204
- name : Checkout repository
167
- if : ${{ matrix.swift.enabled }}
168
205
uses : actions/checkout@v4
169
206
with :
170
207
persist-credentials : false
171
208
- name : Donwload matrix script
172
- if : ${{ matrix.swift.enabled }}
173
209
run : curl -s https://raw.githubusercontent.com/apple/swift-nio/main/scripts/check-matrix-job.ps1 -o __check-matrix-job.ps1
174
210
- name : Run matrix job
175
- if : ${{ matrix.swift.enabled }}
176
211
run : |
177
212
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
213
0 commit comments