@@ -24,69 +24,43 @@ jobs:
2424 maxParallel : 5
2525 steps :
2626 - script : |
27- echo $OS_NAME
2827 export STACK_ROOT="$(Build.SourcesDirectory)"/.stack-root;
29- echo $STACK_ROOT
3028 mkdir -p ~/.local/bin
3129 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
3230 tar xzf ~/.local/bin/cache-s3.tar.gz -C ~/.local/bin
3331 export PATH=$HOME/.local/bin:$PATH;
3432 cache-s3 --prefix="${CACHE_S3_PREFIX}" --git-branch="$(Build.SourceBranchName)" --suffix="${OS_NAME}" restore stack --base-branch="${BASE_BRANCH}"
3533 cache-s3 --prefix="${CACHE_S3_PREFIX}" --git-branch="$(Build.SourceBranchName)" --suffix="${OS_NAME}" restore stack work --base-branch="${BASE_BRANCH}"
3634 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
5035 case "$BUILD" in
5136 style)
5237 ./etc/scripts/get-hlint.sh
38+ export PATH="$(pwd)"/hlint:$PATH
5339 ;;
5440 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
5552 cabal --version
5653 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
8156 ;;
8257 *)
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
8560 ;;
8661 esac
87- set +ex
8862 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
9064 set -ex
9165 case "$BUILD" in
9266 style)
@@ -95,25 +69,35 @@ jobs:
9569 hlint test/ --cpp-simple
9670 ;;
9771 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"
9973 ;;
10074 pedantic)
101- stack --system-ghc --no-terminal build --pedantic
75+ stack --system-ghc build --pedantic
10276 ;;
10377 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+ ;;
117101 esac
118102 set +ex
119103 env:
0 commit comments