Add windows+cabal job and improvements

This commit is contained in:
jneira 2020-01-23 13:43:56 +01:00
parent 93d3574070
commit 1fef5ebeb0
12 changed files with 354 additions and 85 deletions

View File

@ -5,16 +5,22 @@ jobs:
vmImage: ubuntu-16.04
strategy:
matrix:
# Fail with compilation error building haddock-api
# ghc-8.8.2:
# GHC_VERSION: "8.8.2"
ghc-8.8.1:
GHC_VERSION: "8.8.1"
ghc-8.6.5:
GHC_VERSION: "8.6.5"
ghc-8.4.4:
GHC_VERSION: "8.4.4"
variables:
CABAL_VERSION: "3.0"
LIQUID_VERSION: "0.8.6.2"
steps:
- task: Cache@2
inputs:
key: '"cabal-store" | "$(Agent.OS)" | "$(CABAL_VERSION)" | "$(GHC_VERSION)" | $(Build.SourcesDirectory)/cabal.project | $(Build.SourcesDirectory)/haskell-ide-engine.cabal | $(Build.SourcesDirectory)/hie-plugin-api/hie-plugin-api.cabal'
key: '"cabal" | "$(Agent.OS)" | "$(CABAL_VERSION)" | "$(GHC_VERSION)" | $(Build.SourcesDirectory)/cabal.project | $(Build.SourcesDirectory)/haskell-ide-engine.cabal | $(Build.SourcesDirectory)/hie-plugin-api/hie-plugin-api.cabal'
path: .azure-cache
cacheHitVar: CACHE_RESTORED
displayName: "Download cache"
@ -23,7 +29,7 @@ jobs:
tar -vxzf .azure-cache/cabal-root.tar.gz -C /
mkdir -p $HOME/.ghc
tar -vxzf .azure-cache/ghc-root.tar.gz -C /
mkdir -p dist-newtyle
mkdir -p dist-newstyle
tar -vxzf .azure-cache/cabal-dist.tar.gz
displayName: "Unpack cache"
condition: eq(variables.CACHE_RESTORED, 'true')
@ -31,18 +37,26 @@ jobs:
git submodule sync
git submodule update --init
displayName: Sync submodules
- bash: |
# To install ghc if they are not yet included in the agent image
ghc --version || (sudo apt-get update && sudo apt-get install -y ghc-$GHC_VERSION)
displayName: Install ghc
- bash: |
source .azure/linux-cabal.bashrc
cabal v2-update
cabal v2-build --only-dependencies
echo "overwrite-policy: always" >> $HOME/.cabal/config
displayName: Update cabal
- bash: |
source .azure/linux-cabal.bashrc
cabal v2-build --disable-tests --disable-benchmarks --only-dependencies
displayName: Build dependencies
- bash: |
source .azure/linux-cabal.bashrc
cabal v2-build
cabal v2-build --disable-tests --disable-benchmarks
displayName: Build `hie`
- bash: |
source .azure/linux-cabal.bashrc
cabal v2-install --overwrite-policy=always # `hie` binary required locally for tests
cabal v2-install # `hie` binary required locally for tests
displayName: Install `hie`
- bash: |
source .azure/linux-cabal.bashrc
@ -54,9 +68,8 @@ jobs:
displayName: "Install Runtime Test-Dependencies: z3"
- bash: |
source .azure/linux-cabal.bashrc
# to not reinstall hie
cd $(Agent.TempDirectory)
cabal v2-install liquidhaskell-0.8.6.2 -w /opt/ghc/8.6.5/bin/ghc --overwrite-policy=always
cabal v2-install liquidhaskell-$LIQUID_VERSION -w /opt/ghc/8.6.5/bin/ghc
displayName: "Install Runtime Test-Dependencies: liquidhaskell"
- bash: |
source .azure/linux-cabal.bashrc
@ -65,9 +78,16 @@ jobs:
displayName: "Install Runtime Test-Dependencies: hoogle database"
- bash: |
source .azure/linux-cabal.bashrc
# TODO: Investigate why the test suite can't be run in parallel
cabal v2-test -j1
displayName: Run Test
cabal v2-test :unit-test
displayName: "Run Test: unit-test"
- bash: |
source .azure/linux-cabal.bashrc
cabal v2-test :dispatcher-test :plugin-dispatcher-test :wrapper-test
displayName: "Run Test: dispatcher-test, plugin-dispatcher-test and wrapper-test"
- bash: |
source .azure/linux-cabal.bashrc
cabal v2-test :func-test
displayName: "Run Test: func-test"
- bash: |
mkdir -p .azure-cache
tar -vczf .azure-cache/cabal-root.tar.gz $HOME/.cabal

