543f1c62260999fd6920c8187cca0590337facec
[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.1"
55     # env: TEST=--disable-tests BENCH=--disable-benchmarks
56       addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-8.2.1], sources: [hvr-ghc]}}
57
58 before_install:
59   - HC=${CC}
60   - HCPKG=${HC/ghc/ghc-pkg}
61   - unset CC
62   - ROOTDIR=$(pwd)
63   - mkdir -p $HOME/.local/bin
64   - "PATH=/opt/ghc/bin:/opt/ghc-ppa-tools/bin:$HOME/local/bin:$PATH"
65   - HCNUMVER=$(( $(${HC} --numeric-version|sed -E 's/([0-9]+)\.([0-9]+)\.([0-9]+).*/\1 * 10000 + \2 * 100 + \3/') ))
66   - echo $HCNUMVER
67
68 install:
69   - cabal --version
70   - echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]"
71   - BENCH=${BENCH---enable-benchmarks}
72   - TEST=${TEST---enable-tests}
73   - HADDOCK=${HADDOCK-true}
74   - INSTALLED=${INSTALLED-true}
75   - GHCHEAD=${GHCHEAD-false}
76   - travis_retry cabal update -v
77   - "sed -i.bak 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config"
78   - rm -fv cabal.project cabal.project.local
79   - grep -Ev -- '^\s*--' ${HOME}/.cabal/config | grep -Ev '^\s*$'
80   - "printf 'packages: \".\"\\n' > cabal.project"
81   - cat cabal.project
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.
93 script:
94   # test that source-distributions can be generated
95   - (cd "." && cabal sdist)
96   - mv "."/dist/hsc2hs-*.tar.gz ${DISTDIR}/
97   - cd ${DISTDIR} || false
98   - find . -maxdepth 1 -name '*.tar.gz' -exec tar -xvf '{}' \;
99   - "printf 'packages: hsc2hs-*/*.cabal\\n' > cabal.project"
100   - cat cabal.project
101   # this builds all libraries and executables (without tests/benchmarks)
102   - cabal new-build -w ${HC} --disable-tests --disable-benchmarks all
103
104   # Build with installed constraints for packages in global-db
105   - 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
106
107   # 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 hsc2hs-* && cabal check)
113
114 # REGENDATA ["hsc2hs.cabal"]
115 # EOF