Skip to content

Commit 886795d

Browse files
authored
Merge pull request containerd#9777 from mxpv/ci
[CI] Move inline PS scripts into files
2 parents de14037 + 32bd8ef commit 886795d

File tree

3 files changed

+48
-47
lines changed

3 files changed

+48
-47
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -272,57 +272,12 @@ jobs:
272272
- name: Upgrade Chocolaty on Windows 2019
273273
if: matrix.os == 'windows-2019'
274274
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-
}
275+
run: .\script\setup\upgrade_chocolaty_windows_2019.ps1
284276

285277
- name: Upgrade MinGW on Windows 2019
286278
if: matrix.os == 'windows-2019'
287279
shell: powershell
288-
run: |
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
280+
run: .\script\setup\upgrade_mingw_windows_2019.ps1
326281

327282
- name: Binaries
328283
shell: bash
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Write-Output '::group::Update chocolaty'
2+
choco upgrade -y chocolatey
3+
Write-Output '::endgroup::'
4+
5+
if ( $LASTEXITCODE ) {
6+
Write-Output '::error::Could not update chocolatey.'
7+
exit $LASTEXITCODE
8+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Add retry and backoff
2+
foreach ( $i in 1..3 ) {
3+
Write-Output "::group::Attempt $i"
4+
if ( $i -gt 1 ) {
5+
# remove any left-over state
6+
choco uninstall -y --no-progress --force mingw
7+
8+
Write-Output 'Sleeping for 60 seconds'
9+
Sleep -Seconds 60
10+
}
11+
12+
Write-Output 'manually force remove C:\mingw64'
13+
Remove-Item -Path "C:\mingw64" -Recurse -Force -ErrorAction Ignore
14+
15+
choco install -y --no-progress --stop-on-first-failure --force mingw --allow-downgrade --version 12.2.0.3042023
16+
Write-Output '::endgroup::'
17+
if ( -not $LASTEXITCODE ) {
18+
Write-Output "Attempt $i succeeded (exit code: $LASTEXITCODE)"
19+
break
20+
}
21+
22+
Write-Output "::warning title=mingw::Attempt $i failed (exit code: $LASTEXITCODE)"
23+
}
24+
25+
if ( $LASTEXITCODE ) {
26+
Write-Output "::error::Could not install mingw after $i attempts."
27+
exit $LASTEXITCODE
28+
}
29+
30+
# Copy to default path
31+
Copy-Item -Path "C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64" -Destination "C:\mingw64" -Recurse -Force
32+
33+
# Copy as make.exe
34+
$path = "C:\mingw64\bin\mingw32-make.exe" | Get-Item
35+
Copy-Item -Path $path.FullName -Destination (Join-Path $path.Directory.FullName 'make.exe') -Force
36+
37+
# verify mingw32-make was installed
38+
Get-Command -CommandType Application -ErrorAction Stop mingw32-make.exe

0 commit comments

Comments
 (0)