Skip to content

Commit 4c825b3

Browse files
authored
Merge pull request #9938 from akhilerm/cherry-pick-9777-1.7
[release/1.7] Move inline PS scripts into files
2 parents 5613fae + 39caf53 commit 4c825b3

3 files changed

Lines changed: 48 additions & 47 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -249,57 +249,12 @@ jobs:
249249
- name: Upgrade Chocolaty on Windows 2019
250250
if: matrix.os == 'windows-2019'
251251
shell: powershell
252-
run: |
253-
Write-Output '::group::Update chocolaty'
254-
choco upgrade -y chocolatey
255-
Write-Output '::endgroup::'
256-
257-
if ( $LASTEXITCODE ) {
258-
Write-Output '::error::Could not update chocolatey.'
259-
exit $LASTEXITCODE
260-
}
252+
run: .\script\setup\upgrade_chocolaty_windows_2019.ps1
261253

262254
- name: Upgrade MinGW on Windows 2019
263255
if: matrix.os == 'windows-2019'
264256
shell: powershell
265-
run: |
266-
# Add retry and backoff
267-
foreach ( $i in 1..3 ) {
268-
Write-Output "::group::Attempt $i"
269-
if ( $i -gt 1 ) {
270-
# remove any left-over state
271-
choco uninstall -y --no-progress --force mingw
272-
273-
Write-Output 'Sleeping for 60 seconds'
274-
Sleep -Seconds 60
275-
}
276-
277-
Write-Output 'manually force remove C:\mingw64'
278-
Remove-Item -Path "C:\mingw64" -Recurse -Force -ErrorAction Ignore
279-
280-
choco install -y --no-progress --stop-on-first-failure --force mingw --allow-downgrade --version 12.2.0.3042023
281-
Write-Output '::endgroup::'
282-
if ( -not $LASTEXITCODE ) {
283-
Write-Output "Attempt $i succeeded (exit code: $LASTEXITCODE)"
284-
break
285-
}
286-
Write-Output "::warning title=mingw::Attempt $i failed (exit code: $LASTEXITCODE)"
287-
}
288-
289-
if ( $LASTEXITCODE ) {
290-
Write-Output "::error::Could not install mingw after $i attempts."
291-
exit $LASTEXITCODE
292-
}
293-
294-
# Copy to default path
295-
Copy-Item -Path "C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64" -Destination "C:\mingw64" -Recurse -Force
296-
297-
# Copy as make.exe
298-
$path = "C:\mingw64\bin\mingw32-make.exe" | Get-Item
299-
Copy-Item -Path $path.FullName -Destination (Join-Path $path.Directory.FullName 'make.exe') -Force
300-
301-
# verify mingw32-make was installed
302-
Get-Command -CommandType Application -ErrorAction Stop mingw32-make.exe
257+
run: .\script\setup\upgrade_mingw_windows_2019.ps1
303258

304259
- name: Binaries
305260
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)