View File

@ -6,6 +6,21 @@ jobs:
variables:
YAML_FILE: install/shake.yaml
steps:
- task: Cache@2
inputs:
key: '"stack" | "$(Agent.OS)" | $(Build.SourcesDirectory)/$(YAML_FILE) | $(Build.SourcesDirectory)/install/shake.yaml'
path: .azure-cache
cacheHitVar: CACHE_RESTORED
displayName: "Cache stack-root"
- bash: |
mkdir -p $STACK_ROOT
tar -vxzf .azure-cache/stack-root.tar.gz -C /
mkdir -p .stack-work
tar -vxzf .azure-cache/stack-work.tar.gz
mkdir -p ./install/.stack-work
tar -vxzf .azure-cache/install-stack-work.tar.gz
displayName: "Unpack cache"
condition: eq(variables.CACHE_RESTORED, 'true')
- bash: |
export STACK_ROOT="$(Build.SourcesDirectory)"/.stack-root
mkdir -p ~/.local/bin
@ -13,22 +28,28 @@ jobs:
tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'
displayName: Install stack
- bash: |
source .azure/linux.bashrc
source .azure/linux-stack.bashrc
stack setup --stack-yaml $(YAML_FILE)
displayName: Install GHC
- bash: |
source .azure/linux.bashrc
source .azure/linux-stack.bashrc
stack --stack-yaml $(YAML_FILE) --install-ghc build --only-dependencies
displayName: Build dependencies
- bash: |
source .azure/linux.bashrc
source .azure/linux-stack.bashrc
stack build --stack-yaml $(YAML_FILE)
displayName: Build `hie-install`
- bash: |
source .azure/linux.bashrc
source .azure/linux-stack.bashrc
stack install.hs help
displayName: Run help of `install.hs`
- bash: |
source .azure/linux.bashrc
source .azure/linux-stack.bashrc
stack install.hs latest
displayName: Run latest target of `install.hs`
- bash: |
mkdir -p .azure-cache
tar -vczf .azure-cache/stack-root.tar.gz $(cygpath $STACK_ROOT)
tar -vczf .azure-cache/stack-work.tar.gz .stack-work
tar -vczf .azure-cache/install-stack-work.tar.gz ./install/.stack-work
displayName: "Pack cache"

View File

@ -21,6 +21,7 @@ jobs:
YAML_FILE: stack-8.4.2.yaml
variables:
STACK_ROOT: /home/vsts/.stack
CABAL_VERSION: "3.0"
steps:
- task: Cache@2
inputs:
@ -62,9 +63,9 @@ jobs:
stack install --stack-yaml $(YAML_FILE) --local-bin-path .azure-deploy
cd .azure-deploy
if [ $YAML_FILE != "stack.yaml" ]; then
GHC_MINOR_VERSION=${YAML_FILE:6:5}
GHC_VERSION=${YAML_FILE:6:5}
GHC_MAJOR_VERSION=${YAML_FILE:6:3}
cp hie hie-$GHC_MINOR_VERSION
cp hie hie-$GHC_VERSION
cp hie hie-$GHC_MAJOR_VERSION
else
GHC_MINOR_VERSION=nightly
@ -72,7 +73,7 @@ jobs:
stack unpack hlint --stack-yaml ../$(YAML_FILE) --to "$(Agent.TempDirectory)"
mkdir -p data
cp "$(Agent.TempDirectory)"/hlint*/data/hlint.yaml data
ARTIFACT_NAME=hie-$(hie --numeric-version)-ghc-$GHC_MINOR_VERSION-linux-x86_64
ARTIFACT_NAME=hie-$(hie --numeric-version)-ghc-$GHC_VERSION-linux-x86_64
tar -vczf $(Build.ArtifactStagingDirectory)/$ARTIFACT_NAME.tar.xz *
displayName: Install `hie`
- bash: |
@ -94,10 +95,18 @@ jobs:
displayName: "Install Runtime Test-Dependencies: hoogle database"
- bash: |
source .azure/linux-stack.bashrc
# cabal is also a test runtime dependency
export PATH=/opt/cabal/3.0/bin:$PATH
stack test --stack-yaml $(YAML_FILE)
displayName: Run Test
# cabal is also a test runtime dependency for unit-test suite
export PATH=/opt/cabal/$CABAL_VERSION/bin:$PATH
stack test :unit-test --stack-yaml $(YAML_FILE)
displayName: "Run Test: unit-test"
- bash: |
source .azure/linux-stack.bashrc
stack test :dispatcher-test :plugin-dispatcher-test :wrapper-test --stack-yaml $(YAML_FILE)
displayName: "Run Test: dispatcher-test, plugin-dispatcher-test and wrapper-test"
- bash: |
source .azure/linux-stack.bashrc
stack test :func-test --stack-yaml $(YAML_FILE)
displayName: "Run Test: func-test"
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)'

