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

Commit c584f98

Browse files
authored
Merge pull request #1665 from jneira/azure-macos
Improvements of install script and macos-installhs-cabal new azure job: * Add azure job to test the build of install.hs with macos and cabal * Improvements over install.hs: * Remove unused imports * Pass verbosity shake arg to build tools (cabal and stack) * Use custom cabal.project-${ghcVersion} if exists * I added cabal.project-ghc-8.8.2 that will be used by the script * Add comments with the possible resolvers to shake.yaml
2 parents 91422e9 + 7e45d34 commit c584f98

22 files changed

+299
-173
lines changed

.azure/linux-cabal.bashrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
1+
if [ -z "$PROJECT_FILE" ]; then
2+
export PROJECT_FILE="cabal.project"
3+
if [ -f "cabal.project-$GHC_VERSION" ]; then
4+
export PROJECT_FILE="cabal.project-$GHC_VERSION"
5+
fi
6+
fi
17
export PATH=$HOME/.cabal/bin:/opt/cabal/$CABAL_VERSION/bin:/opt/ghc/$GHC_VERSION/bin:$HOME/.local/bin:$PATH

.azure/linux-cabal.yml

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,8 @@ jobs:
55
vmImage: ubuntu-16.04
66
strategy:
77
matrix:
8-
# Fail with compilation error building haddock-api
9-
# ghc-8.8.2:
10-
# GHC_VERSION: "8.8.2"
11-
ghc-8.8.1:
12-
GHC_VERSION: "8.8.1"
8+
ghc-8.8.2:
9+
GHC_VERSION: "8.8.2"
1310
ghc-8.6.5:
1411
GHC_VERSION: "8.6.5"
1512
ghc-8.4.4:
@@ -43,24 +40,24 @@ jobs:
4340
displayName: Install ghc
4441
- bash: |
4542
source .azure/linux-cabal.bashrc
46-
cabal v2-update
43+
cabal v2-update --project-file $PROJECT_FILE
4744
echo "overwrite-policy: always" >> $HOME/.cabal/config
4845
displayName: Update cabal
4946
- bash: |
5047
source .azure/linux-cabal.bashrc
51-
cabal v2-build --disable-tests --disable-benchmarks --only-dependencies
48+
cabal v2-build --disable-tests --disable-benchmarks --only-dependencies --project-file $PROJECT_FILE
5249
displayName: Build dependencies
5350
- bash: |
5451
source .azure/linux-cabal.bashrc
55-
cabal v2-build --disable-tests --disable-benchmarks
52+
cabal v2-build --disable-tests --disable-benchmarks --project-file $PROJECT_FILE
5653
displayName: Build `hie`
5754
- bash: |
5855
source .azure/linux-cabal.bashrc
59-
cabal v2-install # `hie` binary required locally for tests
56+
cabal v2-install --project-file $PROJECT_FILE # `hie` binary required locally for tests
6057
displayName: Install `hie`
6158
- bash: |
6259
source .azure/linux-cabal.bashrc
63-
cabal v2-build --enable-tests --enable-benchmarks --only-dependencies
60+
cabal v2-build --enable-tests --enable-benchmarks --only-dependencies --project-file $PROJECT_FILE
6461
displayName: Build Test-dependencies
6562
- bash: |
6663
sudo apt update
@@ -73,20 +70,20 @@ jobs:
7370
displayName: "Install Runtime Test-Dependencies: liquidhaskell"
7471
- bash: |
7572
source .azure/linux-cabal.bashrc
76-
cabal v2-build hoogle
77-
cabal v2-exec hoogle generate
73+
cabal v2-build hoogle --project-file $PROJECT_FILE
74+
cabal v2-exec hoogle generate --project-file $PROJECT_FILE
7875
displayName: "Install Runtime Test-Dependencies: hoogle database"
7976
- bash: |
8077
source .azure/linux-cabal.bashrc
81-
cabal v2-test :unit-test
78+
cabal v2-test :unit-test --project-file $PROJECT_FILE
8279
displayName: "Run Test: unit-test"
8380
- bash: |
8481
source .azure/linux-cabal.bashrc
85-
cabal v2-test :dispatcher-test :plugin-dispatcher-test :wrapper-test
82+
cabal v2-test :dispatcher-test :plugin-dispatcher-test :wrapper-test --project-file $PROJECT_FILE
8683
displayName: "Run Test: dispatcher-test, plugin-dispatcher-test and wrapper-test"
8784
- bash: |
8885
source .azure/linux-cabal.bashrc
89-
cabal v2-test :func-test
86+
cabal v2-test :func-test --project-file $PROJECT_FILE
9087
displayName: "Run Test: func-test"
9188
- bash: |
9289
mkdir -p .azure-cache

