@@ -1,6 +1,6 @@
11# This Travis job script has been generated by a script via
22#
3−# make_travis_yml_2.hs 'cabal2nix.cabal'
3+# runghc make_travis_yml_2.hs '-o' '.travis.yml' 'cabal2nix.cabal'
44#
55# For more information, see https://github.com/hvr/multi-ghc-travis
66#
@@ -24,66 +24,76 @@ before_cache:
2424 - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.tar
2525 - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.tar.idx
2626
27+ - rm -rfv $HOME/.cabal/packages/head.hackage
28+
2729matrix:
2830 include:
2931 - compiler: "ghc-8.2.1"
3032 # env: TEST=--disable-tests BENCH=--disable-benchmarks
3133 addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-8.2.1], sources: [hvr-ghc]}}
34+ - compiler: "ghc-8.2.2"
35+ # env: TEST=--disable-tests BENCH=--disable-benchmarks
36+ addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-8.2.2], sources: [hvr-ghc]}}
3237
3338before_install:
34− - HC=${CC}
35− - HCPKG=${HC/ghc/ghc-pkg}
36− - unset CC
37− - PATH=/opt/ghc/bin:/opt/ghc-ppa-tools/bin:$PATH
38− - PKGNAME='cabal2nix'
39+ - HC=${CC}
40+ - HCPKG=${HC/ghc/ghc-pkg}
41+ - unset CC
42+ - ROOTDIR=$(pwd)
43+ - mkdir -p $HOME/.local/bin
44+ - "PATH=/opt/ghc/bin:/opt/ghc-ppa-tools/bin:$HOME/local/bin:$PATH"
45+ - HCNUMVER=$(( $(${HC} --numeric-version|sed -E 's/([0-9]+)\.([0-9]+)\.([0-9]+).*/\1 * 10000 + \2 * 100 + \3/') ))
46+ - echo $HCNUMVER
3947
4048install:
41− - cabal --version
42− - echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]"
43− - BENCH=${BENCH---enable-benchmarks}
44− - TEST=${TEST---enable-tests}
45− - HADDOCK=${HADDOCK-true}
46− - INSTALLED=${INSTALLED-true}
47− - travis_retry cabal update -v
48− - sed -i.bak 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config
49− - rm -fv cabal.project.local
50− - "echo 'packages: .' > cabal.project"
51− - rm -f cabal.project.freeze
52− - cabal new-build -w ${HC} ${TEST} ${BENCH} --dep -j2 all
53− - cabal new-build -w ${HC} --disable-tests --disable-benchmarks --dep -j2 all
49+ - cabal --version
50+ - echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]"
51+ - BENCH=${BENCH---enable-benchmarks}
52+ - TEST=${TEST---enable-tests}
53+ - HADDOCK=${HADDOCK-true}
54+ - INSTALLED=${INSTALLED-true}
55+ - GHCHEAD=${GHCHEAD-false}
56+ - travis_retry cabal update -v
57+ - "sed -i.bak 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config"
58+ - rm -fv cabal.project cabal.project.local
59+ - grep -Ev -- '^\s*--' ${HOME}/.cabal/config | grep -Ev '^\s*$'
60+ - "printf 'packages: \".\"\\n' > cabal.project"
61+ - cat cabal.project
62+ - if [ -f "./configure.ac" ]; then
63+ (cd "." && autoreconf -i);
64+ fi
65+ - rm -f cabal.project.freeze
66+ - cabal new-build -w ${HC} ${TEST} ${BENCH} --project-file="cabal.project" --dep -j2 all
67+ - cabal new-build -w ${HC} --disable-tests --disable-benchmarks --project-file="cabal.project" --dep -j2 all
68+ - rm -rf "."/.ghc.environment.* "."/dist
69+ - DISTDIR=$(mktemp -d /tmp/dist-test.XXXX)
5470
5571# Here starts the actual work to be performed for the package under test;
5672# any command which exits with a non-zero exit code causes the build to fail.
5773script:
58− - if [ -f configure.ac ]; then autoreconf -i; fi
59− - rm -rf .ghc.environment.* dist/
60− - cabal sdist # test that a source-distribution can be generated
61− - cd dist/
62− - SRCTAR=(${PKGNAME}-*.tar.gz)
63− - SRC_BASENAME="${SRCTAR/%.tar.gz}"
64− - tar -xvf "./$SRC_BASENAME.tar.gz"
65− - cd "$SRC_BASENAME/"
66−## from here on, CWD is inside the extracted source-tarball
67− - rm -fv cabal.project.local
68− - "echo 'packages: .' > cabal.project"
69− # this builds all libraries and executables (without tests/benchmarks)
70− - rm -f cabal.project.freeze
71− - cabal new-build -w ${HC} --disable-tests --disable-benchmarks all
72− # this builds all libraries and executables (including tests/benchmarks)
73− # - rm -rf ./dist-newstyle
74+ # test that source-distributions can be generated
75+ - (cd "." && cabal sdist)
76+ - mv "."/dist/cabal2nix-*.tar.gz ${DISTDIR}/
77+ - cd ${DISTDIR} || false
78+ - find . -maxdepth 1 -name '*.tar.gz' -exec tar -xvf '{}' \;
79+ - "printf 'packages: cabal2nix-*/*.cabal\\n' > cabal.project"
80+ - cat 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 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
7486
75− # Build with installed constraints for packages in global-db
76− - if $INSTALLED; then
77− 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;
78− else echo "Not building with installed constraints"; fi
87+ # build & run tests, build benchmarks
88+ - cabal new-build -w ${HC} ${TEST} ${BENCH} all
89+ - if [ "x$TEST" = "x--enable-tests" ]; then cabal new-test -w ${HC} ${TEST} ${BENCH} all; fi
7990
80− # build & run tests, build benchmarks
81− - cabal new-build -w ${HC} ${TEST} ${BENCH} all
82− - if [ "x$TEST" = "x--enable-tests" ]; then cabal new-test -w ${HC} ${TEST} all; fi
91+ # cabal check
92+ - (cd cabal2nix-* && cabal check)
8393
84− # haddock
85− - rm -rf ./dist-newstyle
86− - if $HADDOCK; then cabal new-haddock -w ${HC} --disable-tests --disable-benchmarks all; else echo "Skipping haddock generation";fi
94+ # haddock
95+ - rm -rf ./dist-newstyle
96+ - if $HADDOCK; then cabal new-haddock -w ${HC} ${TEST} ${BENCH} all; else echo "Skipping haddock generation";fi
8797
88−# REGENDATA ["cabal2nix.cabal"]
98+# REGENDATA ["-o",".travis.yml","cabal2nix.cabal"]
8999# EOF