View File

@ -6,6 +6,21 @@ jobs:
variables:
YAML_FILE: install/shake.yaml
steps:
- task: Cache@2
inputs:
key: '"stack" | "$(Agent.OS)" | $(Build.SourcesDirectory)/$(YAML_FILE) | $(Build.SourcesDirectory)/install/shake.yaml'
path: .azure-cache
cacheHitVar: CACHE_RESTORED
displayName: "Cache stack-root"
- bash: |
mkdir -p $STACK_ROOT
tar -vxzf .azure-cache/stack-root.tar.gz -C /
mkdir -p .stack-work
tar -vxzf .azure-cache/stack-work.tar.gz
mkdir -p ./install/.stack-work
tar -vxzf .azure-cache/install-stack-work.tar.gz
displayName: "Unpack cache"
condition: eq(variables.CACHE_RESTORED, 'true')
- bash: |
export STACK_ROOT="$(Build.SourcesDirectory)"/.stack-root
mkdir -p ~/.local/bin
@ -32,3 +47,9 @@ jobs:
source .azure/macos.bashrc
stack install.hs latest
displayName: Run latest target of `install.hs`
- bash: |
mkdir -p .azure-cache
tar -vczf .azure-cache/stack-root.tar.gz $(cygpath $STACK_ROOT)
tar -vczf .azure-cache/stack-work.tar.gz .stack-work
tar -vczf .azure-cache/install-stack-work.tar.gz ./install/.stack-work
displayName: "Pack cache"

View File

