aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2019-08-22 11:26:19 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2019-08-22 14:37:16 +0300
commit613e511cb26c4c98acc90dba7181df4f24e4c919 (patch)
tree0a1c76401e077d656fbad34e97169e52ce6eb25f
parentfix eol (diff)
downloadwindows-env-613e511cb26c4c98acc90dba7181df4f24e4c919.tar.gz
windows-env-613e511cb26c4c98acc90dba7181df4f24e4c919.zip
AppVeyor: better practices
Diffstat (limited to '')
-rw-r--r--.appveyor/build.ps132
1 files changed, 21 insertions, 11 deletions
diff --git a/.appveyor/build.ps1 b/.appveyor/build.ps1
index 80477a7..54a4516 100644
--- a/.appveyor/build.ps1
+++ b/.appveyor/build.ps1
@@ -3,6 +3,7 @@ param(
)
$ErrorActionPreference = "Stop";
+Set-PSDebug -Strict
function Invoke-Exe {
param(
@@ -27,10 +28,13 @@ function Test-AppVeyor {
return Test-Path env:APPVEYOR
}
+function Set-AppVeyorDefaults {
+ $script:Platform = $env:PLATFORM
+}
+
function Get-StackUrl {
param(
- [Parameter(Mandatory=$true)]
- [string] $Platform
+ [string] $Platform = $env:PLATFORM
)
if ($Platform -eq 'x86_64') {
@@ -60,14 +64,20 @@ function Build-Project {
Invoke-Exe { C:\sr\stack.exe build --install-ghc --arch $Platform }
}
-if (Test-AppVeyor) {
- $cwd = pwd
- $Platform = $env:PLATFORM
+function Build-ProjectAppVeyor {
+ if (Test-AppVeyor) {
+ Set-AppVeyorDefaults
+ $appveyor_cwd = pwd
+ }
+
+ try {
+ Install-Stack -Platform $script:Platform
+ Build-Project -Platform $script:Platform
+ } finally {
+ if (Test-AppVeyor) {
+ cd $appveyor_cwd
+ }
+ }
}
-Install-Stack -Platform $Platform
-Build-Project -Platform $Platform
-
-if (Test-AppVeyor) {
- cd $cwd
-}
+Build-ProjectAppVeyor