Skip to content

Commit f11ba46

Browse files
committed
add .travis.yml generated by haskell-ci
1 parent 7b4f668 commit f11ba46

1 file changed

Lines changed: 102 additions & 57 deletions

File tree

.travis.yml

Lines changed: 102 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,123 @@
1-
# This file has been generated -- see https://github.com/hvr/multi-ghc-travis
21
language: c
3-
sudo: false
2+
dist: xenial
3+
4+
git:
5+
submodules: false # whether to recursively clone submodules
46

57
cache:
68
directories:
7-
- $HOME/.cabsnap
89
- $HOME/.cabal/packages
10+
- $HOME/.cabal/store
911

1012
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+
- rm -fv $CABALHOME/packages/hackage.haskell.org/build-reports.log
14+
# remove files that are regenerated by 'cabal update'
15+
- rm -fv $CABALHOME/packages/hackage.haskell.org/00-index.*
16+
- rm -fv $CABALHOME/packages/hackage.haskell.org/*.json
17+
- rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.cache
18+
- rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.tar
19+
- rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.tar.idx
20+
21+
- rm -rfv $CABALHOME/packages/head.hackage
1322

1423
matrix:
1524
include:
16-
- env: CABALVER=1.22 GHCVER=7.10.2
17-
compiler: ": #GHC 7.10.2"
18-
addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.2], sources: [hvr-ghc]}}
19-
- env: CABALVER=1.24 GHCVER=8.0.1
20-
compiler: ": #GHC 8.0.1"
21-
addons: {apt: {packages: [cabal-install-1.24,ghc-8.0.1], sources: [hvr-ghc]}}
25+
- compiler: "ghc-8.8.1"
26+
env: GHCHEAD=true
27+
addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.4,ghc-8.8.1], sources: [hvr-ghc]}}
28+
- compiler: "ghc-8.6.5"
29+
addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.4,ghc-8.6.5], sources: [hvr-ghc]}}
30+
- compiler: "ghc-8.4.4"
31+
addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.4,ghc-8.4.4], sources: [hvr-ghc]}}
32+
- compiler: "ghc-8.2.2"
33+
addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.4,ghc-8.2.2], sources: [hvr-ghc]}}
34+
- compiler: "ghc-8.0.2"
35+
addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.4,ghc-8.0.2], sources: [hvr-ghc]}}
36+
- compiler: "ghc-7.10.3"
37+
addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.4,ghc-7.10.3], sources: [hvr-ghc]}}
38+
- compiler: "ghc-head"
39+
env: GHCHEAD=true
40+
addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-head], sources: [hvr-ghc]}}
41+
42+
allow_failures:
2243

2344
before_install:
24-
- unset CC
25-
- export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$PATH
45+
- HC=/opt/ghc/bin/${CC}
46+
- HCPKG=${HC/ghc/ghc-pkg}
47+
- unset CC
48+
- CABAL=/opt/ghc/bin/cabal
49+
- CABALHOME=$HOME/.cabal
50+
- export PATH="$CABALHOME/bin:$PATH"
51+
- ROOTDIR=$(pwd)
52+
- HCNUMVER=$(( $(${HC} --numeric-version|sed -E 's/([0-9]+)\.([0-9]+)\.([0-9]+).*/\1 * 10000 + \2 * 100 + \3/') ))
53+
- echo $HCNUMVER
2654