@ -63,17 +63,17 @@ jobs:
stack install --stack-yaml $(YAML_FILE) --local-bin-path .azure-deploy
cd .azure-deploy
if [ $YAML_FILE != "stack.yaml" ]; then
GHC_MINOR_VERSION=${YAML_FILE:6:5}
GHC_VERSION=${YAML_FILE:6:5}
GHC_MAJOR_VERSION=${YAML_FILE:6:3}
cp hie hie-$GHC_MINOR_VERSION
cp hie hie-$GHC_VERSION
cp hie hie-$GHC_MAJOR_VERSION
else
GHC_MINOR_VERSION=nightly
GHC_VERSION=nightly
fi
stack unpack hlint --stack-yaml ../$(YAML_FILE) --to "$(Agent.TempDirectory)"
mkdir -p data
cp "$(Agent.TempDirectory)"/hlint*/data/hlint.yaml data
ARTIFACT_NAME=hie-$(hie --numeric-version)-ghc-$GHC_MINOR_VERSION-macos-x86_64
ARTIFACT_NAME=hie-$(hie --numeric-version)-ghc-$GHC_VERSION-macos-x86_64
tar -vczf $(Build.ArtifactStagingDirectory)/$ARTIFACT_NAME.tar.xz *
displayName: Install `hie`
- bash: |
@ -98,17 +98,31 @@ jobs:
- bash: |
source .azure/macos.bashrc
brew install cabal-install
displayName: "Install Runtime Test-Dependencies: cabal"
displayName: "Install Runtime Unit Test-Dependencies: cabal"
- bash: |
source .azure/macos.bashrc
stack test :unit-test --stack-yaml $(YAML_FILE)
displayName: "Run Test: unit-test"
# TODO: Enable dispatcher-test for ghc-8.4.*
- bash: |
source .azure/macos.bashrc
GHC_MAJOR_VERSION=${YAML_FILE:6:3}
if [ $GHC_MAJOR_VERSION != "8.4" ]; then
stack test --stack-yaml $(YAML_FILE)
TEST_TARGETS=:dispatcher-test :plugin-dispatcher-test :wrapper-test
else
#TODO Enable dispatcher-test and func-test for ghc-8.4.*
stack test --stack-yaml $(YAML_FILE) :unit-test :plugin-dispatcher-test :wrapper-test
TEST_TARGETS=:plugin-dispatcher-test :wrapper-test
fi
displayName: Run Test
stack test $TEST_TARGETS --stack-yaml $(YAML_FILE)
displayName: "Run Test: dispatcher-test, plugin-dispatcher-test and wrapper-test"
condition: False
# TODO: Enable func-test for ghc-8.4.*
- bash: |
source .azure/macos.bashrc
GHC_MAJOR_VERSION=${YAML_FILE:6:3}
if [ $GHC_MAJOR_VERSION != "8.4" ]; then
stack test :func-test --stack-yaml $(YAML_FILE)
fi
displayName: "Run Test: func-test"
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)'

View File

@ -0,0 +1,5 @@
export GHCS_PATH=$(cygpath $ProgramData)/chocolatey/lib/ghc/tools
export GHC_PATH=$GHCS_PATH/ghc-$GHC_VERSION
export CABAL_ROOT=$(cygpath $APPDATA)/cabal
export Z3_BIN_PATH=/usr/local/z3-4.8.5-x64-win/bin
export PATH=$CABAL_ROOT/bin:$GHC_PATH/bin:$Z3_BIN_PATH:$PATH

128
.azure/windows-cabal.yml Normal file
View File

