Commit 37159ac8 authored by Mikhail Glushenkov's avatar Mikhail Glushenkov Committed by GitHub
Browse files

Merge pull request #3966 from quchen/stack-build

Add CI target for building Cabal using Stack
parents 8cc00a20 a77e8b73
......@@ -19,7 +19,7 @@ branches:
# lines listings versions you don't need/want testing for.
matrix:
include:
- env: GHCVER=none SCRIPT=meta
- env: GHCVER=none SCRIPT=meta BUILDER=none
os: linux
# These don't have -dyn/-prof whitelisted yet, so we have to
# do the old-style installation
......@@ -58,9 +58,18 @@ matrix:
os: osx
- env: GHCVER=8.0.1 SCRIPT=bootstrap
os: osx
- env: GHCVER=via-stack SCRIPT=stack STACKAGE_RESOLVER=lts
os: linux
addons:
apt:
packages:
- libgmp-dev
allow_failures:
- env: GHCVER=head
sudo: required
- env: GHCVER=via-stack SCRIPT=stack STACKAGE_RESOLVER=lts
# TODO add PARSEC_BUNDLED=YES when it's so
# It seems pointless to run head if we're going to ignore the results.
......@@ -72,6 +81,7 @@ before_install:
- export PATH=$HOME/.ghc-install/$GHCVER/bin:$PATH
- export PATH=$HOME/bin:$PATH
- export PATH=$HOME/.cabal/bin:$PATH
- export PATH=$HOME/.local/bin:$PATH
- export PATH=/opt/cabal/1.24/bin:$PATH
- export PATH=/opt/happy/1.19.5/bin:$PATH
- ./travis-install.sh
......@@ -99,6 +109,12 @@ cache:
- $HOME/.cabal/store
- $HOME/.cabal/bin
- $HOME/.stack/bin
- $HOME/.stack/precompiled
- $HOME/.stack/programs
- $HOME/.stack/setup-exe-cache
- $HOME/.stack/snapshots
# We remove the index because it churns quite a bit and we don't want
# to pay the cost of repeatedly caching it even though we don't care
# about most changing packages.
......
......@@ -9,60 +9,69 @@ if [ "$GHCVER" = "none" ]; then
exit 0
fi
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
travis_retry sudo add-apt-repository -y ppa:hvr/ghc
travis_retry sudo apt-get update
travis_retry sudo apt-get install --force-yes cabal-install-1.24 happy-1.19.5 ghc-$GHCVER-prof ghc-$GHCVER-dyn
if [ "$TEST_OLDER" == "YES" ]; then travis_retry sudo apt-get install --force-yes ghc-7.0.4-prof ghc-7.0.4-dyn ghc-7.2.2-prof ghc-7.2.2-dyn; fi
if [ -z ${STACKAGE_RESOLVER+x} ]; then
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
travis_retry sudo add-apt-repository -y ppa:hvr/ghc
travis_retry sudo apt-get update
travis_retry sudo apt-get install --force-yes cabal-install-1.24 happy-1.19.5 ghc-$GHCVER-prof ghc-$GHCVER-dyn
if [ "$TEST_OLDER" == "YES" ]; then travis_retry sudo apt-get install --force-yes ghc-7.0.4-prof ghc-7.0.4-dyn ghc-7.2.2-prof ghc-7.2.2-dyn; fi
elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
case $GHCVER in
8.0.1)
GHCURL=http://downloads.haskell.org/~ghc/8.0.1/ghc-8.0.1-x86_64-apple-darwin.tar.xz;
GHCXZ=YES
;;
7.10.3)
GHCURL=http://downloads.haskell.org/~ghc/7.10.3/ghc-7.10.3b-x86_64-apple-darwin.tar.xz
GHCXZ=YES
;;
7.8.4)
GHCURL=https://www.haskell.org/ghc/dist/7.8.4/ghc-7.8.4-x86_64-apple-darwin.tar.xz
GHCXZ=YES
;;
7.6.3)
GHCURL=https://www.haskell.org/ghc/dist/7.6.3/ghc-7.6.3-x86_64-apple-darwin.tar.bz2
;;
7.4.2)
GHCURL=https://www.haskell.org/ghc/dist/7.4.2/ghc-7.4.2-x86_64-apple-darwin.tar.bz2
;;
*)
echo "Unknown GHC: $GHCVER"
false
;;
esac
case $GHCVER in
8.0.1)
GHCURL=http://downloads.haskell.org/~ghc/8.0.1/ghc-8.0.1-x86_64-apple-darwin.tar.xz;
GHCXZ=YES
;;
7.10.3)
GHCURL=http://downloads.haskell.org/~ghc/7.10.3/ghc-7.10.3b-x86_64-apple-darwin.tar.xz
GHCXZ=YES
;;
7.8.4)
GHCURL=https://www.haskell.org/ghc/dist/7.8.4/ghc-7.8.4-x86_64-apple-darwin.tar.xz
GHCXZ=YES
;;
7.6.3)
GHCURL=https://www.haskell.org/ghc/dist/7.6.3/ghc-7.6.3-x86_64-apple-darwin.tar.bz2
;;
7.4.2)
GHCURL=https://www.haskell.org/ghc/dist/7.4.2/ghc-7.4.2-x86_64-apple-darwin.tar.bz2
;;
*)
echo "Unknown GHC: $GHCVER"
false
;;
esac
travis_retry curl -OL $GHCURL
if [ "$GHCXZ" = "YES" ]; then
tar -xJf ghc-*.tar.*;
else
tar -xjf ghc-*.tar.*;
fi
cd ghc-*;
./configure --prefix=$HOME/.ghc-install/$GHCVER
make install;
cd ..;
travis_retry curl -L https://www.haskell.org/cabal/release/cabal-install-1.24.0.0/cabal-install-1.24.0.0-x86_64-apple-darwin-yosemite.tar.gz -o cabal-install.tar.gz
TAR=$PWD/cabal-install.tar.gz
mkdir "${HOME}/bin"
(cd "${HOME}/bin" && tar -xzf "$TAR")
"${HOME}/bin/cabal" --version
travis_retry curl -OL $GHCURL
if [ "$GHCXZ" = "YES" ]; then
tar -xJf ghc-*.tar.*;
else
tar -xjf ghc-*.tar.*;
echo "Not linux or osx: $TRAVIS_OS_NAME"
false
fi
cd ghc-*;
./configure --prefix=$HOME/.ghc-install/$GHCVER
make install;
cd ..;
travis_retry curl -L https://www.haskell.org/cabal/release/cabal-install-1.24.0.0/cabal-install-1.24.0.0-x86_64-apple-darwin-yosemite.tar.gz -o cabal-install.tar.gz
TAR=$PWD/cabal-install.tar.gz
mkdir "${HOME}/bin"
(cd "${HOME}/bin" && tar -xzf "$TAR")
"${HOME}/bin/cabal" --version
else # Stack-based builds
mkdir -p ~/.local/bin
travis_retry curl -L https://www.stackage.org/stack/linux-x86_64 \
| tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'
stack setup --resolver "$STACKAGE_RESOLVER"
else
echo "Not linux or osx: $TRAVIS_OS_NAME"
false
fi
git version
#!/bin/sh
if [ -z ${STACKAGE_RESOLVER+x} ]; then
echo "STACKAGE_RESOLVER environment variable not set."
echo "This build case is not configured correctly."
exit 1
fi
. ./travis-common.sh
# ---------------------------------------------------------------------
# Build Cabal via Stack(age).
# ---------------------------------------------------------------------
stack build \
--no-terminal \
--resolver "$STACKAGE_RESOLVER"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment