74
74
matrix_windows_6_0_enabled :
75
75
type : boolean
76
76
description : " Boolean to enable the 6.0 Swift version matrix job. Defaults to true."
77
- default : false
77
+ default : true
78
78
matrix_windows_6_0_command_override :
79
79
type : string
80
80
description : " The command of the 6.0 Swift version windows matrix job to execute."
81
81
matrix_windows_nightly_6_0_enabled :
82
82
type : boolean
83
83
description : " Boolean to enable the nightly 6.0 Swift version matrix job. Defaults to true."
84
- default : false
84
+ default : true
85
85
matrix_windows_nightly_6_0_command_override :
86
86
type : string
87
87
description : " The command of the nightly 6.0 Swift version windows matrix job to execute."
88
88
matrix_windows_nightly_main_enabled :
89
89
type : boolean
90
90
description : " Boolean to enable the nightly main Swift version matrix job. Defaults to true."
91
- default : false
91
+ default : true
92
92
matrix_windows_nightly_main_command_override :
93
93
type : string
94
94
description : " The command of the nightly main Swift version windows matrix job to execute."
@@ -99,29 +99,89 @@ concurrency:
99
99
cancel-in-progress : true
100
100
101
101
jobs :
102
+ generate-matrix :
103
+ runs-on : ubuntu-latest
104
+ outputs :
105
+ linux-matrix : ${{ steps.set-matrix.outputs.linux-matrix }}
106
+ windows-matrix : ${{ steps.set-matrix.outputs.windows-matrix }}
107
+ windows-nightly-matrix : ${{ steps.set-matrix.outputs.windows-nightly-matrix }}
108
+ steps :
109
+ - id : set-matrix
110
+ env :
111
+ LINUX_5_9_ENABLED : ${{ inputs.matrix_linux_5_9_enabled }}
112
+ LINUX_5_10_ENABLED : ${{ inputs.matrix_linux_5_10_enabled }}
113
+ LINUX_6_0_ENABLED : ${{ inputs.matrix_linux_6_0_enabled }}
114
+ LINUX_NIGHTLY_6_0_ENABLED : ${{ inputs.matrix_linux_nightly_6_0_enabled }}
115
+ LINUX_NIGHTLY_MAIN_ENABLED : ${{ inputs.matrix_linux_nightly_main_enabled }}
116
+ WINDOWS_6_0_ENABLED : ${{ inputs.matrix_windows_6_0_enabled }}
117
+ WINDOWS_NIGHTLY_6_0_ENABLED : ${{ inputs.matrix_windows_nightly_6_0_enabled }}
118
+ WINDOWS_NIGHTLY_MAIN_ENABLED : ${{ inputs.matrix_windows_nightly_main_enabled }}
119
+ run : |
120
+ linux_matrix='{"swift": []}'
121
+ if [[ "${LINUX_5_9_ENABLED}" == "true" ]]; then
122
+ linux_matrix=$(echo "$linux_matrix" | jq '.swift[.swift| length] |= . + { "image": "${{ inputs.matrix_linux_5_9_container_image }}", "swift_version": "5.9" }')
123
+ fi
124
+
125
+ if [[ "${LINUX_5_10_ENABLED}" == "true" ]]; then
126
+ linux_matrix=$(echo "$linux_matrix" | jq '.swift[.swift| length] |= . + { "image": "${{ inputs.matrix_linux_5_10_container_image }}", "swift_version": "5.10" }')
127
+ fi
128
+
129
+ if [[ "${LINUX_6_0_ENABLED}" == "true" ]]; then
130
+ linux_matrix=$(echo "$linux_matrix" | jq '.swift[.swift| length] |= . + { "image": "${{ inputs.matrix_linux_6_0_container_image }}", "swift_version": "6.0" }')
131
+ fi
132
+
133
+ if [[ "${LINUX_NIGHTLY_6_0_ENABLED}" == "true" ]]; then
134
+ linux_matrix=$(echo "$linux_matrix" | jq '.swift[.swift| length] |= . + { "image": "${{ inputs.matrix_linux_nightly_6_0_container_image }}", "swift_version": "nightly-6.0" }')
135
+ fi
136
+
137
+ if [[ "${LINUX_NIGHTLY_MAIN_ENABLED}" == "true" ]]; then
138
+ linux_matrix=$(echo "$linux_matrix" | jq '.swift[.swift| length] |= . + { "image": "${{ inputs.matrix_linux_nightly_main_container_image }}", "swift_version": "nightly-main" }')
139
+ fi
140
+
141
+ {
142
+ echo 'linux-matrix<<EOF'
143
+ echo $linux_matrix
144
+ echo EOF
145
+ } >> "$GITHUB_OUTPUT"
146
+
147
+ windows_matrix='{"swift": []}'
148
+ if [[ "${WINDOWS_6_0_ENABLED}" == "true" ]]; then
149
+ windows_matrix=$(echo "$windows_matrix" | jq '.swift[.swift| length] |= . + { "image": "swift:6.0-windowsservercore-ltsc2022", "swift_version": "6.0" }')
150
+ fi
151
+
152
+ {
153
+ echo 'windows-matrix<<EOF'
154
+ echo $windows_matrix
155
+ echo EOF
156
+ } >> "$GITHUB_OUTPUT"
157
+
158
+ windows_nightly_matrix='{"swift": []}'
159
+ if [[ "${WINDOWS_NIGHTLY_6_0_ENABLED}" == "true" ]]; then
160
+ windows_nightly_matrix=$(echo "$windows_nightly_matrix" | jq '.swift[.swift| length] |= . + { "image": "swiftlang/swift:nightly-6.0-windowsservercore-1809", "swift_version": "nightly-6.0" }')
161
+ fi
162
+
163
+ if [[ "${WINDOWS_NIGHTLY_MAIN_ENABLED}" == "true" ]]; then
164
+ windows_nightly_matrix=$(echo "$windows_nightly_matrix" | jq '.swift[.swift| length] |= . + { "image": "swiftlang/swift:nightly-main-windowsservercore-1809", "swift_version": "nightly-main" }')
165
+ fi
166
+
167
+ {
168
+ echo 'windows-nightly-matrix<<EOF'
169
+ echo $windows_nightly_matrix
170
+ echo EOF
171
+ } >> "$GITHUB_OUTPUT"
172
+ - name : Echo matrix configuration
173
+ run : |
174
+ echo "${{ steps.set-matrix.outputs.linux-matrix }}"
175
+ echo "${{ steps.set-matrix.outputs.windows-matrix }}"
176
+ echo "${{ steps.set-matrix.outputs.windows-nightly-matrix }}"
177
+
102
178
linux :
103
179
name : Linux (${{ matrix.swift.swift_version }})
180
+ needs : generate-matrix
104
181
runs-on : ubuntu-latest
105
182
strategy :
106
183
fail-fast : false
107
- matrix :
108
- # We are specifying only the major and minor of the docker images to automatically pick up the latest patch release
109
- swift :
110
- - image : ${{ inputs.matrix_linux_5_9_container_image }}
111
- swift_version : " 5.9"
112
- enabled : ${{ inputs.matrix_linux_5_9_enabled }}
113
- - image : ${{ inputs.matrix_linux_5_10_container_image }}
114
- swift_version : " 5.10"
115
- enabled : ${{ inputs.matrix_linux_5_10_enabled }}
116
- - image : ${{ inputs.matrix_linux_6_0_container_image }}
117
- swift_version : " 6.0"
118
- enabled : ${{ inputs.matrix_linux_6_0_enabled }}
119
- - image : ${{ inputs.matrix_linux_nightly_6_0_container_image }}
120
- swift_version : " nightly-6.0"
121
- enabled : ${{ inputs.matrix_linux_nightly_6_0_enabled }}
122
- - image : ${{ inputs.matrix_linux_nightly_main_container_image }}
123
- swift_version : " nightly-main"
124
- enabled : ${{ inputs.matrix_linux_nightly_main_enabled }}
184
+ matrix : ${{fromJson(needs.generate-matrix.outputs.windows-matrix)}}
125
185
container :
126
186
image : ${{ matrix.swift.image }}
127
187
steps :
@@ -150,59 +210,40 @@ jobs:
150
210
151
211
windows :
152
212
name : Windows (${{ matrix.swift.swift_version }})
213
+ needs : generate-matrix
153
214
runs-on : windows-2022
154
215
strategy :
155
216
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 }}
217
+ matrix : ${{fromJson(needs.generate-matrix.outputs.windows-matrix)}}
162
218
steps :
163
219
- name : Pull Docker image
164
- if : ${{ matrix.swift.enabled }}
165
220
run : docker pull ${{ matrix.swift.image }}
166
221
- name : Checkout repository
167
- if : ${{ matrix.swift.enabled }}
168
222
uses : actions/checkout@v4
169
223
with :
170
224
persist-credentials : false
171
225
- name : Donwload matrix script
172
- if : ${{ matrix.swift.enabled }}
173
226
run : curl -s https://raw.githubusercontent.com/apple/swift-nio/main/scripts/check-matrix-job.ps1 -o __check-matrix-job.ps1
174
227
- name : Run matrix job
175
- if : ${{ matrix.swift.enabled }}
176
228
run : |
177
229
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
230
179
231
windows-nightly :
180
232
name : Windows (${{ matrix.swift.swift_version }})
233
+ needs : generate-matrix
181
234
runs-on : windows-2019
182
235
strategy :
183
236
fail-fast : false
184
- matrix :
185
- # We are specifying only the major and minor of the docker images to automatically pick up the latest patch release
186
- swift :
187
- - image : swiftlang/swift:nightly-6.0-windowsservercore-1809
188
- swift_version : " nightly-6.0"
189
- enabled : ${{ inputs.matrix_windows_nightly_6_0_enabled }}
190
- - image : swiftlang/swift:nightly-main-windowsservercore-1809
191
- swift_version : " nightly-main"
192
- enabled : ${{ inputs.matrix_windows_nightly_main_enabled }}
237
+ matrix : ${{fromJson(needs.generate-matrix.outputs.windows-nightly-matrix)}}
193
238
steps :
194
239
- name : Pull Docker image
195
- if : ${{ matrix.swift.enabled }}
196
240
run : docker pull ${{ matrix.swift.image }}
197
241
- name : Checkout repository
198
- if : ${{ matrix.swift.enabled }}
199
242
uses : actions/checkout@v4
200
243
with :
201
244
persist-credentials : false
202
245
- name : Donwload matrix script
203
- if : ${{ matrix.swift.enabled }}
204
246
run : curl -s https://raw.githubusercontent.com/apple/swift-nio/main/scripts/check-matrix-job.ps1 -o __check-matrix-job.ps1
205
247
- name : Run matrix job
206
- if : ${{ matrix.swift.enabled }}
207
248
run : |
208
249
docker run --env SWIFT_VERSION="${{ matrix.swift.swift_version }}" --env COMMAND="${{ inputs.matrix_windows_command }}" --env COMMAND_OVERRIDE_NIGHTLY_6_0="${{ inputs.matrix_windows_nightly_6_0_command_override }}" --env COMMAND_OVERRIDE_NIGHTLY_MAIN="${{ inputs.matrix_windows_nightly_main_command_override }}" -v ${{ github.workspace }}:C:\source ${{ matrix.swift.image }} cmd /s /c "swift --version & cd C:\source\ & powershell -File __check-matrix-job.ps1"
0 commit comments