Skip to content

Commit

Permalink
Update CI testscript
Browse files Browse the repository at this point in the history
  - Avoid unnecessary rebuild of dependencies caused by the artificial
    separation between "prepare" and "build" (wasn't able to figure out
    what causes Stack to do that)

  - Avoid spurious warnings caused by missing configure and
    HsDirectoryConfig.h.in by running autoreconf earlier

  - Use extra-deps instead of ad hoc approach to override dependencies

  - The previous change requires creating the stack.yaml manually, which
    ends up being simpler than using "stack init" (only downside is that
    you have to specify the full LTS version, not just the major
    version).

  - Remove caching in AppVeyor for now.  Having four jobs means that
    there's not enough room in the cache, apparently causing strange
    build failures due to corrupt cache files being loaded.

  - Refactor the testscript slightly
  • Loading branch information
Rufflewind committed Sep 26, 2017
1 parent 781a693 commit da1a2e8
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 43 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ language: c # make the validator happy
sudo: false
matrix:
include:
# CABALVER=1.16 is the earliest available in the PPA
- env: STACK="stack --resolver lts-5"
- env: STACK_RESOLVER=lts-5.18
os: osx
# CABALVER=1.16 is the earliest available in the PPA
- env: GHCVER=7.4.2 CABALVER=1.16
PREBUILD="sed -i.bak /utimensat/d configure.ac"
addons:
Expand Down
22 changes: 12 additions & 10 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,20 @@ environment:
# use a short path prefix to avoid running into path-length limitations
STACK_ROOT: C:\sr
matrix:
- DEPS: Win32-2.6.0.0
STACK: stack --skip-msys --resolver lts-9
- DEPS: Win32-2.4.0.0
STACK: stack --skip-msys --resolver lts-7
- DEPS: # Win32-2.3.1.0
STACK: stack --skip-msys --resolver lts-5
- DEPS: Win32-2.3.0.1
STACK: stack --skip-msys --resolver lts-2
- STACK_FLAGS: --skip-msys
STACK_RESOLVER: lts-9.6
STACK_EXTRA_DEPS: Win32-2.6.0.0
- STACK_FLAGS: --skip-msys
STACK_RESOLVER: lts-7.24
STACK_EXTRA_DEPS: Win32-2.4.0.0
- STACK_FLAGS: --skip-msys
STACK_RESOLVER: lts-5.18
# STACK_EXTRA_DEPS: Win32-2.3.1.0
- STACK_FLAGS: --skip-msys
STACK_RESOLVER: lts-2.22
STACK_EXTRA_DEPS: Win32-2.3.0.1
PREBUILD: sed -i.bak -e /CreateSymbolicLinkW/d
-e /GetFinalPathNameByHandleW/d configure.ac
cache:
- "%STACK_ROOT%"
install:
- set PATH=%CD%\_stack;C:\msys64\usr\bin;%PATH%
- sh tools/testscript prepare
Expand Down
64 changes: 33 additions & 31 deletions tools/testscript
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,32 @@ set -eu
ghcflags="-rtsopts -threaded -Werror"
testflags="CreateDirectoryIfMissing001.num-repeats=100000 +RTS -N2"

before_build() {
# workaround for https://github.com/haskell/cabal/issues/2375
if grep "^resolver: lts-2" stack.yaml >/dev/null 2>&1; then
sed -i.bak 's/WithHooks autoconfUserHooks//' Setup.hs
stack exec sh ./configure
fi
}

prepare() {
eval "${PREBUILD-}"
if [ "${STACK+x}" ]; then

stack="$STACK --no-terminal"
mkdir -p _stack
if [ -f configure.ac ]; then
autoreconf -i
fi
if [ "${STACK_RESOLVER+x}" ]; then

# workaround for commercialhaskell/stack#3213:
# use official GHC tarball instead of stack's patched tarball
if [ "${LOCALAPPDATA-}" ] && printf "%s\n" "$STACK" | grep '\<lts-2\>'; then
dir=`cygpath -u "$LOCALAPPDATA"`/Programs/stack/x86_64-windows
mkdir -p "$dir"
curl -L "https://downloads.haskell.org/~ghc/7.8.4/ghc-7.8.4-x86_64-unknown-mingw32.tar.xz" | tar -C "$dir" -xJ
echo installed >"$dir/ghc-7.8.4.installed"
fi
case $STACK_RESOLVER in
lts-2*)
if [ "${LOCALAPPDATA-}" ]; then
dir=`cygpath -u "$LOCALAPPDATA"`/Programs/stack/x86_64-windows
mkdir -p "$dir"
curl -L "https://downloads.haskell.org/~ghc/7.8.4/ghc-7.8.4-x86_64-unknown-mingw32.tar.xz" | tar -C "$dir" -xJ
echo installed >"$dir/ghc-7.8.4.installed"
fi;;
esac

cat >stack.yaml <<EOF
resolver: $STACK_RESOLVER
packages: [.]
extra-deps: [${STACK_EXTRA_DEPS-}]
EOF
stack="stack --no-terminal ${STACK_FLAGS-}"
mkdir -p _stack

(
cd _stack
Expand Down Expand Up @@ -56,12 +59,6 @@ prepare() {
tools/retry $stack setup >/dev/null
$stack ghc -- --version
$stack --version
for dep in ${DEPS-}; do
url=https://hackage.haskell.org/package/${dep}/${dep}.tar.gz
curl --retry 3 -fsLS "$url" | tar xzf -
done
$stack init && :
$stack test --install-ghc --only-dependencies
$stack list-dependencies

else
Expand All @@ -72,16 +69,21 @@ prepare() {
cabal install --enable-tests --only-dependencies

fi
if [ -f configure.ac ]; then
autoreconf -i
fi
}

build() {
before_build
if [ "${STACK+x}" ]; then

stack="$STACK --no-terminal"
if [ "${STACK_RESOLVER+x}" ]; then

# workaround for https://github.com/haskell/cabal/issues/2375
case $STACK_RESOLVER in
lts-2*)
if [ -f configure ]; then
sed -i.bak 's/WithHooks autoconfUserHooks//' Setup.hs
stack exec sh ./configure
fi;;
esac

stack="stack --no-terminal ${STACK_FLAGS-}"
$stack test --haddock --no-haddock-deps \
--ghc-options "$ghcflags" \
--test-arguments "$testflags"
Expand Down

0 comments on commit da1a2e8

Please sign in to comment.