Skip to content

Commit 48f4bef

Browse files
authored
Merge pull request #4542 from psibi/azure-simplify
Simplify Azure CI config and match it up with Stack docs
2 parents ab1e0db + b028218 commit 48f4bef

6 files changed

+46
-148
lines changed

.azure/azure-linux-template.yml

Lines changed: 42 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -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:

.azure/azure-nightly-template-linux.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,6 @@ jobs:
2222
cache-s3 --prefix="${CACHE_S3_PREFIX}" --git-branch="$(Build.SourceBranchName)" --suffix="${OS_NAME}" restore stack work --base-branch="${BASE_BRANCH}"
2323
etc/scripts/ci-setup.sh
2424
export PATH=$HOME/.local/bin:/opt/ghc/$GHCVER/bin:/opt/happy/1.19.5/bin:/opt/alex/3.1.7/bin:$PATH
25-
if ! [ "$BUILD" = style ]; then echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]"; fi
26-
set -ex
27-
stack --no-terminal install cabal-install
28-
set +ex
2925
env:
3026
OS_NAME: ${{ parameters.os }}
3127
AWS_ACCESS_KEY_ID: $(AWS_ACCESS_KEY_ID)

.azure/azure-nightly-template-osx.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@ jobs:
2525
etc/scripts/ci-setup.sh
2626
brew install mercurial
2727
export PATH=$HOME/.local/bin:/opt/ghc/$GHCVER/bin:/opt/happy/1.19.5/bin:/opt/alex/3.1.7/bin:$PATH
28-
set -ex
29-
stack --no-terminal install cabal-install
30-
set +ex
3128
env:
3229
OS_NAME: ${{ parameters.os }}
3330
displayName: 'Installation ${{parameters.os}}'

.azure/azure-nightly-template-windows.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ jobs:
3030
curl -sSkL http://www.stackage.org/stack/windows-i386 -o /usr/bin/stack.zip
3131
unzip -o /usr/bin/stack.zip -d /usr/bin/
3232
stack setup
33-
stack --no-terminal install cabal-install
3433
stack --version
3534
env:
3635
OS_NAME: ${{ parameters.os }}

.azure/azure-osx-template.yml

Lines changed: 3 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ jobs:
1515
export AWS_ACCESS_KEY_ID="$(AWS_ACCESS_KEY_ID)";
1616
export AWS_SECRET_ACCESS_KEY="$(AWS_SECRET_ACCESS_KEY)";
1717
export STACK_ROOT="$(Build.SourcesDirectory)"/.stack-root;
18-
echo $STACK_ROOT
1918
mkdir -p ~/.local/bin
2019
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
2120
tar xzf ~/.local/bin/cache-s3.tar.gz -C ~/.local/bin
@@ -24,87 +23,10 @@ jobs:
2423
cache-s3 --prefix="${CACHE_S3_PREFIX}" --git-branch="$(Build.SourceBranchName)" --suffix="${OS_NAME}" restore stack work --base-branch="${BASE_BRANCH}"
2524
etc/scripts/ci-setup.sh
2625
brew install mercurial
27-
case "$BUILD" in
28-
style)
29-
export PATH="$TRAVIS_BUILD_DIR"/hlint:$PATH
30-
;;
31-
cabal)
32-
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
33-
;;
34-
*)
35-
export PATH=$HOME/.local/bin:/opt/ghc/$GHCVER/bin:/opt/happy/1.19.5/bin:/opt/alex/3.1.7/bin:$PATH
36-
;;
37-
esac
38-
if ! [ "$BUILD" = style ]; then echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]"; fi
39-
set -ex
40-
case "$BUILD" in
41-
style)
42-
./etc/scripts/get-hlint.sh
43-
;;
44-
cabal)
45-
cabal --version
46-
cabal update
47-
rm -f $HOME/.cabal/bin/stack
48-
echo "stack is located at $(which stack)"
49-
stack --version
50-
51-
echo Removing any old dist files
52-
rm -f $(stack --stack-yaml=$STACK_YAML path --dist-dir)/stack-*.tar.gz
53-
54-
echo To avoid custom Cabal setup business, switching temporarily to Simple
55-
cp stack.cabal stack.orig-cabal
56-
sed 's@build-type\:.*@build-type\: Simple@' < stack.orig-cabal > stack.cabal
57-
58-
echo Generating new dist with pvp bounds in the cabal file
59-
stack --system-ghc --stack-yaml=$STACK_YAML sdist --pvp-bounds=both
60-
61-
echo Grabbing the newly generated stack.cabal file from the tarball
62-
tar xf $(stack --system-ghc --compiler=ghc-$GHCVER path --dist-dir)/stack-*.tar.gz --wildcards --strip-components=1 '*/stack.cabal'
63-
64-
echo Switching back to Custom build type
65-
cp stack.cabal stack.orig-cabal
66-
sed 's@build-type\:.*@build-type\: Custom@' < stack.orig-cabal > stack.cabal
67-
rm -f stack.orig-cabal
68-
69-
echo Performing the actual build now that we have the right stack.cabal
70-
cabal install --only-dependencies --enable-tests --enable-benchmarks --force-reinstalls --ghc-options=-O0 --reorder-goals --max-backjumps=-1
71-
;;
72-
*)
73-
stack --no-terminal build Cabal
74-
stack --no-terminal test --only-dependencies
75-
;;
76-
esac
77-
set +ex
78-
GHC_OPTIONS="-Werror"
79-
if [ $GHCVER = 8.2.1 ]; then GHC_OPTIONS="$GHC_OPTIONS -Wno-missing-home-modules"; fi
26+
export PATH=$HOME/.local/bin:$PATH
8027
set -ex
81-
case "$BUILD" in
82-
style)
83-
hlint src/
84-
hlint src/ --cpp-define=WINDOWS=1
85-
hlint test/ --cpp-simple
86-
;;
87-
stack)
88-
stack --no-terminal test --haddock --no-haddock-deps --ghc-options="$GHC_OPTIONS"
89-
;;
90-
pedantic)
91-
stack --system-ghc --no-terminal build --pedantic
92-
;;
93-
cabal)
94-
cabal configure --enable-tests --enable-benchmarks -v2 --ghc-options="-O0 $GHC_OPTIONS"
95-
cabal build
96-
cabal test
97-
cabal check
98-
cabal sdist
99-
cabal copy
100-
cd test/integration
101-
true stack setup --compiler=ghc-$GHCVER
102-
true stack test --compiler=ghc-$GHCVER
103-
cd ../..
104-
SRC_TGZ=$(cabal info . | awk '{print $2;exit}').tar.gz
105-
(cd dist && cabal install --force-reinstalls "$SRC_TGZ")
106-
;;
107-
esac
28+
stack --install-ghc $ARGS test --bench --only-dependencies
29+
stack $ARGS test --bench --no-run-benchmarks --haddock --no-haddock-deps
10830
set +ex
10931
env:
11032
OS_NAME: ${{ parameters.os }}

.azure/azure-windows-template.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
curl -sSkL http://www.stackage.org/stack/windows-i386 -o /usr/bin/stack.zip
3333
unzip -o /usr/bin/stack.zip -d /usr/bin/
3434
stack setup
35-
stack --no-terminal test --jobs 1
35+
stack test --jobs 1
3636
env:
3737
OS_NAME: ${{ parameters.os }}
3838
displayName: 'Installation ${{parameters.os}}'

0 commit comments

Comments
 (0)