Skip to content

Commit 964a80a

Browse files
committed
Update Travis CI config
1 parent cf841d2 commit 964a80a

File tree

2 files changed

+78
-40
lines changed

2 files changed

+78
-40
lines changed

.travis.yml

Lines changed: 77 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This Travis job script has been generated by a script via
22
#
3-
# make_travis_yml_2.hs '--irc-channel=irc.freenode.org#hackage' 'zlib.cabal' 'zlib1g-dev'
3+
# runghc make_travis_yml_2.hs '-o' '.travis.yml' '--irc-channel=irc.freenode.org#hackage' 'zlib.cabal' 'zlib1g-dev'
44
#
55
# For more information, see https://github.com/hvr/multi-ghc-travis
66
#
@@ -32,6 +32,8 @@ before_cache:
3232
- rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.tar
3333
- rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.tar.idx
3434

35+
- rm -rfv $HOME/.cabal/packages/head.hackage
36+
3537
matrix:
3638
include:
3739
- compiler: "ghc-7.0.4"
@@ -58,54 +60,90 @@ matrix:
5860
- compiler: "ghc-8.0.2"
5961
# env: TEST=--disable-tests BENCH=--disable-benchmarks
6062
addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-8.0.2,zlib1g-dev], sources: [hvr-ghc]}}
61-
- compiler: "ghc-head"
63+
- compiler: "ghc-8.2.2"
6264
# env: TEST=--disable-tests BENCH=--disable-benchmarks
63-
addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-head,zlib1g-dev], sources: [hvr-ghc]}}
65+
addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-8.2.2,zlib1g-dev], sources: [hvr-ghc]}}
66+
- compiler: "ghc-8.4.1"
67+
env: GHCHEAD=true
68+
addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-8.4.1,zlib1g-dev], sources: [hvr-ghc]}}
6469

6570
allow_failures:
66-
- compiler: "ghc-head"
71+
- compiler: "ghc-8.4.1"
6772

6873
before_install:
69-
- HC=${CC}
70-
- unset CC
71-
- PATH=/opt/ghc/bin:/opt/ghc-ppa-tools/bin:$PATH
72-
- PKGNAME='zlib'
74+
- HC=${CC}
75+
- HCPKG=${HC/ghc/ghc-pkg}
76+
- unset CC
77+
- ROOTDIR=$(pwd)
78+
- mkdir -p $HOME/.local/bin
79+
- "PATH=/opt/ghc/bin:/opt/ghc-ppa-tools/bin:$HOME/local/bin:$PATH"
80+
- HCNUMVER=$(( $(${HC} --numeric-version|sed -E 's/([0-9]+)\.([0-9]+)\.([0-9]+).*/\1 * 10000 + \2 * 100 + \3/') ))
81+
- echo $HCNUMVER
7382

7483
install:
75-
- cabal --version
76-
- echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]"
77-
- BENCH=${BENCH---enable-benchmarks}
78-
- TEST=${TEST---enable-tests}
79-
- travis_retry cabal update -v
80-
- sed -i 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config
81-
- rm -fv cabal.project.local
82-
- "echo 'packages: .' > cabal.project"
83-
- rm -f cabal.project.freeze
84-
- cabal new-build -w ${HC} ${TEST} ${BENCH} --dep -j2 all
85-
- cabal new-build -w ${HC} --disable-tests --disable-benchmarks --dep -j2 all
84+
- cabal --version
85+
- echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]"
86+
- BENCH=${BENCH---enable-benchmarks}
87+
- TEST=${TEST---enable-tests}
88+
- HADDOCK=${HADDOCK-true}
89+
- INSTALLED=${INSTALLED-true}
90+
- GHCHEAD=${GHCHEAD-false}
91+
- travis_retry cabal update -v
92+
- "sed -i.bak 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config"
93+
- rm -fv cabal.project cabal.project.local
94+
# Overlay Hackage Package Index for GHC HEAD: https://github.com/hvr/head.hackage
95+
- |
96+
if $GHCHEAD; then
97+
sed -i.bak 's/-- allow-newer:.*/allow-newer: *:base, *:template-haskell, *:ghc, *:Cabal/' ${HOME}/.cabal/config
98+
99+
echo 'repository head.hackage' >> ${HOME}/.cabal/config
100+
echo ' url: http://head.hackage.haskell.org/' >> ${HOME}/.cabal/config
101+
echo ' secure: True' >> ${HOME}/.cabal/config
102+
echo ' root-keys: 07c59cb65787dedfaef5bd5f987ceb5f7e5ebf88b904bbd4c5cbdeb2ff71b740' >> ${HOME}/.cabal/config
103+
echo ' 2e8555dde16ebd8df076f1a8ef13b8f14c66bad8eafefd7d9e37d0ed711821fb' >> ${HOME}/.cabal/config
104+
echo ' 8f79fd2389ab2967354407ec852cbe73f2e8635793ac446d09461ffb99527f6e' >> ${HOME}/.cabal/config
105+
echo ' key-threshold: 3' >> ${HOME}/.cabal.config
106+
107+
cabal new-update head.hackage -v
108+
fi
109+
- grep -Ev -- '^\s*--' ${HOME}/.cabal/config | grep -Ev '^\s*$'
110+
- "printf 'packages: \".\"\\n' > cabal.project"
111+
- cat cabal.project
112+
- if [ -f "./configure.ac" ]; then
113+
(cd "." && autoreconf -i);
114+
fi
115+
- rm -f cabal.project.freeze
116+
- cabal new-build -w ${HC} ${TEST} ${BENCH} --project-file="cabal.project" --dep -j2 all
117+
- cabal new-build -w ${HC} --disable-tests --disable-benchmarks --project-file="cabal.project" --dep -j2 all
118+
- rm -rf .ghc.environment.* "."/dist
119+
- DISTDIR=$(mktemp -d /tmp/dist-test.XXXX)
86120

87121
# Here starts the actual work to be performed for the package under test;
88122
# any command which exits with a non-zero exit code causes the build to fail.
89123
script:
90-
- if [ -f configure.ac ]; then autoreconf -i; fi
91-
- rm -rf dist/
92-
- cabal sdist # test that a source-distribution can be generated
93-
- cd dist/
94-
- SRCTAR=(${PKGNAME}-*.tar.gz)
95-
- SRC_BASENAME="${SRCTAR/%.tar.gz}"
96-
- tar -xvf "./$SRC_BASENAME.tar.gz"
97-
- cd "$SRC_BASENAME/"
98-
## from here on, CWD is inside the extracted source-tarball
99-
- rm -fv cabal.project.local
100-
- "echo 'packages: .' > cabal.project"
101-
# this builds all libraries and executables (without tests/benchmarks)
102-
- rm -f cabal.project.freeze
103-
- cabal new-build -w ${HC} --disable-tests --disable-benchmarks all
104-
# this builds all libraries and executables (including tests/benchmarks)
105-
# - rm -rf ./dist-newstyle
106-
107-
# build & run tests
108-
- cabal new-build -w ${HC} ${TEST} ${BENCH} all
109-
- if [ "x$TEST" = "x--enable-tests" ]; then cabal new-test -w ${HC} all; fi
124+
# test that source-distributions can be generated
125+
- (cd "." && cabal sdist)
126+
- mv "."/dist/zlib-*.tar.gz ${DISTDIR}/
127+
- cd ${DISTDIR} || false
128+
- find . -maxdepth 1 -name '*.tar.gz' -exec tar -xvf '{}' \;
129+
- "printf 'packages: zlib-*/*.cabal\\n' > cabal.project"
130+
- cat cabal.project
131+
# this builds all libraries and executables (without tests/benchmarks)
132+
- cabal new-build -w ${HC} --disable-tests --disable-benchmarks all
133+
134+
# Build with installed constraints for packages in global-db
135+
- if $INSTALLED; then echo cabal new-build -w ${HC} --disable-tests --disable-benchmarks $(${HCPKG} list --global --simple-output --names-only | sed 's/\([a-zA-Z0-9-]\{1,\}\) */--constraint="\1 installed" /g') all | sh; else echo "Not building with installed constraints"; fi
136+
137+
# build & run tests, build benchmarks
138+
- cabal new-build -w ${HC} ${TEST} ${BENCH} all
139+
- if [ "x$TEST" = "x--enable-tests" ]; then cabal new-test -w ${HC} ${TEST} ${BENCH} all; fi
140+
141+
# cabal check
142+
- (cd zlib-* && cabal check)
143+
144+
# haddock
145+
- rm -rf ./dist-newstyle
146+
- if $HADDOCK; then cabal new-haddock -w ${HC} ${TEST} ${BENCH} all; else echo "Skipping haddock generation";fi
110147

148+
# REGENDATA ["-o",".travis.yml","--irc-channel=irc.freenode.org#hackage","zlib.cabal","zlib1g-dev"]
111149
# EOF

zlib.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ description: This package provides a pure interface for compressing and
2020
provides access to the full zlib feature set.
2121
build-type: Simple
2222
cabal-version: >= 1.10
23-
tested-with: GHC ==7.0.4, GHC ==7.2.2, GHC ==7.4.2, GHC ==7.6.3, GHC ==7.8.4, GHC ==7.10.3, GHC ==8.0.1, GHC==8.0.2, GHC ==8.1.*
23+
tested-with: GHC ==7.0.4, GHC ==7.2.2, GHC ==7.4.2, GHC ==7.6.3, GHC ==7.8.4, GHC ==7.10.3, GHC ==8.0.1, GHC==8.0.2, GHC ==8.2.2, GHC ==8.4.1
2424

2525
extra-source-files: changelog
2626
-- zlib C sources (for Windows)

0 commit comments

Comments
 (0)