.azure/macos-cabal.bashrc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
if [ -z "$PROJECT_FILE" ]; then
2+
export PROJECT_FILE="cabal.project"
3+
if [ -f "cabal.project-$GHC_VERSION" ]; then
4+
export PROJECT_FILE="cabal.project-$GHC_VERSION"
5+
fi
6+
fi
7+
export CABAL_ROOT=$HOME/.cabal
8+
export PATH=$CABAL_ROOT/bin:$PATH

.azure/macos-installhs-cabal.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
jobs:
2+
- job: MacOs_installhs_Cabal
3+
timeoutInMinutes: 0
4+
pool:
5+
vmImage: macOS-10.14
6+
variables:
7+
PROJECT_FILE: "./install/shake.project"
8+
steps:
9+
- task: Cache@2
10+
inputs:
11+
key: '"cabal-installhs" | "$(Agent.OS)" | $(Build.SourcesDirectory)/cabal.project | $(Build.SourcesDirectory)/haskell-ide-engine.cabal | $(Build.SourcesDirectory)/hie-plugin-api/hie-plugin-api.cabal'
12+
path: .azure-cache
13+
cacheHitVar: CACHE_RESTORED
14+
displayName: "Download cache"
15+
- bash: |
16+
source .azure/macos-cabal.bashrc
17+
mkdir -p $CABAL_ROOT
18+
tar -vxzf .azure-cache/cabal-root.tar.gz -C /
19+
mkdir -p dist-newstyle
20+
tar -vxzf .azure-cache/cabal-dist.tar.gz
21+
displayName: "Unpack cache"
22+
condition: eq(variables.CACHE_RESTORED, 'true')
23+
- bash: |
24+
brew install cabal-install
25+
which cabal
26+
which ghc
27+
cabal update
28+
displayName: Install cabal and ghc
29+
- bash: |
30+
source .azure/windows-cabal.bashrc
31+
cabal v2-run ./install.hs --project-file $PROJECT_FILE -- help
32+
displayName: Run help of `install.hs`
33+
- bash: |
34+
source .azure/windows-cabal.bashrc
35+
cabal v2-run ./install.hs --project-file $PROJECT_FILE -- latest
36+
displayName: Run latest target of `install.hs`
37+
- bash: |
38+
source .azure/macos-cabal.bashrc
39+
mkdir -p .azure-cache
40+
tar -vczf .azure-cache/cabal-root.tar.gz $CABAL_ROOT
41+
tar -vczf .azure-cache/cabal-dist.tar.gz dist-newstyle
42+
displayName: "Pack cache"