@ -0,0 +1,128 @@
jobs:
- job: Windows_Cabal
timeoutInMinutes: 0
pool:
vmImage: windows-2019
strategy:
matrix:
# It still is not in chocolatey
# ghc-8.8.2:
# GHC_VERSION: "8.8.2"
ghc-8.6.5:
GHC_VERSION: "8.6.5"
ghc-8.4.4:
GHC_VERSION: "8.4.4"
variables:
CABAL_VERSION: "3.0.0.0"
CABAL_STORE_DIR: "D:\\sd"
LIQUID_VERSION: "0.8.6.2"
STACK_ROOT: "D:\\sr"
steps:
- task: Cache@2
inputs:
key: '"cabal" | "$(Agent.OS)" | "$(CABAL_VERSION)" | "$(GHC_VERSION)" | $(Build.SourcesDirectory)/cabal.project | $(Build.SourcesDirectory)/haskell-ide-engine.cabal | $(Build.SourcesDirectory)/hie-plugin-api/hie-plugin-api.cabal'
path: .azure-cache
cacheHitVar: CACHE_RESTORED
displayName: "Download cache"
- bash: |
df -k
source .azure/windows-cabal.bashrc
mkdir -p $CABAL_ROOT
tar -vxzf .azure-cache/cabal-root.tar.gz -C /c
mkdir -p $CABAL_STORE_DIR
tar -vxzf .azure-cache/cabal-store.tar.gz -C /d
mkdir -p ${CABAL_STORE_DIR}i
tar -vxzf .azure-cache/cabal-store-install.tar.gz -C /d
mkdir -p dist-newstyle
tar -vxzf .azure-cache/cabal-dist.tar.gz
displayName: "Unpack cache"
condition: eq(variables.CACHE_RESTORED, 'true')
- bash: |
git submodule sync
git submodule update --init
displayName: Sync submodules
- bash: |
choco install -y --ignore-dependencies ghc --version=$GHC_VERSION
displayName: Install ghc
- bash: |
choco install -y cabal --version=$CABAL_VERSION
$(cygpath $ProgramData)/chocolatey/bin/RefreshEnv.cmd
displayName: Install cabal
- bash: |
source .azure/windows-cabal.bashrc
cabal v2-update
echo "store-dir: $CABAL_STORE_DIR" >> $CABAL_ROOT/config
echo "overwrite-policy: always" >> $CABAL_ROOT/config
displayName: Update cabal
- bash: |
source .azure/windows-cabal.bashrc
cabal v2-build all --disable-tests --disable-benchmarks --only-dependencies
displayName: Build dependencies
- bash: |
source .azure/windows-cabal.bashrc
cabal v2-build all --disable-tests --disable-benchmarks
displayName: Build `hie`
- bash: |
source .azure/windows-cabal.bashrc
# `hie` binary required locally for tests
cabal --store-dir ${CABAL_STORE_DIR}i v2-install
displayName: Install `hie`
- bash: |
source .azure/windows-cabal.bashrc
cabal v2-build all --enable-tests --enable-benchmarks --only-dependencies
displayName: Build Test-dependencies
- bash: |
mkdir -p /usr/local
curl -L https://github.com/Z3Prover/z3/releases/download/Z3-4.8.5/z3-4.8.5-x64-win.zip -o /usr/local/z3.zip
unzip -o /usr/local/z3.zip -d /usr/local/
displayName: "Install Runtime Test-Dependencies: z3"
- bash: |
source .azure/windows-cabal.bashrc
choco install -y --ignore-dependencies ghc --version=8.6.5
# to not reinstall hie
cd "$(Agent.TempDirectory)"
cabal v2-install liquidhaskell-$LIQUID_VERSION -w $GHCS_PATH/ghc-8.6.5/bin/ghc.exe
displayName: "Install Runtime Test-Dependencies: liquidhaskell"
- bash: |
source .azure/windows-cabal.bashrc
cabal v2-build hoogle
cabal v2-exec hoogle generate
displayName: "Install Runtime Test-Dependencies: hoogle database"
- 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"
echo "local-programs-path: D:/bin/stack" > $STACK_ROOT/config.yaml
# If we don't install the ghc used in test projects in advance, tests fail
stack setup --resolver=lts-14.20
displayName: "Install Runtime Unit Test-Dependencies: stack"
- bash: |
source .azure/windows-cabal.bashrc
# TODO: Enable CabalHelper tests
if [ $GHC_VERSION = "8.4.4" ]; then
TEST_OPTIONS=--test-options="--skip=CabalHelper"
fi
cabal v2-test :unit-test $TEST_OPTIONS
displayName: "Run Test: unit-test"
# TODO: Enable rest of test suites in windows
- bash: |
source .azure/windows-cabal.bashrc
cabal v2-test :dispatcher-test :plugin-dispatcher-test :wrapper-test
displayName: "Run Test: dispatcher-test, plugin-dispatcher-test and wrapper-test"
condition: False
- bash: |
source .azure/windows-cabal.bashrc
# TODO: Enable completion test
if [ $GHC_VERSION = "8.4.4" ]; then
TEST_OPTIONS="--test-options=\"--skip=/Completion/completions/works/\""
fi
cabal v2-test :func-test $TEST_OPTIONS
displayName: "Run Test: func-test"
- bash: |
source .azure/windows-cabal.bashrc
mkdir -p .azure-cache
tar -vczf .azure-cache/cabal-root.tar.gz $CABAL_ROOT
tar -vczf .azure-cache/cabal-store.tar.gz $(cygpath $CABAL_STORE_DIR)
tar -vczf .azure-cache/cabal-store-install.tar.gz $(cygpath $CABAL_STORE_DIR)i
tar -vczf .azure-cache/cabal-dist.tar.gz dist-newstyle
displayName: "Pack cache"

View File

