azure: replace mingw setup with bash We're about to phase out our Powershell scripts as Azure Pipelines does in fact support Bash scripts on all platforms. As a preparatory step, let's replace our MinGW setup script with a Bash script.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
index 7f491e0..98e8097 100644
--- a/azure-pipelines.yml
+++ b/azure-pipelines.yml
@@ -91,7 +91,7 @@ jobs:
displayName: 'Windows (amd64; MinGW)'
pool: Hosted
steps:
- - powershell: . '$(Build.SourcesDirectory)\azure-pipelines\setup-mingw.ps1'
+ - bash: . '$(Build.SourcesDirectory)\azure-pipelines\setup-mingw.sh'
displayName: Setup
env:
TEMP: $(Agent.TempDirectory)
@@ -106,7 +106,7 @@ jobs:
displayName: 'Windows (x86; MinGW)'
pool: Hosted
steps:
- - powershell: . '$(Build.SourcesDirectory)\azure-pipelines\setup-mingw.ps1'
+ - bash: . '$(Build.SourcesDirectory)\azure-pipelines\setup-mingw.sh'
displayName: Setup
workingDirectory: '$(Build.BinariesDirectory)'
env:
diff --git a/azure-pipelines/nightly.yml b/azure-pipelines/nightly.yml
index 78e93f6..c494037 100644
--- a/azure-pipelines/nightly.yml
+++ b/azure-pipelines/nightly.yml
@@ -94,7 +94,7 @@ jobs:
displayName: 'Windows (amd64; MinGW)'
pool: Hosted
steps:
- - powershell: . '$(Build.SourcesDirectory)\azure-pipelines\setup-mingw.ps1'
+ - bash: . '$(Build.SourcesDirectory)\azure-pipelines\setup-mingw.sh'
displayName: Setup
env:
TEMP: $(Agent.TempDirectory)
@@ -110,7 +110,7 @@ jobs:
displayName: 'Windows (x86; MinGW)'
pool: Hosted
steps:
- - powershell: . '$(Build.SourcesDirectory)\azure-pipelines\setup-mingw.ps1'
+ - bash: . '$(Build.SourcesDirectory)\azure-pipelines\setup-mingw.sh'
displayName: Setup
workingDirectory: '$(Build.BinariesDirectory)'
env:
diff --git a/azure-pipelines/setup-mingw.ps1 b/azure-pipelines/setup-mingw.ps1
deleted file mode 100644
index 76ecd39..0000000
--- a/azure-pipelines/setup-mingw.ps1
+++ /dev/null
@@ -1,25 +0,0 @@
-Set-StrictMode -Version Latest
-
-$ErrorActionPreference = "Stop"
-$PSDefaultParameterValues['*:ErrorAction'] = 'Stop'
-
-[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
-
-[Reflection.Assembly]::LoadWithPartialName("System.IO.Compression.FileSystem");
-
-Write-Host "##############################################################################"
-Write-Host "## Downloading mingw"
-Write-Host "##############################################################################"
-
-if ($env:ARCH -eq "amd64") {
- $mingw_uri = "https://bintray.com/libgit2/build-dependencies/download_file?file_path=mingw-w64-x86_64-8.1.0-release-win32-seh-rt_v6-rev0.zip"
- $platform = "x86_64"
-} else {
- $mingw_uri = "https://bintray.com/libgit2/build-dependencies/download_file?file_path=mingw-w64-i686-8.1.0-release-win32-sjlj-rt_v6-rev0.zip"
- $platform = "x86"
-}
-
-$wc = New-Object net.webclient
-$wc.Downloadfile($mingw_uri, "${Env:TEMP}/mingw-${Env:ARCH}.zip")
-
-[System.IO.Compression.ZipFile]::ExtractToDirectory("${Env:TEMP}/mingw-${Env:ARCH}.zip", $Env:TEMP)
diff --git a/azure-pipelines/setup-mingw.sh b/azure-pipelines/setup-mingw.sh
new file mode 100755
index 0000000..1172c20
--- /dev/null
+++ b/azure-pipelines/setup-mingw.sh
@@ -0,0 +1,15 @@
+#!/bin/sh -e
+
+echo "##############################################################################"
+echo "## Downloading mingw"
+echo "##############################################################################"
+
+case "$ARCH" in
+ amd64)
+ MINGW_URI="https://bintray.com/libgit2/build-dependencies/download_file?file_path=mingw-w64-x86_64-8.1.0-release-win32-seh-rt_v6-rev0.zip";;
+ x86)
+ MINGW_URI="https://bintray.com/libgit2/build-dependencies/download_file?file_path=mingw-w64-i686-8.1.0-release-win32-sjlj-rt_v6-rev0.zip";;
+esac
+
+curl -s -L "$MINGW_URI" -o "$TEMP"/mingw-"$ARCH".zip
+unzip -q "$TEMP"/mingw-"$ARCH".zip -d "$TEMP"