.azure/macos-installhs-stack.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,23 +28,23 @@ jobs:
2828
tar xz --strip-components=1 --include '*/stack' -C ~/.local/bin;
2929
displayName: Install stack
3030
- bash: |
31-
source .azure/macos.bashrc
31+
source .azure/macos-stack.bashrc
3232
stack setup --stack-yaml $(YAML_FILE)
3333
displayName: Install GHC
3434
- bash: |
35-
source .azure/macos.bashrc
35+
source .azure/macos-stack.bashrc
3636
stack --stack-yaml $(YAML_FILE) --install-ghc build --only-dependencies
3737
displayName: Build dependencies
3838
- bash: |
39-
source .azure/macos.bashrc
39+
source .azure/macos-stack.bashrc
4040
stack build --stack-yaml $(YAML_FILE)
4141
displayName: Build `hie-install`
4242
- bash: |
43-
source .azure/macos.bashrc
43+
source .azure/macos-stack.bashrc
4444
stack install.hs help
4545
displayName: Run help of `install.hs`
4646
- bash: |
47-
source .azure/macos.bashrc
47+
source .azure/macos-stack.bashrc
4848
stack install.hs latest
4949
displayName: Run latest target of `install.hs`
5050
- bash: |
File renamed without changes.

.azure/macos-stack.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,19 +47,19 @@ jobs:
4747
tar vxz --strip-components=1 --include '*/stack' -C ~/.local/bin;
4848
displayName: Install stack
4949
- bash: |
50-
source .azure/macos.bashrc
50+
source .azure/macos-stack.bashrc
5151
stack setup --stack-yaml $(YAML_FILE)
5252
displayName: Install GHC
5353
- bash: |
54-
source .azure/macos.bashrc
54+
source .azure/macos-stack.bashrc
5555
stack --stack-yaml $(YAML_FILE) --install-ghc build --only-dependencies
5656
displayName: Build dependencies
5757
- bash: |
58-
source .azure/macos.bashrc
58+
source .azure/macos-stack.bashrc
5959
stack build --stack-yaml $(YAML_FILE)
6060
displayName: Build `hie`
6161
- bash: |
62-
source .azure/macos.bashrc
62+
source .azure/macos-stack.bashrc
6363
stack install --stack-yaml $(YAML_FILE) # `hie` binary required locally for tests
6464
mkdir .azure-deploy
6565
stack install --stack-yaml $(YAML_FILE) --local-bin-path .azure-deploy
@@ -76,7 +76,7 @@ jobs:
7676
tar -vczf $(Build.ArtifactStagingDirectory)/$ARTIFACT_NAME.tar.xz *
7777
displayName: Install `hie`
7878
- bash: |
79-
source .azure/macos.bashrc
79+
source .azure/macos-stack.bashrc
8080
stack build --stack-yaml $(YAML_FILE) --test --bench --only-dependencies
8181
displayName: Build Test-dependencies
8282
- bash: |
@@ -86,26 +86,26 @@ jobs:
8686
brew install z3
8787
displayName: "Install Runtime Test-Dependencies: z3"
8888
- bash: |
89-
source .azure/macos.bashrc
89+
source .azure/macos-stack.bashrc
9090
stack install --resolver=lts-13.20 liquid-fixpoint-0.8.0.2 liquidhaskell-0.8.6.2
9191
displayName: "Install Runtime Test-Dependencies: liquidhaskell"
9292
- bash: |
93-
source .azure/macos.bashrc
93+
source .azure/macos-stack.bashrc
9494
stack build hoogle --stack-yaml=$(YAML_FILE)
9595
# This step frequently fails with http 403
9696
stack exec hoogle generate --stack-yaml=$(YAML_FILE) || stack exec hoogle generate --stack-yaml=$(YAML_FILE)
9797
displayName: "Install Runtime Test-Dependencies: hoogle database"
9898
- bash: |
99-
source .azure/macos.bashrc
99+
source .azure/macos-stack.bashrc
100100
brew install cabal-install
101101
displayName: "Install Runtime Unit Test-Dependencies: cabal"
102102
- bash: |
103-
source .azure/macos.bashrc
103+
source .azure/macos-stack.bashrc
104104
stack test :unit-test --stack-yaml $(YAML_FILE)
105105
displayName: "Run Test: unit-test"
106106
# TODO: Enable dispatcher-test for ghc-8.4.*
107107
- bash: |
108-
source .azure/macos.bashrc
108+
source .azure/macos-stack.bashrc
109109
GHC_MAJOR_VERSION=${YAML_FILE:6:3}
110110
if [ $GHC_MAJOR_VERSION != "8.4" ]; then
111111
TEST_TARGETS=:dispatcher-test :plugin-dispatcher-test :wrapper-test
@@ -117,7 +117,7 @@ jobs:
117117
condition: False
118118
# TODO: Enable func-test for ghc-8.4.*
119119
- bash: |
120-
source .azure/macos.bashrc
120+
source .azure/macos-stack.bashrc
121121
GHC_MAJOR_VERSION=${YAML_FILE:6:3}
122122
if [ $GHC_MAJOR_VERSION != "8.4" ]; then
123123
stack test :func-test --stack-yaml $(YAML_FILE)