@ -4,36 +4,53 @@ jobs:
pool:
vmImage: windows-2019
variables:
YAML_FILE: install/shake.yaml
PROJECT_FILE: install/shake.project
STACK_ROOT: "C:\\sr"
# TODO: Replace stack with chocolatey for installing ghc and cabal
GHC_VERSION: "8.6.5"
CABAL_VERSION: "3.0.0.0"
PROJECT_FILE: "./install/shake.project"
CABAL_STORE_DIR: "D:\\sd"
steps:
- task: Cache@2
inputs:
key: '"cabal-installhs" | "$(Agent.OS)" | "$(CABAL_VERSION)" | "$(GHC_VERSION)" | $(Build.SourcesDirectory)/cabal.project | $(Build.SourcesDirectory)/haskell-ide-engine.cabal | $(Build.SourcesDirectory)/hie-plugin-api/hie-plugin-api.cabal'
path: .azure-cache
cacheHitVar: CACHE_RESTORED
displayName: "Download cache"
- 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/
displayName: Install stack
source .azure/windows-cabal.bashrc
mkdir -p $CABAL_ROOT
tar -vxzf .azure-cache/cabal-root.tar.gz -C /c
mkdir -p $CABAL_STORE_DIR
tar -vxzf .azure-cache/cabal-store.tar.gz -C /d
mkdir -p ./dist-newstyle
tar -vxzf .azure-cache/cabal-dist.tar.gz
displayName: "Unpack cache"
condition: eq(variables.CACHE_RESTORED, 'true')
- bash: |
source .azure/windows.bashrc
stack setup --stack-yaml $(YAML_FILE)
displayName: Install GHC
choco install -y --ignore-dependencies ghc --version=$GHC_VERSION
displayName: Install ghc
- bash: |
source .azure/windows.bashrc
stack install Cabal-3.0.0.0 cabal-install-3.0.0.0 --stack-yaml $(YAML_FILE)
displayName: Install `cabal-install`
source .azure/windows-cabal.bashrc
choco install -y cabal --version=$CABAL_VERSION
$(cygpath $ProgramData)/chocolatey/bin/RefreshEnv.cmd
displayName: Install cabal
- bash: |
source .azure/windows.bashrc
source .azure/windows-cabal.bashrc
cabal v2-update
displayName: update cabal
echo "store-dir: $CABAL_STORE_DIR" >> $CABAL_ROOT/config
displayName: Update cabal
- bash: |
source .azure/windows.bashrc
GHC_PATH=$(stack path --stack-yaml $YAML_FILE --compiler-exe)
cabal v2-run install.hs -w $GHC_PATH --project-file $(PROJECT_FILE) help
source .azure/windows-cabal.bashrc
cabal v2-run ./install.hs --project-file $PROJECT_FILE help
displayName: Run help of `install.hs`
# - bash: |
# source .azure/windows.bashrc
# GHC_PATH=$(stack path --stack-yaml $YAML_FILE --compiler-exe)
# GHC_DIR=$(dirname $GHC_PATH)
# export PATH=$(cygpath $GHC_DIR):$PATH
# cabal v2-run install.hs -w $GHC_PATH --project-file $(PROJECT_FILE) build-latest
# displayName: Run build-latest target of `install.hs`
- bash: |
source .azure/windows-cabal.bashrc
cabal v2-run ./install.hs --project-file $PROJECT_FILE latest
displayName: Run build-latest target of `install.hs`
- bash: |
source .azure/windows-cabal.bashrc
mkdir -p .azure-cache
tar -vczf .azure-cache/cabal-root.tar.gz $CABAL_ROOT
tar -vczf .azure-cache/cabal-store.tar.gz $(cygpath $CABAL_STORE_DIR)
tar -vczf .azure-cache/cabal-dist.tar.gz dist-newstyle
displayName: "Pack cache"

View File

