Skip to content

Commit a780bef

Browse files
committed
Build on travis with cabal too
1 parent 026c32e commit a780bef

2 files changed

Lines changed: 81 additions & 42 deletions

File tree

.travis-setup.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,21 @@
22

33
set -eux
44

5+
case "$BUILD" in
6+
stack)
7+
mkdir -p ~/.local/bin;
8+
if [ `uname` = "Darwin" ]; then
9+
curl -L https://www.stackage.org/stack/osx-x86_64 | tar xz --strip-components=1 --include '*/stack' -C ~/.local/bin;
10+
else
11+
curl -L https://www.stackage.org/stack/linux-x86_64 | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack';
12+
fi
13+
stack --no-terminal setup;;
14+
cabal)
515
mkdir -p $HOME/.cabal
616
cat > $HOME/.cabal/config <<EOF
717
remote-repo: hackage.haskell.org:http://hackage.fpcomplete.com/
818
remote-repo-cache: $HOME/.cabal/packages
919
jobs: \$ncpus
1020
EOF
21+
;;
22+
esac

.travis.yml

Lines changed: 69 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -7,64 +7,91 @@
77
# sane build environment. In CI, we want to make our life more difficult, so we
88
# use cabal without any Stackage snapshots.
99
#
10+
language: c
1011
sudo: false
1112

1213
cache:
1314
directories:
1415
- $HOME/.ghc
1516
- $HOME/.cabal
17+
- $HOME/.stack
1618

17-
addons:
18-
apt:
19-
sources:
20-
- hvr-ghc
21-
packages:
22-
- cabal-install-1.18
23-
- cabal-install-1.22
24-
- cabal-install-head
25-
- ghc-7.8.4
26-
- ghc-7.10.1
27-
- ghc-7.10.2
28-
- ghc-head
19+
matrix:
20+
include:
21+
- env: BUILD=cabal CABALVER=1.18 GHCVER=7.8.4
22+
compiler: ": #GHC 7.8.4"
23+
addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.4], sources: [hvr-ghc]}}
2924

30-
env:
31-
- CABALVER=1.18 GHCVER=7.8.4
32-
- CABALVER=1.22 GHCVER=7.10.1
33-
- CABALVER=1.22 GHCVER=7.10.2
34-
- CABALVER=head GHCVER=head # see section about GHC HEAD snapshots
25+
- env: BUILD=cabal CABALVER=1.22 GHCVER=7.10.1
26+
compiler: ": #GHC 7.10.1"
27+
addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.1], sources: [hvr-ghc]}}
28+
29+
- env: BUILD=cabal CABALVER=1.22 GHCVER=7.10.2
30+
compiler: ": #GHC 7.10.2"
31+
addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.2], sources: [hvr-ghc]}}
32+
33+
- env: BUILD=cabal CABALVER=1.22 GHCVER=7.10.3
34+
compiler: ": #GHC 7.10.3"
35+
addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.3], sources: [hvr-ghc]}}
36+
37+
- env: BUILD=stack GHCVER=7.8.4 STACK_YAML=stack-7.8.yaml
38+
compiler: ": #stack 7.8.4"
39+
addons: {apt: {packages: [cabal-install-head,ghc-7.8.4], sources: [hvr-ghc]}}
40+
41+
- env: BUILD=stack GHCVER=7.10.2 STACK_YAML=stack.yaml
42+
compiler: ": #stack 7.10.2"
43+
addons: {apt: {packages: [cabal-install-head,ghc-7.10.2], sources: [hvr-ghc]}}
44+
45+
- env: BUILD=cabal CABALVER=head GHCVER=head
46+
compiler: ": #GHC head"
47+
addons: {apt: {packages: [cabal-install-head,ghc-head], sources: [hvr-ghc]}}
48+
49+
- env: BUILD=stack STACK_YAML=stack.yaml
50+
compiler: ": #stack 7.10.2 osx"
51+
os: osx
3552

36-
matrix:
3753
allow_failures:
38-
- env: CABALVER=head GHCVER=head
54+
- env: BUILD=cabal CABALVER=head GHCVER=head
3955

4056
# Note: the distinction between `before_install` and `install` is not important.
57+
# - in before_install we install build tools
58+
# - in install we install (haskell) dependencies
4159
before_install:
42-
- export PATH=$HOME/.cabal/bin:/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$PATH
60+
- unset CC
61+
- case "$BUILD" in
62+
stack)
63+
export PATH=$HOME/.local/bin:/opt/ghc/$GHCVER/bin:$PATH;;
64+
cabal)
65+
export PATH=$HOME/.cabal/bin:/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$PATH;;
66+
esac
4367
- ./.travis-setup.sh
4468

4569
install:
46-
- cabal --version
4770
- echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]"
48-
- travis_retry cabal update
49-
- cabal install --only-dependencies --constraint="ignore +without-pcre" --enable-tests --enable-benchmarks --force-reinstalls --ghc-options=-O0
71+
- case "$BUILD" in
72+
stack)
73+
stack --no-terminal test --only-dependencies;;
74+
cabal)
75+
cabal --version;
76+
travis_retry cabal update;
77+
cabal install --only-dependencies --constraint="ignore +without-pcre" --enable-tests --enable-benchmarks --force-reinstalls --ghc-options=-O0;;
78+
esac
5079

5180
script:
52-
- if [ -f configure.ac ]; then autoreconf -i; fi
53-
- cabal configure --enable-tests --enable-benchmarks -v2 --ghc-options="-O0 -Werror" # -v2 provides useful information for debugging
54-
- cabal build # this builds all libraries and executables (including tests/benchmarks)
55-
- cabal test
56-
- cabal check
57-
- cabal sdist # tests that a source-distribution can be generated
58-
59-
- cabal copy
60-
- cd test/integration
61-
# Takes too long for now
62-
# - stack setup
63-
# - stack test
64-
- cd ../..
65-
66-
# Check that the resulting source distribution can be built & installed.
67-
# If there are no other `.tar.gz` files in `dist`, this can be even simpler:
68-
# `cabal install --force-reinstalls dist/*-*.tar.gz`
69-
- SRC_TGZ=$(cabal info . | awk '{print $2;exit}').tar.gz &&
70-
(cd dist && cabal install --force-reinstalls "$SRC_TGZ")
81+
- case "$BUILD" in
82+
stack)
83+
stack --no-terminal test;;
84+
cabal)
85+
cabal configure --enable-tests --enable-benchmarks -v2 --ghc-options="-O0 -Werror";
86+
cabal build;
87+
cabal test;
88+
cabal check;
89+
cabal sdist;
90+
cabal copy;
91+
cd test/integration;
92+
true stack setup;
93+
true stack test;
94+
cd ../..;
95+
SRC_TGZ=$(cabal info . | awk '{print $2;exit}').tar.gz &&
96+
(cd dist && cabal install --force-reinstalls "$SRC_TGZ");;
97+
esac

0 commit comments

Comments
 (0)