aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2019-12-11 06:27:28 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2019-12-11 06:27:28 +0300
commitb7a126438c6e080cce6fe490c979a3e65a62ed33 (patch)
tree9e4f0a4b4d2d9d56849f41ded932353cb2788849
parentAppVeyor: don't preserve Set-PSDebug (diff)
downloadwindows-env-b7a126438c6e080cce6fe490c979a3e65a62ed33.tar.gz
windows-env-b7a126438c6e080cce6fe490c979a3e65a62ed33.zip
AppVeyor: ditch PowerShell
-rw-r--r--.appveyor/.gitattributes1
-rw-r--r--.appveyor/build.ps184
-rw-r--r--appveyor.yml9
3 files changed, 8 insertions, 86 deletions
diff --git a/.appveyor/.gitattributes b/.appveyor/.gitattributes
deleted file mode 100644
index b086bda..0000000
--- a/.appveyor/.gitattributes
+++ /dev/null
@@ -1 +0,0 @@
-*.ps1 text eol=crlf
diff --git a/.appveyor/build.ps1 b/.appveyor/build.ps1
deleted file mode 100644
index 62e5082..0000000
--- a/.appveyor/build.ps1
+++ /dev/null
@@ -1,84 +0,0 @@
-param(
- [string] $Platform = $null
-)
-
-$ErrorActionPreference = "Stop";
-Set-PSDebug -Strict
-
-function Invoke-Exe {
- param(
- [ScriptBlock] $Cmd,
- [int[]] $AllowedExitCodes = @(0)
- )
-
- $backupErrorActionPreference = $script:ErrorActionPreference
- $script:ErrorActionPreference = 'Continue'
-
- try {
- & $Cmd
- if ($AllowedExitCodes -notcontains $LastExitCode) {
- throw "External command failed with exit code ${LastExitCode}: $Cmd"
- }
- } finally {
- $script:ErrorActionPreference = $backupErrorActionPreference
- }
-}
-
-function Test-AppVeyor {
- return Test-Path env:APPVEYOR
-}
-
-function Set-AppVeyorDefaults {
- $script:Platform = $env:PLATFORM
-}
-
-function Get-StackUrl {
- param(
- [string] $Platform = $env:PLATFORM
- )
-
- if ($Platform -eq 'x86_64') {
- return 'https://get.haskellstack.org/stable/windows-x86_64.zip'
- } else {
- return 'https://get.haskellstack.org/stable/windows-i386.zip'
- }
-}
-
-function Install-Stack {
- param(
- [Parameter(Mandatory=$true)]
- [string] $Platform
- )
-
- Invoke-Exe { curl.exe --silent --show-error --output C:\stack.zip --location --insecure -- $(Get-StackUrl -Platform $Platform) }
- Invoke-Exe { 7z.exe x -oC:\sr C:\stack.zip }
- $env:STACK_ROOT = 'C:\sr'
-}
-
-function Build-Project {
- param(
- [Parameter(Mandatory=$true)]
- [string] $Platform
- )
-
- Invoke-Exe { C:\sr\stack.exe build --install-ghc --arch $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
- Set-PSDebug -Off
- }
- }
-}
-
-Build-ProjectAppVeyor
diff --git a/appveyor.yml b/appveyor.yml
index 930b997..f8dfc42 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -1,8 +1,15 @@
version: '{build}'
+environment:
+ STACK_ROOT: C:\sr
+
platform:
- i386
- x86_64
+before_build:
+ - curl.exe --silent --show-error --output C:\stack.zip --location --insecure -- "https://get.haskellstack.org/stable/windows-%PLATFORM%.zip"
+ - 7z.exe x "-o%STACK_ROOT%" C:\stack.zip
+
build_script:
- - ps: .\.appveyor\build.ps1
+ - '"%STACK_ROOT%\stack.exe" build --install-ghc --arch "%PLATFORM%"'