|
1 |
| -# NB: don't set `language: haskell` here |
2 |
| - |
3 |
| -# See also https://github.com/hvr/multi-ghc-travis for more information |
4 |
| -env: |
5 |
| - - GHCVER=7.6.3 CABALVER=1.16 |
6 |
| - - GHCVER=7.8.4 CABALVER=1.18 |
7 |
| - - GHCVER=7.10.3 CABALVER=1.22 |
8 |
| - - GHCVER=8.0.2 CABALVER=1.24 |
9 |
| - - GHCVER=8.2.2 CABALVER=2.0 |
10 |
| - - GHCVER=8.4.3 CABALVER=2.4 |
11 |
| - - GHCVER=8.6.2 CABALVER=2.4 |
12 |
| - - GHCVER=head CABALVER=head |
13 |
| - |
| 1 | +# This Travis job script has been generated by a script via |
| 2 | +# |
| 3 | +# haskell-ci '--config=cabal.haskell-ci' 'cabal.project' |
| 4 | +# |
| 5 | +# For more information, see https://github.com/haskell-CI/haskell-ci |
| 6 | +# |
| 7 | +# version: 0.3.20190413 |
| 8 | +# |
| 9 | +language: c |
| 10 | +dist: xenial |
| 11 | +git: |
| 12 | + # whether to recursively clone submodules |
| 13 | + submodules: false |
| 14 | +branches: |
| 15 | + only: |
| 16 | + - master |
| 17 | +cache: |
| 18 | + directories: |
| 19 | + - $HOME/.cabal/packages |
| 20 | + - $HOME/.cabal/store |
| 21 | +before_cache: |
| 22 | + - rm -fv $CABALHOME/packages/hackage.haskell.org/build-reports.log |
| 23 | + # remove files that are regenerated by 'cabal update' |
| 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 |
14 | 30 | matrix:
|
15 |
| - allow_failures: |
16 |
| - - env: GHCVER=head CABALVER=head |
17 |
| - |
18 |
| -# Note: the distinction between `before_install` and `install` is not |
19 |
| -# important. |
| 31 | + include: |
| 32 | + - compiler: ghc-8.6.4 |
| 33 | + addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.6.4","cabal-install-2.4"]}} |
| 34 | + - compiler: ghc-8.4.4 |
| 35 | + addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.4.4","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"]}} |
| 44 | + - compiler: ghc-7.6.3 |
| 45 | + addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-7.6.3","cabal-install-2.4"]}} |
20 | 46 | before_install:
|
21 |
| - - travis_retry sudo add-apt-repository -y ppa:hvr/ghc |
22 |
| - - travis_retry sudo apt-get update |
23 |
| - - travis_retry sudo apt-get install cabal-install-$CABALVER ghc-$GHCVER |
24 |
| - - export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$PATH |
25 |
| - - cabal --version |
26 |
| - |
| 47 | + - HC=$(echo "/opt/$CC/bin/ghc" | sed 's/-/\//') |
| 48 | + - HCPKG="$HC-pkg" |
| 49 | + - unset CC |
| 50 | + - CABAL=/opt/ghc/bin/cabal |
| 51 | + - CABALHOME=$HOME/.cabal |
| 52 | + - export PATH="$CABALHOME/bin:$PATH" |
| 53 | + - TOP=$(pwd) |
| 54 | + - HCNUMVER=$(( $(${HC} --numeric-version|sed -E 's/([0-9]+)\.([0-9]+)\.([0-9]+).*/\1 * 10000 + \2 * 100 + \3/') )) |
| 55 | + - echo $HCNUMVER |
| 56 | + - CABAL="$CABAL -vnormal+nowrap+markoutput" |
| 57 | + - set -o pipefail |
| 58 | + - | |
| 59 | + echo 'function blue(s) { printf "\033[0;34m" s "\033[0m " }' >> .colorful.awk |
| 60 | + echo 'BEGIN { state = "output"; }' >> .colorful.awk |
| 61 | + echo '/^-----BEGIN CABAL OUTPUT-----$/ { state = "cabal" }' >> .colorful.awk |
| 62 | + echo '/^-----END CABAL OUTPUT-----$/ { state = "output" }' >> .colorful.awk |
| 63 | + echo '!/^(-----BEGIN CABAL OUTPUT-----|-----END CABAL OUTPUT-----)/ {' >> .colorful.awk |
| 64 | + echo ' if (state == "cabal") {' >> .colorful.awk |
| 65 | + echo ' print blue($0)' >> .colorful.awk |
| 66 | + echo ' } else {' >> .colorful.awk |
| 67 | + echo ' print $0' >> .colorful.awk |
| 68 | + echo ' }' >> .colorful.awk |
| 69 | + echo '}' >> .colorful.awk |
| 70 | + - cat .colorful.awk |
| 71 | + - | |
| 72 | + color_cabal_output () { |
| 73 | + awk -f $TOP/.colorful.awk |
| 74 | + } |
| 75 | + - echo text | color_cabal_output |
27 | 76 | install:
|
28 |
| - - travis_retry cabal update |
29 |
| - - cabal install --only-dependencies |
30 |
| - # we need to install the test-suite and benchmark deps manually as the cabal |
31 |
| - # solver would otherwise complain about cyclic deps |
32 |
| - - cabal install 'test-framework >= 0.3.3' 'test-framework-quickcheck2 >= 0.2.9' 'QuickCheck >= 2.7.1' 'ChasingBottoms' 'HUnit' 'test-framework-hunit' |
33 |
| - |
34 |
| - # If we enable benchmarks, we'll need 'criterion >= 0.4.0 && < 1.2' |
35 |
| - |
36 |
| -# Here starts the actual work to be performed for the package under |
37 |
| -# test; any command which exits with a non-zero exit code causes the |
38 |
| -# build to fail. |
| 77 | + - ${CABAL} --version |
| 78 | + - echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]" |
| 79 | + - TEST=--enable-tests |
| 80 | + - BENCH=--enable-benchmarks |
| 81 | + - if [ $HCNUMVER -lt 70804 ] ; then BENCH=--disable-benchmarks ; fi |
| 82 | + - GHCHEAD=${GHCHEAD-false} |
| 83 | + - rm -f $CABALHOME/config |
| 84 | + - | |
| 85 | + echo "verbose: normal +nowrap +markoutput" >> $CABALHOME/config |
| 86 | + echo "remote-build-reporting: anonymous" >> $CABALHOME/config |
| 87 | + echo "remote-repo-cache: $CABALHOME/packages" >> $CABALHOME/config |
| 88 | + echo "logs-dir: $CABALHOME/logs" >> $CABALHOME/config |
| 89 | + echo "world-file: $CABALHOME/world" >> $CABALHOME/config |
| 90 | + echo "extra-prog-path: $CABALHOME/bin" >> $CABALHOME/config |
| 91 | + echo "symlink-bindir: $CABALHOME/bin" >> $CABALHOME/config |
| 92 | + echo "build-summary: $CABALHOME/logs/build.log" >> $CABALHOME/config |
| 93 | + echo "store-dir: $CABALHOME/store" >> $CABALHOME/config |
| 94 | + echo "install-dirs user" >> $CABALHOME/config |
| 95 | + echo " prefix: $CABALHOME" >> $CABALHOME/config |
| 96 | + echo "repository hackage.haskell.org" >> $CABALHOME/config |
| 97 | + echo " url: http://hackage.haskell.org/" >> $CABALHOME/config |
| 98 | + - cat $CABALHOME/config |
| 99 | + - rm -fv cabal.project cabal.project.local cabal.project.freeze |
| 100 | + - travis_retry ${CABAL} v2-update -v |
| 101 | + # Generate cabal.project |
| 102 | + - rm -rf cabal.project cabal.project.local cabal.project.freeze |
| 103 | + - touch cabal.project |
| 104 | + - | |
| 105 | + echo 'packages: "containers"' >> cabal.project |
| 106 | + echo 'packages: "containers-tests"' >> cabal.project |
| 107 | + - | |
| 108 | + echo "write-ghc-environment-files: always" >> cabal.project |
| 109 | + - "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | grep -vE -- '^(binary|containers|containers-tests)$' | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done" |
| 110 | + - cat cabal.project || true |
| 111 | + - cat cabal.project.local || true |
| 112 | + - if [ -f "containers/configure.ac" ]; then (cd "containers" && autoreconf -i); fi |
| 113 | + - if [ -f "containers-tests/configure.ac" ]; then (cd "containers-tests" && autoreconf -i); fi |
| 114 | + - ${CABAL} v2-freeze -w ${HC} ${TEST} ${BENCH} | color_cabal_output |
| 115 | + - "cat cabal.project.freeze | sed -E 's/^(constraints: *| *)//' | sed 's/any.//'" |
| 116 | + - rm cabal.project.freeze |
39 | 117 | script:
|
40 |
| - # -v2 provides useful information for debugging |
41 |
| - - cabal configure -v2 --enable-tests |
42 |
| - |
43 |
| - # We'd like to |
44 |
| - # --enable-benchmarks |
45 |
| - # but CI time goes through the roof. Maybe there's a way to limit it to just one GHC version? |
46 |
| - |
47 |
| - # this builds all libraries and executables |
48 |
| - # (including tests/benchmarks) |
49 |
| - - cabal build |
50 |
| - - cabal test |
51 |
| - |
52 |
| - # tests that a source-distribution can be generated |
53 |
| - - cabal sdist |
54 |
| - |
55 |
| - # check that the generated source-distribution can be built & installed |
56 |
| - - export SRC_TGZ=$(cabal info . | awk '{print $2 ".tar.gz";exit}') ; |
57 |
| - cd dist/; |
58 |
| - if [ -f "$SRC_TGZ" ]; then |
59 |
| - cabal install --force-reinstalls "$SRC_TGZ"; |
60 |
| - else |
61 |
| - echo "expected '$SRC_TGZ' not found"; |
62 |
| - exit 1; |
63 |
| - fi |
| 118 | + - DISTDIR=$(mktemp -d /tmp/dist-test.XXXX) |
| 119 | + # Packaging... |
| 120 | + - ${CABAL} v2-sdist all | color_cabal_output |
| 121 | + # Unpacking... |
| 122 | + - mv dist-newstyle/sdist/*.tar.gz ${DISTDIR}/ |
| 123 | + - cd ${DISTDIR} || false |
| 124 | + - find . -maxdepth 1 -name '*.tar.gz' -exec tar -xvf '{}' \; |
| 125 | + # Generate cabal.project |
| 126 | + - rm -rf cabal.project cabal.project.local cabal.project.freeze |
| 127 | + - touch cabal.project |
| 128 | + - | |
| 129 | + echo 'packages: "containers-*/*.cabal"' >> cabal.project |
| 130 | + echo 'packages: "containers-tests-*/*.cabal"' >> cabal.project |
| 131 | + - | |
| 132 | + echo "write-ghc-environment-files: always" >> cabal.project |
| 133 | + - "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | grep -vE -- '^(binary|containers|containers-tests)$' | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done" |
| 134 | + - cat cabal.project || true |
| 135 | + - cat cabal.project.local || true |
| 136 | + # Building... |
| 137 | + # this builds all libraries and executables (without tests/benchmarks) |
| 138 | + - ${CABAL} v2-build -w ${HC} --disable-tests --disable-benchmarks all | color_cabal_output |
| 139 | + # Building with tests and benchmarks... |
| 140 | + # build & run tests, build benchmarks |
| 141 | + - ${CABAL} v2-build -w ${HC} ${TEST} ${BENCH} all | color_cabal_output |
| 142 | + # Testing... |
| 143 | + - ${CABAL} v2-test -w ${HC} ${TEST} ${BENCH} all | color_cabal_output |
| 144 | + # cabal check... |
| 145 | + - (cd containers-* && ${CABAL} -vnormal check) |
| 146 | + - (cd containers-tests-* && ${CABAL} -vnormal check) |
| 147 | + # haddock... |
| 148 | + - ${CABAL} v2-haddock -w ${HC} ${TEST} ${BENCH} all | color_cabal_output |
| 149 | + # Building without installed constraints for packages in global-db... |
| 150 | + - rm -f cabal.project.local |
| 151 | + - ${CABAL} v2-build -w ${HC} --disable-tests --disable-benchmarks all | color_cabal_output |
64 | 152 |
|
| 153 | +# REGENDATA ["--config=cabal.haskell-ci","cabal.project"] |
65 | 154 | # EOF
|
0 commit comments