@ -7,28 +7,50 @@ jobs:
YAML_FILE: install/shake.yaml
STACK_ROOT: "D:\\sr"
steps:
- task: Cache@2
inputs:
key: '"stack" | "$(Agent.OS)" | $(Build.SourcesDirectory)/$(YAML_FILE) | $(Build.SourcesDirectory)/install/shake.yaml'
path: .azure-cache
cacheHitVar: CACHE_RESTORED
displayName: "Cache stack-root"
- bash: |
mkdir -p $STACK_ROOT
tar -vxzf .azure-cache/stack-root.tar.gz -C /d
mkdir -p .stack-work
tar -vxzf .azure-cache/stack-work.tar.gz
mkdir -p ./install/.stack-work
tar -vxzf .azure-cache/install-stack-work.tar.gz
displayName: "Unpack cache"
condition: eq(variables.CACHE_RESTORED, 'true')
- 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/
echo "local-programs-path: D:/bin/stack" > $STACK_ROOT/config.yaml
displayName: Install stack
- bash: |
source .azure/windows.bashrc
source .azure/windows-stack.bashrc
stack setup --stack-yaml $(YAML_FILE)
displayName: Install GHC
- bash: |
source .azure/windows.bashrc
source .azure/windows-stack.bashrc
stack --stack-yaml $(YAML_FILE) build --only-dependencies
displayName: Build dependencies
- bash: |
source .azure/windows.bashrc
source .azure/windows-stack.bashrc
stack build --stack-yaml $(YAML_FILE)
displayName: Build `hie-install`
- bash: |
source .azure/windows.bashrc
source .azure/windows-stack.bashrc
stack install.hs help
displayName: Run help of `install.hs`
- bash: |
source .azure/windows.bashrc
# Some executions fails with spurious errors installing the exe
source .azure/windows-stack.bashrc
# Some executions fails with spurious errors installing executables
stack install.hs latest || stack install.hs latest
displayName: Run latest target of `install.hs`
- bash: |
mkdir -p .azure-cache
tar -vczf .azure-cache/stack-root.tar.gz $(cygpath $STACK_ROOT)
tar -vczf .azure-cache/stack-work.tar.gz .stack-work
tar -vczf .azure-cache/install-stack-work.tar.gz ./install/.stack-work
displayName: "Pack cache"

View File

