Skip to content

Commit f12c477

Browse files
authored
Merge pull request #356 from phadej/travis-2019-04-01
Regenerate .travis.yml
2 parents 0c31bbd + dcb707e commit f12c477

File tree

2 files changed

+114
-87
lines changed

2 files changed

+114
-87
lines changed

.travis.yml

Lines changed: 113 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -1,122 +1,149 @@
11
# This Travis job script has been generated by a script via
22
#
3-
# runghc make_travis_yml_2.hs '--branch' 'master' '-o' '.travis.yml' 'github.cabal'
3+
# haskell-ci '--branches' 'master' '-o' '.travis.yml' 'github.cabal'
44
#
55
# For more information, see https://github.com/haskell-CI/haskell-ci
66
#
7+
# version: 0.3.20190327
8+
#
79
language: c
8-
sudo: false
9-
10+
dist: xenial
1011
git:
11-
submodules: false # whether to recursively clone submodules
12-
12+
# whether to recursively clone submodules
13+
submodules: false
1314
branches:
1415
only:
1516
- master
16-
1717
cache:
1818
directories:
1919
- $HOME/.cabal/packages
2020
- $HOME/.cabal/store
21-
2221
before_cache:
23-
- rm -fv $HOME/.cabal/packages/hackage.haskell.org/build-reports.log
22+
- rm -fv $CABALHOME/packages/hackage.haskell.org/build-reports.log
2423
# remove files that are regenerated by 'cabal update'
25-
- rm -fv $HOME/.cabal/packages/hackage.haskell.org/00-index.*
26-
- rm -fv $HOME/.cabal/packages/hackage.haskell.org/*.json
27-
- rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.cache
28-
- rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.tar
29-
- rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.tar.idx
30-
31-
- rm -rfv $HOME/.cabal/packages/head.hackage
32-
24+
- rm -fv $CABALHOME/packages/hackage.haskell.org/00-index.*
25+
- rm -fv $CABALHOME/packages/hackage.haskell.org/*.json
26+
- rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.cache
27+
- rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.tar
28+
- rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.tar.idx
29+
- rm -rfv $CABALHOME/packages/head.hackage
3330
matrix:
3431
include:
35-
- compiler: "ghc-8.6.1"
36-
# env: TEST=--disable-tests BENCH=--disable-benchmarks
37-
addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.4,ghc-8.6.1], sources: [hvr-ghc]}}
38-
- compiler: "ghc-8.4.3"
39-
# env: TEST=--disable-tests BENCH=--disable-benchmarks
40-
addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.4,ghc-8.4.3], sources: [hvr-ghc]}}
41-
- compiler: "ghc-8.2.2"
42-
# env: TEST=--disable-tests BENCH=--disable-benchmarks
43-
addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.4,ghc-8.2.2], sources: [hvr-ghc]}}
44-
- compiler: "ghc-8.0.2"
45-
# env: TEST=--disable-tests BENCH=--disable-benchmarks
46-
addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.4,ghc-8.0.2], sources: [hvr-ghc]}}
47-
- compiler: "ghc-7.10.3"
48-
# env: TEST=--disable-tests BENCH=--disable-benchmarks
49-
addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.4,ghc-7.10.3], sources: [hvr-ghc]}}
50-
- compiler: "ghc-7.8.4"
51-
# env: TEST=--disable-tests BENCH=--disable-benchmarks
52-
addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.4,ghc-7.8.4], sources: [hvr-ghc]}}
53-
32+
- compiler: ghc-8.6.3
33+
addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.6.3","cabal-install-2.4"]}}
34+
- compiler: ghc-8.4.3
35+
addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.4.3","cabal-install-2.4"]}}
36+
- compiler: ghc-8.2.2
37+
addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.2.2","cabal-install-2.4"]}}
38+
- compiler: ghc-8.0.2
39+
addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.0.2","cabal-install-2.4"]}}
40+
- compiler: ghc-7.10.3
41+
addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-7.10.3","cabal-install-2.4"]}}
42+
- compiler: ghc-7.8.4
43+
addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-7.8.4","cabal-install-2.4"]}}
5444
before_install:
55-
- HC=${CC}
56-
- HCPKG=${HC/ghc/ghc-pkg}
45+
- HC=$(echo "/opt/$CC/bin/ghc" | sed 's/-/\//')
46+
- HCPKG="$HC-pkg"
5747
- unset CC
58-
- ROOTDIR=$(pwd)
59-
- mkdir -p $HOME/.local/bin
60-
- "PATH=/opt/ghc/bin:/opt/ghc-ppa-tools/bin:$HOME/local/bin:$PATH"
48+
- CABAL=/opt/ghc/bin/cabal
49+
- CABALHOME=$HOME/.cabal
50+
- export PATH="$CABALHOME/bin:$PATH"
51+
- TOP=$(pwd)
6152
- HCNUMVER=$(( $(${HC} --numeric-version|sed -E 's/([0-9]+)\.([0-9]+)\.([0-9]+).*/\1 * 10000 + \2 * 100 + \3/') ))
6253
- echo $HCNUMVER
63-
54+
- CABAL="$CABAL -vnormal+nowrap+markoutput"
55+
- set -o pipefail
56+
- |
57+
echo 'function blue(s) { printf "\033[0;34m" s "\033[0m " }' >> .colorful.awk
58+
echo 'BEGIN { state = "output"; }' >> .colorful.awk
59+
echo '/^-----BEGIN CABAL OUTPUT-----$/ { state = "cabal" }' >> .colorful.awk
60+
echo '/^-----END CABAL OUTPUT-----$/ { state = "output" }' >> .colorful.awk
61+
echo '!/^(-----BEGIN CABAL OUTPUT-----|-----END CABAL OUTPUT-----)/ {' >> .colorful.awk
62+
echo ' if (state == "cabal") {' >> .colorful.awk
63+
echo ' print blue($0)' >> .colorful.awk
64+
echo ' } else {' >> .colorful.awk
65+
echo ' print $0' >> .colorful.awk
66+
echo ' }' >> .colorful.awk
67+
echo '}' >> .colorful.awk
68+
- cat .colorful.awk
69+
- |
70+
color_cabal_output () {
71+
awk -f $TOP/.colorful.awk
72+
}
73+
- echo text | color_cabal_output
6474
install:
65-
- cabal --version
75+
- ${CABAL} --version
6676
- echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]"
67-
- BENCH=${BENCH---enable-benchmarks}
68-
- TEST=${TEST---enable-tests}
69-
- HADDOCK=${HADDOCK-true}
70-
- UNCONSTRAINED=${UNCONSTRAINED-true}
71-
- NOINSTALLEDCONSTRAINTS=${NOINSTALLEDCONSTRAINTS-false}
77+
- TEST=--enable-tests
78+
- BENCH=--enable-benchmarks
7279
- GHCHEAD=${GHCHEAD-false}
73-
- travis_retry cabal update -v
74-
- "sed -i.bak 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config"
75-
- rm -fv cabal.project cabal.project.local
76-
- grep -Ev -- '^\s*--' ${HOME}/.cabal/config | grep -Ev '^\s*$'
77-
- "printf 'packages: \".\"\\n' > cabal.project"
78-
- touch cabal.project.local
79-
- "if ! $NOINSTALLEDCONSTRAINTS; then for pkg in $($HCPKG list --simple-output); do echo $pkg | grep -vw -- github | sed 's/^/constraints: /' | sed 's/-[^-]*$/ installed/' >> cabal.project.local; done; fi"
80+
- rm -f $CABALHOME/config
81+
- |
82+
echo "verbose: normal +nowrap +markoutput" >> $CABALHOME/config
83+
echo "remote-build-reporting: anonymous" >> $CABALHOME/config
84+
echo "remote-repo-cache: $CABALHOME/packages" >> $CABALHOME/config
85+
echo "logs-dir: $CABALHOME/logs" >> $CABALHOME/config
86+
echo "world-file: $CABALHOME/world" >> $CABALHOME/config
87+
echo "extra-prog-path: $CABALHOME/bin" >> $CABALHOME/config
88+
echo "symlink-bindir: $CABALHOME/bin" >> $CABALHOME/config
89+
echo "build-summary: $CABALHOME/logs/build.log" >> $CABALHOME/config
90+
echo "store-dir: $CABALHOME/store" >> $CABALHOME/config
91+
echo "install-dirs user" >> $CABALHOME/config
92+
echo " prefix: $CABALHOME" >> $CABALHOME/config
93+
echo "repository hackage.haskell.org" >> $CABALHOME/config
94+
echo " url: http://hackage.haskell.org/" >> $CABALHOME/config
95+
- cat $CABALHOME/config
96+
- rm -fv cabal.project cabal.project.local cabal.project.freeze
97+
- travis_retry ${CABAL} v2-update -v
98+
# Generate cabal.project
99+
- rm -rf cabal.project cabal.project.local cabal.project.freeze
100+
- touch cabal.project
101+
- |
102+
echo 'packages: "."' >> cabal.project
103+
- |
104+
echo "write-ghc-environment-files: always" >> cabal.project
105+
- "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | grep -vE -- '^(github)$' | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done"
80106
- cat cabal.project || true
81107
- cat cabal.project.local || true
82-
- if [ -f "./configure.ac" ]; then
83-
(cd "." && autoreconf -i);
84-
fi
85-
- rm -f cabal.project.freeze
86-
- cabal new-build -w ${HC} ${TEST} ${BENCH} --project-file="cabal.project" --dep -j2 all
87-
- cabal new-build -w ${HC} --disable-tests --disable-benchmarks --project-file="cabal.project" --dep -j2 all
88-
- rm -rf .ghc.environment.* "."/dist
89-
- DISTDIR=$(mktemp -d /tmp/dist-test.XXXX)
90-
91-
# Here starts the actual work to be performed for the package under test;
92-
# any command which exits with a non-zero exit code causes the build to fail.
108+
- if [ -f "./configure.ac" ]; then (cd "." && autoreconf -i); fi
109+
- ${CABAL} v2-freeze -w ${HC} ${TEST} ${BENCH} | color_cabal_output
110+
- "cat cabal.project.freeze | sed -E 's/^(constraints: *| *)//' | sed 's/any.//'"
111+
- rm cabal.project.freeze
112+
- ${CABAL} v2-build -w ${HC} ${TEST} ${BENCH} --dep -j2 all | color_cabal_output
113+
- ${CABAL} v2-build -w ${HC} --disable-tests --disable-benchmarks --dep -j2 all | color_cabal_output
93114
script:
94-
# test that source-distributions can be generated
95-
- (cd "." && cabal sdist)
96-
- mv "."/dist/github-*.tar.gz ${DISTDIR}/
115+
- DISTDIR=$(mktemp -d /tmp/dist-test.XXXX)
116+
# Packaging...
117+
- ${CABAL} v2-sdist all | color_cabal_output
118+
# Unpacking...
119+
- mv dist-newstyle/sdist/*.tar.gz ${DISTDIR}/
97120
- cd ${DISTDIR} || false
98121
- find . -maxdepth 1 -name '*.tar.gz' -exec tar -xvf '{}' \;
99-
- "printf 'packages: github-*/*.cabal\\n' > cabal.project"
100-
- touch cabal.project.local
101-
- "if ! $NOINSTALLEDCONSTRAINTS; then for pkg in $($HCPKG list --simple-output); do echo $pkg | grep -vw -- github | sed 's/^/constraints: /' | sed 's/-[^-]*$/ installed/' >> cabal.project.local; done; fi"
122+
# Generate cabal.project
123+
- rm -rf cabal.project cabal.project.local cabal.project.freeze
124+
- touch cabal.project
125+
- |
126+
echo 'packages: "github-*/*.cabal"' >> cabal.project
127+
- |
128+
echo "write-ghc-environment-files: always" >> cabal.project
129+
- "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | grep -vE -- '^(github)$' | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done"
102130
- cat cabal.project || true
103131
- cat cabal.project.local || true
132+
# Building...
104133
# this builds all libraries and executables (without tests/benchmarks)
105-
- cabal new-build -w ${HC} --disable-tests --disable-benchmarks all
106-
134+
- ${CABAL} v2-build -w ${HC} --disable-tests --disable-benchmarks all | color_cabal_output
135+
# Building with tests and benchmarks...
107136
# build & run tests, build benchmarks
108-
- cabal new-build -w ${HC} ${TEST} ${BENCH} all
109-
- if [ "x$TEST" = "x--enable-tests" ]; then cabal new-test -w ${HC} ${TEST} ${BENCH} all; fi
110-
111-
# cabal check
112-
- (cd github-* && cabal check)
113-
114-
# haddock
115-
- rm -rf ./dist-newstyle
116-
- if $HADDOCK; then cabal new-haddock -w ${HC} ${TEST} ${BENCH} all; else echo "Skipping haddock generation";fi
117-
118-
# Build without installed constraints for packages in global-db
119-
- if $UNCONSTRAINED; then rm -f cabal.project.local; echo cabal new-build -w ${HC} --disable-tests --disable-benchmarks all; else echo "Not building without installed constraints"; fi
137+
- ${CABAL} v2-build -w ${HC} ${TEST} ${BENCH} all | color_cabal_output
138+
# Testing...
139+
- ${CABAL} v2-test -w ${HC} ${TEST} ${BENCH} all | color_cabal_output
140+
# cabal check...
141+
- (cd github-* && ${CABAL} -vnormal check)
142+
# haddock...
143+
- ${CABAL} v2-haddock -w ${HC} ${TEST} ${BENCH} all | color_cabal_output
144+
# Building without installed constraints for packages in global-db...
145+
- rm -f cabal.project.local
146+
- ${CABAL} v2-build -w ${HC} --disable-tests --disable-benchmarks all | color_cabal_output
120147

121-
# REGENDATA ["--branch","master","-o",".travis.yml","github.cabal"]
148+
# REGENDATA ["--branches","master","-o",".travis.yml","github.cabal"]
122149
# EOF

github.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ copyright:
3030
Copyright 2012-2013 Mike Burns, Copyright 2013-2015 John Wiegley, Copyright 2016-2019 Oleg Grenrus
3131

3232
tested-with:
33-
ghc ==7.8.4 || ==7.10.3 || ==8.0.2 || ==8.2.2 || ==8.4.3 || ==8.6.3
33+
GHC ==7.8.4 || ==7.10.3 || ==8.0.2 || ==8.2.2 || ==8.4.3 || ==8.6.4
3434

3535
extra-source-files:
3636
README.md

0 commit comments

Comments
 (0)