Add GHC 8.4.1 to travis
[hsc2hs.git] / .travis.yml
1 # This Travis job script has been generated by a script via
2 #
3 #   runghc make_travis_yml_2.hs 'hsc2hs.cabal'
4 #
5 # For more information, see https://github.com/hvr/multi-ghc-travis
6 #
7 language: c
8 sudo: false
9
10 git:
11   submodules: false  # whether to recursively clone submodules
12
13 cache:
14   directories:
15     - $HOME/.cabal/packages
16     - $HOME/.cabal/store
17
18 before_cache:
19   - rm -fv $HOME/.cabal/packages/hackage.haskell.org/build-reports.log
20   # remove files that are regenerated by 'cabal update'
21   - rm -fv $HOME/.cabal/packages/hackage.haskell.org/00-index.*
22   - rm -fv $HOME/.cabal/packages/hackage.haskell.org/*.json
23   - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.cache
24   - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.tar
25   - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.tar.idx
26
27   - rm -rfv $HOME/.cabal/packages/head.hackage
28
29 matrix:
30   include:
31     - compiler: "ghc-7.0.4"
32       # can't build the testsuites dependencies with 7.0
33       env: INSTALLED=false TEST=--disable-tests BENCH=--disable-benchmarks
34       addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-7.0.4], sources: [hvr-ghc]}}
35     - compiler: "ghc-7.2.2"
36     # can't build the testsuites dependencies with 7.2
37       env: TEST=--disable-tests BENCH=--disable-benchmarks
38       addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-7.2.2], sources: [hvr-ghc]}}
39     - compiler: "ghc-7.4.2"
40     # env: TEST=--disable-tests BENCH=--disable-benchmarks
41       addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-7.4.2], sources: [hvr-ghc]}}
42     - compiler: "ghc-7.6.3"
43     # env: TEST=--disable-tests BENCH=--disable-benchmarks
44       addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-7.6.3], sources: [hvr-ghc]}}
45     - compiler: "ghc-7.8.4"
46     # env: TEST=--disable-tests BENCH=--disable-benchmarks
47       addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-7.8.4], sources: [hvr-ghc]}}
48     - compiler: "ghc-7.10.3"
49     # env: TEST=--disable-tests BENCH=--disable-benchmarks
50       addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-7.10.3], sources: [hvr-ghc]}}
51     - compiler: "ghc-8.0.2"
52     # env: TEST=--disable-tests BENCH=--disable-benchmarks
53       addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-8.0.2], sources: [hvr-ghc]}}
54     - compiler: "ghc-8.2.2"
55     # env: TEST=--disable-tests BENCH=--disable-benchmarks
56       addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-8.2.2], sources: [hvr-ghc]}}
57     - compiler: "ghc-8.4.1"
58       env: GHCHEAD=true
59       addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-8.4.1], sources: [hvr-ghc]}}
60
61   allow_failures:
62     - compiler: "ghc-8.4.1"
63
64 before_install:
65   - HC=${CC}
66   - HCPKG=${HC/ghc/ghc-pkg}
67   - unset CC
68   - ROOTDIR=$(pwd)
69   - mkdir -p $HOME/.local/bin
70   - "PATH=/opt/ghc/bin:/opt/ghc-ppa-tools/bin:$HOME/local/bin:$PATH"
71   - HCNUMVER=$(( $(${HC} --numeric-version|sed -E 's/([0-9]+)\.([0-9]+)\.([0-9]+).*/\1 * 10000 + \2 * 100 + \3/') ))
72   - echo $HCNUMVER
73
74 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   - HADDOCK=${HADDOCK-true}
80   - INSTALLED=${INSTALLED-true}
81   - GHCHEAD=${GHCHEAD-false}
82   - travis_retry cabal update -v
83   - "sed -i.bak 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config"
84   - rm -fv cabal.project cabal.project.local
85   # Overlay Hackage Package Index for GHC HEAD: https://github.com/hvr/head.hackage
86   - |
87     if $GHCHEAD; then
88       sed -i.bak 's/-- allow-newer:.*/allow-newer: *:base, *:template-haskell, *:ghc, *:Cabal/' ${HOME}/.cabal/config
89
90       echo 'repository head.hackage'                                                        >> ${HOME}/.cabal/config
91       echo '   url: http://head.hackage.haskell.org/'                                       >> ${HOME}/.cabal/config
92       echo '   secure: True'                                                                >> ${HOME}/.cabal/config
93       echo '   root-keys: 07c59cb65787dedfaef5bd5f987ceb5f7e5ebf88b904bbd4c5cbdeb2ff71b740' >> ${HOME}/.cabal/config
94       echo '              2e8555dde16ebd8df076f1a8ef13b8f14c66bad8eafefd7d9e37d0ed711821fb' >> ${HOME}/.cabal/config
95       echo '              8f79fd2389ab2967354407ec852cbe73f2e8635793ac446d09461ffb99527f6e' >> ${HOME}/.cabal/config
96       echo '   key-threshold: 3'                                                            >> ${HOME}/.cabal.config
97
98       cabal new-update head.hackage -v
99     fi
100   - grep -Ev -- '^\s*--' ${HOME}/.cabal/config | grep -Ev '^\s*$'
101   - "printf 'packages: \".\"\\n' > cabal.project"
102   - cat cabal.project
103   - if [ -f "./configure.ac" ]; then
104       (cd "." && autoreconf -i);
105     fi
106   - rm -f cabal.project.freeze
107   - cabal new-build -w ${HC} ${TEST} ${BENCH} --project-file="cabal.project" --dep -j2 all
108   - cabal new-build -w ${HC} --disable-tests --disable-benchmarks --project-file="cabal.project" --dep -j2 all
109   - rm -rf .ghc.environment.* "."/dist
110   - DISTDIR=$(mktemp -d /tmp/dist-test.XXXX)
111
112 # Here starts the actual work to be performed for the package under test;
113 # any command which exits with a non-zero exit code causes the build to fail.
114 script:
115   # test that source-distributions can be generated
116   - (cd "." && cabal sdist)
117   - mv "."/dist/hsc2hs-*.tar.gz ${DISTDIR}/
118   - cd ${DISTDIR} || false
119   - find . -maxdepth 1 -name '*.tar.gz' -exec tar -xvf '{}' \;
120   - "printf 'packages: hsc2hs-*/*.cabal\\n' > cabal.project"
121   - cat cabal.project
122   # this builds all libraries and executables (without tests/benchmarks)
123   - cabal new-build -w ${HC} --disable-tests --disable-benchmarks all
124
125   # Build with installed constraints for packages in global-db
126   - 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
127
128   # build & run tests, build benchmarks
129   - cabal new-build -w ${HC} ${TEST} ${BENCH} all
130   - if [ "x$TEST" = "x--enable-tests" ]; then cabal new-test -w ${HC} ${TEST} ${BENCH} all; fi
131
132   # cabal check
133   - (cd hsc2hs-* && cabal check)
134
135 # REGENDATA ["hsc2hs.cabal"]
136 # EOF