Rescue stack windows build (#954)

* Revert "Drop stack Windows CI"

This reverts commit 919d3bce57.

* Fix stack Windows build

I finally figured this puzzle out
This commit is contained in:
Pepe Iborra 2020-12-15 17:09:59 +00:00 committed by GitHub
parent d702ca9404
commit d8244b7917
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 51 additions and 3 deletions

41
.azure/windows-stack.yml Normal file
View File

@ -0,0 +1,41 @@
jobs:
- job: ghcide_stack_windows
timeoutInMinutes: 120
pool:
vmImage: 'windows-2019'
variables:
STACK_ROOT: "C:\\sr"
steps:
- checkout: self
- task: Cache@2
inputs:
key: stack-root-cache | $(Agent.OS) | $(Build.SourcesDirectory)/stack-windows.yaml | $(Build.SourcesDirectory)/ghcide.cabal
path: $(STACK_ROOT)
cacheHitVar: STACK_ROOT_CACHE_RESTORED
displayName: "Cache stack root"
- task: Cache@2
inputs:
key: stack-work-cache | $(Agent.OS) | $(Build.SourcesDirectory)/stack-windows.yaml | $(Build.SourcesDirectory)/ghcide.cabal
path: .stack-work
cacheHitVar: STACK_WORK_CACHE_RESTORED
displayName: "Cache stack work"
- bash: |
./fmt.sh
displayName: "HLint via ./fmt.sh"
- bash: |
curl -sSkL http://www.stackage.org/stack/windows-x86_64 -o /usr/bin/stack.zip
unzip -o /usr/bin/stack.zip -d /usr/bin/
mkdir -p "$STACK_ROOT"
displayName: 'Install Stack'
- bash: stack setup --stack-yaml stack-windows.yaml
displayName: 'stack setup'
- bash: |
# Installing happy and alex standalone to avoid error "strip.exe: unable to rename ../*.exe; reason: File exists"
stack install happy --stack-yaml stack-windows.yaml
stack install alex --stack-yaml stack-windows.yaml
choco install -y cabal --version=$CABAL_VERSION
$(cygpath $ProgramData)/chocolatey/bin/RefreshEnv.cmd
# GHC 8.10.1 fails with ghc segfaults, using -fexternal-interpreter seems to make it working
# There are other transient errors like timeouts downloading from stackage so we retry 3 times
stack build --test --no-run-tests --stack-yaml stack-windows.yaml --ghc-options="-fexternal-interpreter" || stack build --test --no-run-tests --stack-yaml stack-windows.yaml --ghc-options="-fexternal-interpreter" || stack build --test --no-run-tests --stack-yaml stack-windows.yaml --ghc-options="-fexternal-interpreter"
displayName: 'stack build --test'

View File

@ -15,3 +15,4 @@ pr:
jobs:
- template: ./.azure/linux-stack.yml
- template: ./.azure/windows-stack.yml

View File

@ -37,10 +37,11 @@ nix:
packages: [zlib]
configure-options:
ghcide:
- --disable-library-for-ghci
heapsize:
- --disable-library-for-ghci
- --disable-library-stripping
# Otherwise the ghcide will fail with:
# Otherwise the ghcide build will fail with:
# ```
# ghcide > ghc.exe: unable to load package `heapsize-0.2'
# ghcide > ghc-iserv: | D:\a\1\s\.stack-work\install\52d658b2\lib\x86_64-windows-ghc-8.10.1\heapsize-0.2-KCPoGpPDcevACNftTTY2at\HSheapsize-0.2-KCPoGpPDcevACNftTTY2at.o: unknown symbol `heap_view_closurePtrs'
@ -48,7 +49,12 @@ configure-options:
# Cause:
# The pre-linked object file is missing the heapsize_prim.o symbols table (from the cbits object)
#
# Reason: The ld invocation is stripping too much
# Reason: Not sure, maybe the ld invocation is stripping too much
#
# Fix: do not generate the pre-linked object to prevent ghc from using it at link time.
# There are two instances where this must be prevented:
# 1. When linking the ghcide library (using the heapsize pre-linked object)
# 2. When linking the ghcide executable (using the ghcide pre-linked object)
#
# Quoting https://downloads.haskell.org/ghc/latest/docs/html/users_guide/packages.html
#