@@ -218,13 +218,6 @@ jobs:
218
218
219
219
- uses : actions/checkout@v4
220
220
221
- # NOTE(aznashwan): starting with Golang 1.21, the windows-2019 GitHub runner's
222
- # builtin MinGW version leads to DLL loading errors during runtime.
223
- - name : Upgrade MinGW on Windows 2019
224
- if : matrix.os == 'windows-2019'
225
- run : |
226
- choco upgrade mingw --version=12.2.0.3042023
227
-
228
221
- name : Make
229
222
run : |
230
223
make build
@@ -244,7 +237,7 @@ jobs:
244
237
strategy :
245
238
fail-fast : false
246
239
matrix :
247
- os : [windows-2022] # windows-2019 is temporarily removed until mingw issue fixed
240
+ os : [windows-2022, windows-2019]
248
241
249
242
defaults :
250
243
run :
@@ -275,14 +268,64 @@ jobs:
275
268
276
269
- run : script/setup/install-dev-tools
277
270
278
- # NOTE(aznashwan): starting with Golang 1.21, the windows-2019 GitHub runner's
279
- # builtin MinGW version leads to DLL loading errors during runtime.
271
+ # needs to be a separate step since terminal reload is required to bring in new env variables and PATH
272
+ - name : Upgrade Chocolaty on Windows 2019
273
+ if : matrix.os == 'windows-2019'
274
+ shell : powershell
275
+ run : |
276
+ Write-Output '::group::Update chocolaty'
277
+ choco upgrade -y chocolatey
278
+ Write-Output '::endgroup::'
279
+
280
+ if ( $LASTEXITCODE ) {
281
+ Write-Output '::error::Could not update chocolatey.'
282
+ exit $LASTEXITCODE
283
+ }
284
+
280
285
- name : Upgrade MinGW on Windows 2019
281
286
if : matrix.os == 'windows-2019'
287
+ shell : powershell
282
288
run : |
283
- choco upgrade mingw --version=12.2.0.3042023
289
+ # Add retry and backoff
290
+ foreach ( $i in 1..3 ) {
291
+ Write-Output "::group::Attempt $i"
292
+ if ( $i -gt 1 ) {
293
+ # remove any left-over state
294
+ choco uninstall -y --no-progress --force mingw
295
+
296
+ Write-Output 'Sleeping for 60 seconds'
297
+ Sleep -Seconds 60
298
+ }
299
+
300
+ Write-Output 'manually force remove C:\mingw64'
301
+ Remove-Item -Path "C:\mingw64" -Recurse -Force -ErrorAction Ignore
302
+
303
+ choco install -y --no-progress --stop-on-first-failure --force mingw --allow-downgrade --version 12.2.0.3042023
304
+ Write-Output '::endgroup::'
305
+ if ( -not $LASTEXITCODE ) {
306
+ Write-Output "Attempt $i succeeded (exit code: $LASTEXITCODE)"
307
+ break
308
+ }
309
+ Write-Output "::warning title=mingw::Attempt $i failed (exit code: $LASTEXITCODE)"
310
+ }
311
+
312
+ if ( $LASTEXITCODE ) {
313
+ Write-Output "::error::Could not install mingw after $i attempts."
314
+ exit $LASTEXITCODE
315
+ }
316
+
317
+ # Copy to default path
318
+ Copy-Item -Path "C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64" -Destination "C:\mingw64" -Recurse -Force
319
+
320
+ # Copy as make.exe
321
+ $path = "C:\mingw64\bin\mingw32-make.exe" | Get-Item
322
+ Copy-Item -Path $path.FullName -Destination (Join-Path $path.Directory.FullName 'make.exe') -Force
323
+
324
+ # verify mingw32-make was installed
325
+ Get-Command -CommandType Application -ErrorAction Stop mingw32-make.exe
284
326
285
327
- name : Binaries
328
+ shell : bash
286
329
env :
287
330
CGO_ENABLED : 1
288
331
run : |
0 commit comments