Skip to content

Commit 17a5054

Browse files
committed
Use make_travis_yml to generate .travis.yml
1 parent 572a10f commit 17a5054

File tree

2 files changed

+86
-47
lines changed

2 files changed

+86
-47
lines changed

.travis.yml

Lines changed: 79 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,89 @@
1-
# It seems that we can't use the CABALVER and GHCVER environment variables in a
2-
# toplevel addons.apt.packages section, so we have to duplicate things below.
1+
# This file has been generated -- see https://github.com/hvr/multi-ghc-travis
2+
language: c
3+
sudo: false
4+
5+
cache:
6+
directories:
7+
- $HOME/.cabsnap
8+
- $HOME/.cabal/packages
9+
10+
before_cache:
11+
- rm -fv $HOME/.cabal/packages/hackage.haskell.org/build-reports.log
12+
- rm -fv $HOME/.cabal/packages/hackage.haskell.org/00-index.tar
13+
314
matrix:
415
include:
5-
- env: CABALVER=1.20 GHCVER=7.8.4
6-
addons:
7-
apt:
8-
sources:
9-
- hvr-ghc
10-
packages:
11-
- cabal-install-1.20
12-
- ghc-7.8.4
13-
- env: CABALVER=1.22 GHCVER=7.10.3
14-
addons:
15-
apt:
16-
sources:
17-
- hvr-ghc
18-
packages:
19-
- cabal-install-1.22
20-
- ghc-7.10.3
21-
- env: CABALVER=1.24 GHCVER=8.0.1
22-
addons:
23-
apt:
24-
sources:
25-
- hvr-ghc
26-
packages:
27-
- cabal-install-1.24
28-
- ghc-8.0.1
29-
- env: CABALVER=head GHCVER=head
30-
addons:
31-
apt:
32-
sources:
33-
- hvr-ghc
34-
packages:
35-
- cabal-install-head
36-
- ghc-head
16+
- env: CABALVER=1.18 GHCVER=7.8.4
17+
compiler: ": #GHC 7.8.4"
18+
addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.4], sources: [hvr-ghc]}}
19+
- env: CABALVER=1.22 GHCVER=7.10.3
20+
compiler: ": #GHC 7.10.3"
21+
addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.3], sources: [hvr-ghc]}}
22+
- env: CABALVER=1.24 GHCVER=8.0.1
23+
compiler: ": #GHC 8.0.1"
24+
addons: {apt: {packages: [cabal-install-1.24,ghc-8.0.1], sources: [hvr-ghc]}}
25+
- env: CABALVER=head GHCVER=head
26+
compiler: ": #GHC head"
27+
addons: {apt: {packages: [cabal-install-head,ghc-head], sources: [hvr-ghc]}}
28+
3729
allow_failures:
38-
- env: CABALVER=head GHCVER=head
30+
- env: CABALVER=head GHCVER=head
3931

40-
sudo: false
32+
before_install:
33+
- unset CC
34+
- export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$PATH
4135

42-
# The packages from the PPA don't put this into the PATH automatically.
4336
install:
44-
- export PATH="/opt/cabal/$CABALVER/bin:/opt/ghc/$GHCVER/bin:$PATH"
45-
46-
before_script:
4737
- cabal --version
48-
- cabal update
49-
- ghc --version
50-
- ghc-pkg list
38+
- echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]"
39+
- if [ -f $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz ];
40+
then
41+
zcat $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz >
42+
$HOME/.cabal/packages/hackage.haskell.org/00-index.tar;
43+
fi
44+
- travis_retry cabal update -v
45+
- sed -i 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config
46+
- cabal install --only-dependencies --enable-tests --enable-benchmarks --dry -v > installplan.txt
47+
- sed -i -e '1,/^Resolving /d' installplan.txt; cat installplan.txt
48+
49+
# check whether current requested install-plan matches cached package-db snapshot
50+
- if diff -u installplan.txt $HOME/.cabsnap/installplan.txt;
51+
then
52+
echo "cabal build-cache HIT";
53+
rm -rfv .ghc;
54+
cp -a $HOME/.cabsnap/ghc $HOME/.ghc;
55+
cp -a $HOME/.cabsnap/lib $HOME/.cabsnap/share $HOME/.cabsnap/bin $HOME/.cabal/;
56+
else
57+
echo "cabal build-cache MISS";
58+
rm -rf $HOME/.cabsnap;
59+
mkdir -p $HOME/.ghc $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin;
60+
cabal install --only-dependencies --enable-tests --enable-benchmarks;
61+
fi
5162

63+
# snapshot package-db on cache miss
64+
- if [ ! -d $HOME/.cabsnap ];
65+
then
66+
echo "snapshotting package-db to build-cache";
67+
mkdir $HOME/.cabsnap;
68+
cp -a $HOME/.ghc $HOME/.cabsnap/ghc;
69+
cp -a $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin installplan.txt $HOME/.cabsnap/;
70+
fi
71+
72+
# Here starts the actual work to be performed for the package under test;
73+
# any command which exits with a non-zero exit code causes the build to fail.
5274
script:
53-
- cabal install --enable-documentation
54-
- cabal sdist
75+
- if [ -f configure.ac ]; then autoreconf -i; fi
76+
- cabal configure --enable-tests --enable-benchmarks --ghc-options=-Werror -v2 # -v2 provides useful information for debugging
77+
- cabal build # this builds all libraries and executables (including tests/benchmarks)
78+
- cabal test
79+
- cabal check
80+
- cabal haddock # tests that documentation can be generated
81+
- cabal sdist # tests that a source-distribution can be generated
82+
83+
# Check that the resulting source distribution can be built & installed.
84+
# If there are no other `.tar.gz` files in `dist`, this can be even simpler:
85+
# `cabal install --force-reinstalls dist/*-*.tar.gz`
86+
- SRC_TGZ=$(cabal info . | awk '{print $2;exit}').tar.gz &&
87+
(cd dist && cabal install --force-reinstalls "$SRC_TGZ")
5588

56-
after_script:
57-
- ghc-pkg list
89+
# EOF

OpenGL.cabal

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ author: Sven Panne
2020
maintainer: Sven Panne <svenpanne@gmail.com>, Jason Dagit <dagitj@gmail.com>
2121
category: Graphics
2222
build-type: Simple
23+
tested-with:
24+
GHC == 7.8.4
25+
GHC == 7.10.3
26+
GHC == 8.0.1
27+
GHC == 8.1
2328
cabal-version: >= 1.10
2429
extra-source-files:
2530
CHANGELOG.md
@@ -147,6 +152,8 @@ library
147152
Graphics.Rendering.OpenGL.GLU.ErrorsInternal
148153
hs-source-dirs: src
149154
ghc-options: -Wall
155+
if impl(ghc > 8)
156+
ghc-options: -Wcompat
150157
build-depends:
151158
base >= 3 && < 5,
152159
bytestring >= 0.9 && < 0.11,

0 commit comments

Comments
 (0)