Skip to content
This repository was archived by the owner on Oct 7, 2020. It is now read-only.

azure: add windows+cabal job and other improvements #1595

Merged
merged 9 commits into from
Jan 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 30 additions & 10 deletions .azure/linux-cabal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -23,26 +29,34 @@ 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')
- bash: |
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
Expand All @@ -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
Expand All @@ -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
Expand Down
31 changes: 26 additions & 5 deletions .azure/linux-installhs-stack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,50 @@ 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
curl -L https://get.haskellstack.org/stable/linux-x86_64.tar.gz | \
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"
23 changes: 16 additions & 7 deletions .azure/linux-stack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -62,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
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-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: |
Expand All @@ -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)'
Expand Down
21 changes: 21 additions & 0 deletions .azure/macos-installhs-stack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
32 changes: 23 additions & 9 deletions .azure/macos-stack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand All @@ -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
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
displayName: "Run Test: func-test"
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)'
Expand Down
5 changes: 5 additions & 0 deletions .azure/windows-cabal.bashrc
Original file line number Diff line number Diff line change
@@ -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
Loading