.azure/windows-cabal.bashrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
if [ -z "$PROJECT_FILE" ]; then
2+
export PROJECT_FILE="cabal.project"
3+
if [ -f "cabal.project-$GHC_VERSION" ]; then
4+
export PROJECT_FILE="cabal.project-$GHC_VERSION"
5+
fi
6+
fi
17
if [ -z "$CABAL_DIR" ]; then
28
CABAL_DIR="$APPDATA\\cabal"
39
fi

.azure/windows-cabal.yml

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ jobs:
55
vmImage: windows-2019
66
strategy:
77
matrix:
8-
# It still is not in chocolatey
8+
# ghc versions 8.8.1 and 8.8.2 are not usable in windows
9+
# due to https://gitlab.haskell.org/ghc/ghc/issues/17575
910
# ghc-8.8.2:
1011
# GHC_VERSION: "8.8.2"
1112
ghc-8.6.5:
@@ -51,28 +52,28 @@ jobs:
5152
displayName: Install cabal
5253
- bash: |
5354
source .azure/windows-cabal.bashrc
54-
cabal v2-update
55+
cabal v2-update --project-file $PROJECT_FILE
5556
echo "store-dir: $CABAL_STORE_DIR" >> $CABAL_ROOT/config
5657
echo "overwrite-policy: always" >> $CABAL_ROOT/config
5758
displayName: Update cabal
5859
- bash: |
5960
source .azure/windows-cabal.bashrc
60-
cabal v2-build all --disable-tests --disable-benchmarks --only-dependencies
61+
cabal v2-build all --disable-tests --disable-benchmarks --only-dependencies --project-file $PROJECT_FILE
6162
displayName: Build dependencies
6263
- bash: |
6364
source .azure/windows-cabal.bashrc
64-
cabal v2-build all --disable-tests --disable-benchmarks
65+
cabal v2-build all --disable-tests --disable-benchmarks --project-file $PROJECT_FILE
6566
displayName: Build `hie`
6667
- bash: |
6768
source .azure/windows-cabal.bashrc
6869
# `hie` binary required locally for tests
6970
# we have to use a separate store for install and builds
7071
# to workaround https://github.com/haskell/cabal/issues/6483
71-
cabal --store-dir ${CABAL_STORE_DIR}i v2-install
72+
cabal --store-dir ${CABAL_STORE_DIR}i v2-install --project-file $PROJECT_FILE
7273
displayName: Install `hie`
7374
- bash: |
7475
source .azure/windows-cabal.bashrc
75-
cabal v2-build all --enable-tests --enable-benchmarks --only-dependencies
76+
cabal v2-build all --enable-tests --enable-benchmarks --only-dependencies --project-file $PROJECT_FILE
7677
displayName: Build Test-dependencies
7778
- bash: |
7879
mkdir -p /usr/local
@@ -88,31 +89,31 @@ jobs:
8889
displayName: "Install Runtime Test-Dependencies: liquidhaskell"
8990
- bash: |
9091
source .azure/windows-cabal.bashrc
91-
cabal v2-build hoogle
92-
cabal v2-exec hoogle generate
92+
cabal v2-build hoogle --project-file $PROJECT_FILE
93+
cabal v2-exec hoogle generate --project-file $PROJECT_FILE
9394
displayName: "Install Runtime Test-Dependencies: hoogle database"
9495
- bash: |
9596
curl -sSkL http://www.stackage.org/stack/windows-x86_64 -o /usr/bin/stack.zip
9697
unzip -o /usr/bin/stack.zip -d /usr/bin/
9798
mkdir -p "$STACK_ROOT"
98-
# If we don't install the ghc used in test projects in advance, tests fail
99+
# If we don't install the ghc used in test projects in advance, tests fail
99100
stack setup --stack-yaml stack-${GHC_VERSION}.yaml
100101
displayName: "Install Runtime Unit Test-Dependencies: stack"
101102
- bash: |
102103
source .azure/windows-cabal.bashrc
103-
cabal v2-test :unit-test
104+
cabal v2-test :unit-test --project-file $PROJECT_FILE
104105
displayName: "Run Test: unit-test"
105106
- bash: |
106107
source .azure/windows-cabal.bashrc
107108
# Needed for wrapper-test
108109
stack setup --stack-yaml stack-8.8.1.yaml
109110
stack setup --stack-yaml stack-8.6.5.yaml
110111
# TODO Enable :dispatcher-test suite
111-
cabal v2-test :plugin-dispatcher-test :wrapper-test # :dispatcher-test
112+
cabal v2-test :plugin-dispatcher-test :wrapper-test # :dispatcher-test --project-file $PROJECT_FILE
112113
displayName: "Run Test: dispatcher-test, plugin-dispatcher-test and wrapper-test"
113114
- bash: |
114115
source .azure/windows-cabal.bashrc
115-
cabal v2-test :func-test
116+
cabal v2-test :func-test --project-file $PROJECT_FILE
116117
displayName: "Run Test: func-test"
117118
- bash: |
118119
source .azure/windows-cabal.bashrc