2755
install:
28-
- cabal --version
29-
- echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]"
30-
- if [ -f $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz ];
31-
then
32-
zcat $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz >
33-
$HOME/.cabal/packages/hackage.haskell.org/00-index.tar;
34-
fi
35-
- travis_retry cabal update -v
36-
- sed -i 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config
37-
- cabal install --only-dependencies --enable-tests --enable-benchmarks --dry -v > installplan.txt
38-
- sed -i -e '1,/^Resolving /d' installplan.txt; cat installplan.txt
39-
40-
# check whether current requested install-plan matches cached package-db snapshot
41-
- if diff -u installplan.txt $HOME/.cabsnap/installplan.txt;
42-
then
43-
echo "cabal build-cache HIT";
44-
rm -rfv .ghc;
45-
cp -a $HOME/.cabsnap/ghc $HOME/.ghc;
46-
cp -a $HOME/.cabsnap/lib $HOME/.cabsnap/share $HOME/.cabsnap/bin $HOME/.cabal/;
47-
else
48-
echo "cabal build-cache MISS";
49-
rm -rf $HOME/.cabsnap;
50-
mkdir -p $HOME/.ghc $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin;
51-
cabal install --only-dependencies --enable-tests --enable-benchmarks;
52-
fi
53-
54-
# snapshot package-db on cache miss
55-
- if [ ! -d $HOME/.cabsnap ];
56-
then
57-
echo "snapshotting package-db to build-cache";
58-
mkdir $HOME/.cabsnap;
59-
cp -a $HOME/.ghc $HOME/.cabsnap/ghc;
60-
cp -a $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin installplan.txt $HOME/.cabsnap/;
61-
fi
56+
- ${CABAL} --version
57+
- echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]"
58+
- TEST=${TEST---disable-tests}
59+
- BENCH=--disable-benchmarks
60+
- GHCHEAD=${GHCHEAD-false}
61+
- travis_retry ${CABAL} update -v
62+
- sed -i.bak 's/^jobs:/-- jobs:/' $CABALHOME/config
63+
- rm -fv cabal.project cabal.project.local
64+
- |
65+
if $GHCHEAD; then
66+
sed -i.bak 's/-- allow-newer:.*/allow-newer: *:base, *:template-haskell, *:ghc, *:Cabal/' $CABALHOME/config
67+
fi
68+
- grep -Ev -- '^\s*--' $CABALHOME/config | grep -Ev '^\s*$'
69+
- rm -f cabal.project
70+
- touch cabal.project
71+
- "printf 'packages: \".\"\\n' >> cabal.project"
72+
- "printf 'write-ghc-environment-files: always\\n' >> cabal.project"
73+
- touch cabal.project.local
74+
- "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | grep -vE -- '^(streaming)$' | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done"
75+
- cat cabal.project || true
76+
- cat cabal.project.local || true
77+
- if [ -f "./configure.ac" ]; then (cd "." && autoreconf -i); fi
78+
- rm -f cabal.project.freeze
79+
- ${CABAL} new-freeze -w ${HC} ${TEST} ${BENCH} --project-file="cabal.project" --dry
80+
- "cat \"cabal.project.freeze\" | sed -E 's/^(constraints: *| *)//' | sed 's/any.//'"
81+
- rm "cabal.project.freeze"
82+
- ${CABAL} new-build -w ${HC} ${TEST} ${BENCH} --project-file="cabal.project" --dep -j2 all
83+
- ${CABAL} new-build -w ${HC} --disable-tests --disable-benchmarks --project-file="cabal.project" --dep -j2 all
84+
- rm -rf .ghc.environment.* "."/dist
85+
- DISTDIR=$(mktemp -d /tmp/dist-test.XXXX)
6286

6387
# Here starts the actual work to be performed for the package under test;
6488
# any command which exits with a non-zero exit code causes the build to fail.
6589
script:
66-
- if [ -f configure.ac ]; then autoreconf -i; fi
67-
- cabal configure --enable-tests --enable-benchmarks -v2 # -v2 provides useful information for debugging
68-
- cabal build # this builds all libraries and executables (including tests/benchmarks)
69-
- cabal test
70-
- cabal sdist # tests that a source-distribution can be generated
90+
# test that source-distributions can be generated
91+
- ${CABAL} new-sdist all
92+
- mv dist-newstyle/sdist/*.tar.gz ${DISTDIR}/
93+
- cd ${DISTDIR} || false
94+
- find . -maxdepth 1 -name '*.tar.gz' -exec tar -xvf '{}' \;
95+
- rm -f cabal.project
96+
- touch cabal.project
97+
- "printf 'packages: \"streaming-*/*.cabal\"\\n' >> cabal.project"
98+
- "printf 'write-ghc-environment-files: always\\n' >> cabal.project"
99+
- touch cabal.project.local
100+
- "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | grep -vE -- '^(streaming)$' | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done"
101+
- cat cabal.project || true
102+
- cat cabal.project.local || true
103+
# this builds all libraries and executables (without tests/benchmarks)
104+
- ${CABAL} new-build -w ${HC} --disable-tests --disable-benchmarks all
105+
106+
# build & run tests, build benchmarks
107+
- ${CABAL} new-build -w ${HC} ${TEST} ${BENCH} all
108+
- if [ "x$TEST" = "x--enable-tests" ]; then ${CABAL} new-test -w ${HC} ${TEST} ${BENCH} all; fi
109+
110+
# cabal check
111+
- (cd streaming-* && ${CABAL} check)
112+
113+
# haddock
114+
- ${CABAL} new-haddock -w ${HC} ${TEST} ${BENCH} all
115+
116+
# Build without installed constraints for packages in global-db
117+
- rm -f cabal.project.local; ${CABAL} new-build -w ${HC} --disable-tests --disable-benchmarks all;
71118

72-
# Check that the resulting source distribution can be built & installed.
73-
# If there are no other `.tar.gz` files in `dist`, this can be even simpler:
74-
# `cabal install --force-reinstalls dist/*-*.tar.gz`
75-
- SRC_TGZ=$(cabal info . | awk '{print $2;exit}').tar.gz &&
76-
(cd dist && cabal install --force-reinstalls "$SRC_TGZ")
119+
# Constraint sets
120+
- rm -rf cabal.project.local
77121

122+
# REGENDATA ["--config","cabal.haskell-ci","--output",".travis.yml","streaming.cabal"]
78123
# EOF

0 commit comments

Comments
 (0)