@ -5,9 +5,8 @@ jobs:
vmImage: windows-2019
strategy:
matrix:
# We can't use stack.yaml while it uses ghc-8.8.1
# stack-def:
# YAML_FILE: stack.yaml
stack-def:
YAML_FILE: stack.yaml
stack-8.6.5:
YAML_FILE: stack-8.6.5.yaml
stack-8.6.4:
@ -20,6 +19,7 @@ jobs:
YAML_FILE: stack-8.4.2.yaml
variables:
STACK_ROOT: "D:\\sr"
CABAL_VERSION: "3.0.0.0"
steps:
- task: Cache@2
@ -30,7 +30,7 @@ jobs:
displayName: "Cache stack-root"
- bash: |
mkdir -p $STACK_ROOT
tar -vxzf .azure-cache/stack-root.tar.gz -C /
tar -vxzf .azure-cache/stack-root.tar.gz -C /d
mkdir -p .stack-work
tar -vxzf .azure-cache/stack-work.tar.gz
displayName: "Unpack cache"
@ -42,41 +42,45 @@ jobs:
- 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"
echo "local-programs-path: D:/bin/stack" > "$STACK_ROOT/config.yaml"
displayName: Install stack
- bash: |
source .azure/windows.bashrc
source .azure/windows-stack.bashrc
stack setup --stack-yaml $(YAML_FILE)
displayName: Install GHC
- bash: |
source .azure/windows.bashrc
stack --stack-yaml $(YAML_FILE) --install-ghc build --only-dependencies
source .azure/windows-stack.bashrc
STACK_CMD="stack build --stack-yaml $(YAML_FILE) --only-dependencies"
# Some executions fails with spurious errors installing executables
$STACK_CMD || $STACK_CMD
displayName: Build dependencies
- bash: |
source .azure/windows.bashrc
source .azure/windows-stack.bashrc
stack build --stack-yaml $(YAML_FILE)
displayName: Build `hie`
- bash: |
source .azure/windows.bashrc
source .azure/windows-stack.bashrc
stack install --stack-yaml $(YAML_FILE) # `hie` binary required locally for tests
mkdir .azure-deploy
stack install --stack-yaml $(YAML_FILE) --local-bin-path .azure-deploy
cd .azure-deploy
if [ $YAML_FILE != "stack.yaml" ]; then
GHC_MINOR_VERSION=${YAML_FILE:6:5}
GHC_VERSION=${YAML_FILE:6:5}
GHC_MAJOR_VERSION=${YAML_FILE:6:3}
cp hie.exe hie-$GHC_MINOR_VERSION.exe
cp hie.exe hie-$GHC_VERSION.exe
cp hie.exe hie-$GHC_MAJOR_VERSION.exe
else
GHC_MINOR_VERSION=nightly
GHC_VERSION=nightly
fi
stack unpack hlint --stack-yaml ../$(YAML_FILE) --to "$(Agent.TempDirectory)"
mkdir -p data
cp "$(Agent.TempDirectory)"/hlint*/data/hlint.yaml data
ARTIFACT_NAME=hie-$(hie --numeric-version)-ghc-$GHC_MINOR_VERSION-windows-x86_64
ARTIFACT_NAME=hie-$(hie --numeric-version)-ghc-$GHC_VERSION-windows-x86_64
7z a "$(Build.ArtifactStagingDirectory)/$ARTIFACT_NAME.zip" *
displayName: Install `hie`
- bash: |
source .azure/windows.bashrc
source .azure/windows-stack.bashrc
stack build --stack-yaml $(YAML_FILE) --test --bench --only-dependencies
displayName: Build Test-dependencies
- bash: |
@ -86,34 +90,41 @@ jobs:
unzip -o /usr/local/z3.zip -d /usr/local/
displayName: "Install Runtime Test-Dependencies: z3"
- bash: |
source .azure/windows.bashrc
source .azure/windows-stack.bashrc
stack install --resolver=lts-13.20 liquid-fixpoint-0.8.0.2 liquidhaskell-0.8.6.2
displayName: "Install Runtime Test-Dependencies: liquidhaskell"
- bash: |
source .azure/windows.bashrc
source .azure/windows-stack.bashrc
stack build hoogle --stack-yaml=$(YAML_FILE)
stack exec hoogle generate --stack-yaml=$(YAML_FILE)
displayName: "Install Runtime Test-Dependencies: hoogle database"
- bash: |
source .azure/windows.bashrc
choco install cabal
source .azure/windows-stack.bashrc
choco install -y cabal --version 3.0.0.0
/C/ProgramData/chocolatey/bin/RefreshEnv.cmd
displayName: "Install Runtime Test-Dependencies: cabal"
- bash: |
source .azure/windows.bashrc
source .azure/windows-stack.bashrc
# TODO: Enable CabalHelper unit tests, see https://github.com/DanielG/cabal-helper/issues/91
if [ $YAML_FILE = "stack-8.6.4.yaml" ]; then
TEST_ARGS=--test-arguments="--skip=CabalHelper"
fi
# TODO: Enable rest of test suites
stack test --stack-yaml $(YAML_FILE) :unit-test :plugin-dispatcher-test $TEST_ARGS # :dispatcher-test :wrapper-test
# TODO: Enable failing functional test
stack test :unit-test $TEST_ARGS --stack-yaml $(YAML_FILE)
displayName: "Run Test: unit-test"
# TODO: Enable rest of test suites in windows
- bash: |
source .azure/windows-stack.bashrc
stack test :dispatcher-test :plugin-dispatcher-test :wrapper-test --stack-yaml $(YAML_FILE)
displayName: "Run Test: dispatcher-test, plugin-dispatcher-test and wrapper-test"
condition: False
- bash: |
source .azure/windows-stack.bashrc
if [ $YAML_FILE != "stack-8.6.4.yaml" ]; then
stack test --stack-yaml $(YAML_FILE) :func-test
else
stack test --stack-yaml $(YAML_FILE) :func-test --ta="--skip \"/Hover/hover/works\""
fi
displayName: Run Test
displayName: "Run Test: func-test"
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)'

View File

@ -27,6 +27,7 @@ jobs:
- template: ./.azure/linux-stack.yml
- template: ./.azure/linux-cabal.yml
- template: ./.azure/windows-stack.yml
- template: ./.azure/windows-cabal.yml
- template: ./.azure/macos-stack.yml
- template: ./.azure/linux-installhs-stack.yml
- template: ./.azure/windows-installhs-stack.yml