.azure/windows-installhs-cabal.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
- bash: |
4747
source .azure/windows-cabal.bashrc
4848
cabal v2-run ./install.hs --project-file $PROJECT_FILE latest
49-
displayName: Run build-latest target of `install.hs`
49+
displayName: Run latest target of `install.hs`
5050
- bash: |
5151
source .azure/windows-cabal.bashrc
5252
mkdir -p .azure-cache

azure-pipelines.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,5 @@ jobs:
4040
- template: ./.azure/linux-installhs-stack.yml
4141
- template: ./.azure/windows-installhs-stack.yml
4242
- template: ./.azure/windows-installhs-cabal.yml
43+
- template: ./.azure/macos-installhs-cabal.yml
4344
- template: ./.azure/macos-installhs-stack.yml

cabal.project-8.8.2

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
packages:
2+
./
3+
./hie-plugin-api/
4+
5+
-- ./submodules/HaRe
6+
7+
-- To avoid build error with ghc-8.8.2
8+
-- See https://github.com/haskell/haddock/issues/1123
9+
source-repository-package
10+
type: git
11+
location: https://github.com/haskell/haddock.git
12+
subdir: haddock-api
13+
tag: be8b02c4e3cffe7d45b3dad0a0f071d35a274d65
14+
15+
source-repository-package
16+
type: git
17+
location: https://github.com/jneira/cabal-helper.git
18+
tag: ffb1f57a5ffc6b7ac3c46a9974c4420a6d2bb9b2
19+
20+
tests: true
21+
22+
package haskell-ide-engine
23+
test-show-details: direct
24+
25+
-- Match the flag settings we use in stac builds
26+
constraints:
27+
haskell-ide-engine +pedantic
28+
hie-plugin-api +pedantic
29+
30+
write-ghc-environment-files: never
31+
32+
index-state: 2020-02-05T07:49:28Z

install/hie-install.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: hie-install
2-
version: 0.8.0.0
2+
version: 0.8.1.0
33
synopsis: Install the haskell-ide-engine
44
license: BSD3
55
author: Many, TBD when we release

0 commit comments

Comments
 (0)