@@ -1,6 +1,6 @@
11# This Travis job script has been generated by a script via
22#
3−# make_travis_yml_2.hs 'http-api-data.cabal'
3+# make_travis_yml_2.hs '--branch' 'master' '-o' '.travis.yml' 'http-api-data.cabal'
44#
55# For more information, see https://github.com/hvr/multi-ghc-travis
66#
@@ -10,6 +10,10 @@ sudo: false
1010git:
1111 submodules: false # whether to recursively clone submodules
1212
13+branches:
14+ only:
15+ - master
16+
1317cache:
1418 directories:
1519 - $HOME/.cabal/packages
@@ -35,80 +39,60 @@ matrix:
3539 - compiler: "ghc-8.0.2"
3640 # env: TEST=--disable-tests BENCH=--disable-benchmarks
3741 addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-8.0.2], sources: [hvr-ghc]}}
38− - compiler: "ghc-8.2.1"
39− env: CABALFLAGS="--allow-newer"
40− # env: TEST=--disable-tests BENCH=--disable-benchmarks
41− addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-8.2.1], sources: [hvr-ghc]}}
42− - compiler: "ghc-head"
43− env: CABALFLAGS="--allow-newer"
42+ - compiler: "ghc-8.2.2"
4443 # env: TEST=--disable-tests BENCH=--disable-benchmarks
45− addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-head], sources: [hvr-ghc]}}
46−
47− allow_failures:
48− - compiler: "ghc-8.2.1" # needs time-1.8.0.2
49− - compiler: "ghc-head"
44+ addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-8.2.2], sources: [hvr-ghc]}}
5045
5146before_install:
52− - HC=${CC}
53− - unset CC
54− - PATH=/opt/ghc/bin:/opt/ghc-ppa-tools/bin:$PATH
55− - PKGNAME='http-api-data'
47+ - HC=${CC}
48+ - HCPKG=${HC/ghc/ghc-pkg}
49+ - unset CC
50+ - PATH=/opt/ghc/bin:/opt/ghc-ppa-tools/bin:$PATH
5651
5752install:
58− - cabal --version
59− - echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]"
60− - BENCH=${BENCH---enable-benchmarks}
61− - TEST=${TEST---enable-tests}
62− - travis_retry cabal update -v
63− - sed -i 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config
64− # Soon we'll have build-tool-depends: in cabal-head
65− - cabal get hspec-discover-2.3.2
66− - cd hspec-discover-2.3.2
67− - cabal new-build hspec-discover:exe:hspec-discover
68− - mkdir -p ~/.local/bin
69− - shopt -s globstar; cp dist-newstyle/**/hspec-discover/hspec-discover ~/.local/bin
70− - cd ..
71− # Continue
72− - rm -fv cabal.project.local
73− - "echo 'packages: .' > cabal.project"
74− - rm -f cabal.project.freeze
75− - cabal new-build ${CABALFLAGS} -w ${HC} ${TEST} ${BENCH} --dep -j2
76− - cabal new-build ${CABALFLAGS} -w ${HC} --disable-tests --disable-benchmarks --dep -j2
53+ - cabal --version
54+ - echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]"
55+ - BENCH=${BENCH---enable-benchmarks}
56+ - TEST=${TEST---enable-tests}
57+ - HADDOCK=${HADDOCK-true}
58+ - INSTALLED=${INSTALLED-true}
59+ - travis_retry cabal update -v
60+ - sed -i.bak 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config
61+ - rm -fv cabal.project.local
62+ - "echo 'packages: .' > cabal.project"
63+ - if [ -f "./configure.ac" ]; then
64+ (cd "."; autoreconf -i);
65+ fi
66+ - rm -f cabal.project.freeze
67+ - cabal new-build -w ${HC} ${TEST} ${BENCH} --project-file="cabal.project" --dep -j2 all
68+ - cabal new-build -w ${HC} --disable-tests --disable-benchmarks --project-file="cabal.project" --dep -j2 all
69+ - rm -rf "."/.ghc.environment.* "."/dist
70+ - DISTDIR=$(mktemp -d /tmp/dist-test.XXXX)
7771
7872# Here starts the actual work to be performed for the package under test;
7973# any command which exits with a non-zero exit code causes the build to fail.
8074script:
81− - if [ -f configure.ac ]; then autoreconf -i; fi
82− - rm -rf dist/
83− - cabal sdist # test that a source-distribution can be generated
84− - cd dist/
85− - SRCTAR=(${PKGNAME}-*.tar.gz)
86− - SRC_BASENAME="${SRCTAR/%.tar.gz}"
87− - tar -xvf "./$SRC_BASENAME.tar.gz"
88− - cd "$SRC_BASENAME/"
89−## from here on, CWD is inside the extracted source-tarball
90− - rm -fv cabal.project.local
91− - "echo 'packages: .' > cabal.project"
92− # this builds all libraries and executables (without tests/benchmarks)
93− - rm -f cabal.project.freeze
94− - cabal new-build ${CABALFLAGS} -w ${HC} --disable-tests --disable-benchmarks
95− - cabal new-build ${CABALFLAGS} -w ${HC} --disable-tests --disable-benchmarks --flag http-api-data:use-text-show
96− # this builds all libraries and executables (including tests/benchmarks)
97− # - rm -rf ./dist-newstyle
98− - cabal new-build ${CABALFLAGS} -w ${HC} ${TEST} ${BENCH}
75+ # test that source-distributions can be generated
76+ - (cd "."; cabal sdist)
77+ - mv "."/dist/http-api-data-*.tar.gz ${DISTDIR}/
78+ - cd ${DISTDIR}
79+ - find . -maxdepth 1 -name '*.tar.gz' -exec tar -xvf '{}' \;
80+ - "printf 'packages: http-api-data-*/*.cabal\n' > cabal.project"
81+ # this builds all libraries and executables (without tests/benchmarks)
82+ - cabal new-build -w ${HC} --disable-tests --disable-benchmarks all
83+
84+ # Build with installed constraints for packages in global-db
85+ - if $INSTALLED; then
86+ 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;
87+ else echo "Not building with installed constraints"; fi
9988
100− # there's no 'cabal new-test' yet, so let's emulate for now
101− - TESTS=( $(awk 'tolower($0) ~ /^test-suite / { print $2 }' *.cabal) )
102− - if [ "$TEST" != "--enable-tests" ]; then TESTS=(); fi
103− - shopt -s globstar;
104− RC=true; for T in ${TESTS[@]}; do echo "== $T ==";
105− if dist-newstyle/build/**/$SRC_BASENAME/**/build/$T/$T; then echo "= $T OK =";
106− else echo "= $T FAILED ="; RC=false; fi; done; $RC
89+ # build & run tests, build benchmarks
90+ - cabal new-build -w ${HC} ${TEST} ${BENCH} all
91+ - if [ "x$TEST" = "x--enable-tests" ]; then cabal new-test -w ${HC} ${TEST} all; fi
10792
108− - cabal new-build ${CABALFLAGS} -w ${HC} ${TEST} ${BENCH} --flag http-api-data:use-text-show
109− - shopt -s globstar;
110− RC=true; for T in ${TESTS[@]}; do echo "== $T ==";
111− if dist-newstyle/build/**/$SRC_BASENAME/**/build/$T/$T; then echo "= $T OK =";
112− else echo "= $T FAILED ="; RC=false; fi; done; $RC
93+ # haddock
94+ - rm -rf ./dist-newstyle
95+ - if $HADDOCK; then cabal new-haddock -w ${HC} --disable-tests --disable-benchmarks all; else echo "Skipping haddock generation";fi
11396
97+# REGENDATA ["--branch","master","-o",".travis.yml","http-api-data.cabal"]
11498# EOF