@@ -24,69 +24,43 @@ jobs:
24
24
maxParallel : 5
25
25
steps :
26
26
- script : |
27
- echo $OS_NAME
28
27
export STACK_ROOT="$(Build.SourcesDirectory)"/.stack-root;
29
- echo $STACK_ROOT
30
28
mkdir -p ~/.local/bin
31
29
curl -f -L "https://github.com/fpco/cache-s3/releases/download/${CACHE_S3_VERSION}/cache-s3-${CACHE_S3_VERSION}-${OS_NAME}-x86_64.tar.gz" -o ~/.local/bin/cache-s3.tar.gz
32
30
tar xzf ~/.local/bin/cache-s3.tar.gz -C ~/.local/bin
33
31
export PATH=$HOME/.local/bin:$PATH;
34
32
cache-s3 --prefix="${CACHE_S3_PREFIX}" --git-branch="$(Build.SourceBranchName)" --suffix="${OS_NAME}" restore stack --base-branch="${BASE_BRANCH}"
35
33
cache-s3 --prefix="${CACHE_S3_PREFIX}" --git-branch="$(Build.SourceBranchName)" --suffix="${OS_NAME}" restore stack work --base-branch="${BASE_BRANCH}"
36
34
etc/scripts/ci-setup.sh
37
- case "$BUILD" in
38
- style)
39
- export PATH="$(pwd)"/hlint:$PATH
40
- ;;
41
- cabal)
42
- export PATH=$HOME/.local/bin:$HOME/.cabal/bin:/opt/ghc/$GHCVER/bin:/opt/happy/1.19.5/bin:/opt/alex/3.1.7/bin:/opt/cabal/$CABALVER/bin:$PATH
43
- ;;
44
- *)
45
- export PATH=$HOME/.local/bin:/opt/ghc/$GHCVER/bin:/opt/happy/1.19.5/bin:/opt/alex/3.1.7/bin:$PATH
46
- ;;
47
- esac
48
- if ! [ "$BUILD" = style ]; then echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]"; fi
49
- set -ex
50
35
case "$BUILD" in
51
36
style)
52
37
./etc/scripts/get-hlint.sh
38
+ export PATH="$(pwd)"/hlint:$PATH
53
39
;;
54
40
cabal)
41
+ sudo add-apt-repository -y ppa:hvr/ghc
42
+ sudo apt-get update
43
+ sudo apt-get install cabal-install-$CABALVER ghc-$GHCVER
44
+ # See note here: https://github.com/haskell-CI/haskell-ci#alex--happy-with-ghc--78
45
+ if [ "$GHCVER" = "head" ] || [ "${GHCVER%.*}" = "7.8" ] || [ "${GHCVER%.*}" = "7.10" ]; then
46
+ sudo apt-get install happy-1.19.4 alex-3.1.3
47
+ export PATH=/opt/alex/3.1.3/bin:/opt/happy/1.19.4/bin:$PATH
48
+ else
49
+ sudo apt-get install happy alex
50
+ fi
51
+ export PATH=$HOME/.local/bin:/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$PATH
55
52
cabal --version
56
53
cabal update
57
- rm -f $HOME/.cabal/bin/stack
58
- echo "stack is located at $(which stack)"
59
- stack --version
60
-
61
- echo Removing any old dist files
62
- rm -f $(stack --stack-yaml=$STACK_YAML path --dist-dir)/stack-*.tar.gz
63
-
64
- echo To avoid custom Cabal setup business, switching temporarily to Simple
65
- cp stack.cabal stack.orig-cabal
66
- sed 's@build-type\:.*@build-type\: Simple@' < stack.orig-cabal > stack.cabal
67
-
68
- echo Generating new dist with pvp bounds in the cabal file
69
- stack --system-ghc --stack-yaml=$STACK_YAML sdist --pvp-bounds=both
70
-
71
- echo Grabbing the newly generated stack.cabal file from the tarball
72
- tar xf $(stack --system-ghc --compiler=ghc-$GHCVER path --dist-dir)/stack-*.tar.gz --wildcards --strip-components=1 '*/stack.cabal'
73
-
74
- echo Switching back to Custom build type
75
- cp stack.cabal stack.orig-cabal
76
- sed 's@build-type\:.*@build-type\: Custom@' < stack.orig-cabal > stack.cabal
77
- rm -f stack.orig-cabal
78
-
79
- echo Performing the actual build now that we have the right stack.cabal
80
- cabal install --only-dependencies --enable-tests --enable-benchmarks --force-reinstalls --ghc-options=-O0 --reorder-goals --max-backjumps=-1
54
+ PACKAGES=$(stack --install-ghc query locals | grep '^ *path' | sed 's@^ *path:@@')
55
+ cabal install --only-dependencies --enable-tests --enable-benchmarks --force-reinstalls --ghc-options=-O0 --reorder-goals --max-backjumps=-1 $CABALARGS $PACKAGES
81
56
;;
82
57
*)
83
- stack --no-terminal build Cabal
84
- stack --no-terminal test --only-dependencies
58
+ export PATH=$HOME/.local/bin:$PATH
59
+ stack --install-ghc $ARGS test --bench --only-dependencies
85
60
;;
86
61
esac
87
- set +ex
88
62
GHC_OPTIONS="-Werror"
89
- if [ $GHCVER = 8.2.1 ]; then GHC_OPTIONS="$GHC_OPTIONS -Wno-missing-home-modules"; fi
63
+ if [ " $GHCVER" = " 8.2.1" ]; then GHC_OPTIONS="$GHC_OPTIONS -Wno-missing-home-modules"; fi
90
64
set -ex
91
65
case "$BUILD" in
92
66
style)
@@ -95,25 +69,35 @@ jobs:
95
69
hlint test/ --cpp-simple
96
70
;;
97
71
stack)
98
- stack --no-terminal test --haddock --no-haddock-deps --ghc-options="$GHC_OPTIONS"
72
+ stack test --haddock --no-haddock-deps --ghc-options="$GHC_OPTIONS"
99
73
;;
100
74
pedantic)
101
- stack --system-ghc --no-terminal build --pedantic
75
+ stack --system-ghc build --pedantic
102
76
;;
103
77
cabal)
104
- cabal configure --enable-tests --enable-benchmarks -v2 --ghc-options="-O0 $GHC_OPTIONS"
105
- cabal build
106
- cabal test
107
- cabal check
108
- cabal sdist
109
- cabal copy
110
- cd test/integration
111
- true stack setup --compiler=ghc-$GHCVER
112
- true stack test --compiler=ghc-$GHCVER
113
- cd ../..
114
- SRC_TGZ=$(cabal info . | awk '{print $2;exit}').tar.gz
115
- (cd dist && cabal install --force-reinstalls "$SRC_TGZ")
116
- ;;
78
+ cabal install --enable-tests --enable-benchmarks --force-reinstalls --ghc-options=-O0 --reorder-goals --max-backjumps=-1 $CABALARGS $PACKAGES
79
+
80
+ ORIGDIR=$(pwd)
81
+ for dir in $PACKAGES
82
+ do
83
+ cd $dir
84
+ cabal check || [ "$CABALVER" == "1.16" ]
85
+ cabal sdist
86
+ PKGVER=$(cabal info . | awk '{print $2;exit}')
87
+ SRC_TGZ=$PKGVER.tar.gz
88
+ cd dist
89
+ tar zxfv "$SRC_TGZ"
90
+ cd "$PKGVER"
91
+ cabal configure --enable-tests --ghc-options -O0
92
+ cabal build
93
+ if [ "$CABALVER" = "1.16" ] || [ "$CABALVER" = "1.18" ]; then
94
+ cabal test
95
+ else
96
+ cabal test --show-details=streaming
97
+ fi
98
+ cd $ORIGDIR
99
+ done
100
+ ;;
117
101
esac
118
102
set +ex
119
103
env:
0 commit comments