Try NOINSTALLEDCONSTRAINTS=true
[packages/mtl.git] / .travis.yml
1 # This Travis job script has been generated by a script via
2 #
3 #   runghc make_travis_yml_2.hs '-o' '.travis.yml' '--ghc-head' '--irc-channel=irc.freenode.org#haskell-lens' '--no-no-tests-no-bench' '--no-unconstrained' 'cabal.project'
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 notifications:
14   irc:
15     channels:
16       - "irc.freenode.org#haskell-lens"
17     skip_join: true
18     template:
19       - "\x0313mtl\x03/\x0306%{branch}\x03 \x0314%{commit}\x03 %{build_url} %{message}"
20
21 cache:
22   directories:
23     - $HOME/.cabal/packages
24     - $HOME/.cabal/store
25
26 before_cache:
27   - rm -fv $HOME/.cabal/packages/hackage.haskell.org/build-reports.log
28   # remove files that are regenerated by 'cabal update'
29   - rm -fv $HOME/.cabal/packages/hackage.haskell.org/00-index.*
30   - rm -fv $HOME/.cabal/packages/hackage.haskell.org/*.json
31   - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.cache
32   - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.tar
33   - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.tar.idx
34
35   - rm -rfv $HOME/.cabal/packages/head.hackage
36
37 matrix:
38   include:
39     - compiler: "ghc-8.6.1"
40       env: GHCHEAD=true NOINSTALLEDCONSTRAINTS=true
41       addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-8.6.1], sources: [hvr-ghc]}}
42     - compiler: "ghc-8.4.3"
43       env: NOINSTALLEDCONSTRAINTS=true
44       addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-8.4.3], sources: [hvr-ghc]}}
45     - compiler: "ghc-8.2.2"
46       env: NOINSTALLEDCONSTRAINTS=true
47       addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-8.2.2], sources: [hvr-ghc]}}
48     - compiler: "ghc-8.0.2"
49       env: NOINSTALLEDCONSTRAINTS=true
50       addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-8.0.2], sources: [hvr-ghc]}}
51     - compiler: "ghc-7.10.3"
52       env: NOINSTALLEDCONSTRAINTS=true
53       addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-7.10.3], sources: [hvr-ghc]}}
54     - compiler: "ghc-7.8.4"
55       env: NOINSTALLEDCONSTRAINTS=true
56       addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-7.8.4], sources: [hvr-ghc]}}
57     - compiler: "ghc-7.6.3"
58       env: HADDOCK=false NOINSTALLEDCONSTRAINTS=true
59       addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-7.6.3], sources: [hvr-ghc]}}
60     - compiler: "ghc-7.4.2"
61       env: NOINSTALLEDCONSTRAINTS=true
62       addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-7.4.2], sources: [hvr-ghc]}}
63     - compiler: "ghc-7.2.2"
64       env: NOINSTALLEDCONSTRAINTS=true
65       addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-7.2.2], sources: [hvr-ghc]}}
66     - compiler: "ghc-7.0.4"
67       env: NOINSTALLEDCONSTRAINTS=true
68       addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-7.0.4], sources: [hvr-ghc]}}
69     - compiler: "ghc-head"
70       env: GHCHEAD=true NOINSTALLEDCONSTRAINTS=true
71       addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-head], sources: [hvr-ghc]}}
72
73   allow_failures:
74     - compiler: "ghc-head"
75     - compiler: "ghc-8.6.1"
76
77 before_install:
78   - HC=${CC}
79   - HCPKG=${HC/ghc/ghc-pkg}
80   - unset CC
81   - ROOTDIR=$(pwd)
82   - mkdir -p $HOME/.local/bin
83   - "PATH=/opt/ghc/bin:/opt/ghc-ppa-tools/bin:$HOME/local/bin:$PATH"
84   - HCNUMVER=$(( $(${HC} --numeric-version|sed -E 's/([0-9]+)\.([0-9]+)\.([0-9]+).*/\1 * 10000 + \2 * 100 + \3/') ))
85   - echo $HCNUMVER
86
87 install:
88   - cabal --version
89   - echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]"
90   - BENCH=${BENCH---enable-benchmarks}
91   - TEST=${TEST---enable-tests}
92   - HADDOCK=${HADDOCK-true}
93   - UNCONSTRAINED=${UNCONSTRAINED-true}
94   - NOINSTALLEDCONSTRAINTS=${NOINSTALLEDCONSTRAINTS-false}
95   - GHCHEAD=${GHCHEAD-false}
96   - travis_retry cabal update -v
97   - "sed -i.bak 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config"
98   - rm -fv cabal.project cabal.project.local
99   # Overlay Hackage Package Index for GHC HEAD: https://github.com/hvr/head.hackage
100   - |
101     if $GHCHEAD; then
102       sed -i 's/-- allow-newer: .*/allow-newer: *:base/' ${HOME}/.cabal/config
103       for pkg in $($HCPKG list --simple-output); do pkg=$(echo $pkg | sed 's/-[^-]*$//'); sed -i "s/allow-newer: /allow-newer: *:$pkg, /" ${HOME}/.cabal/config; done
104
105       echo 'repository head.hackage'                                                        >> ${HOME}/.cabal/config
106       echo '   url: http://head.hackage.haskell.org/'                                       >> ${HOME}/.cabal/config
107       echo '   secure: True'                                                                >> ${HOME}/.cabal/config
108       echo '   root-keys: 07c59cb65787dedfaef5bd5f987ceb5f7e5ebf88b904bbd4c5cbdeb2ff71b740' >> ${HOME}/.cabal/config
109       echo '              2e8555dde16ebd8df076f1a8ef13b8f14c66bad8eafefd7d9e37d0ed711821fb' >> ${HOME}/.cabal/config
110       echo '              8f79fd2389ab2967354407ec852cbe73f2e8635793ac446d09461ffb99527f6e' >> ${HOME}/.cabal/config
111       echo '   key-threshold: 3'                                                            >> ${HOME}/.cabal.config
112
113       grep -Ev -- '^\s*--' ${HOME}/.cabal/config | grep -Ev '^\s*$'
114
115       cabal new-update head.hackage -v
116     fi
117   - grep -Ev -- '^\s*--' ${HOME}/.cabal/config | grep -Ev '^\s*$'
118   - "printf 'packages: \".\"\\n' > cabal.project"
119   - touch cabal.project.local
120   - "if ! $NOINSTALLEDCONSTRAINTS; then for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/^/constraints: /' | sed 's/-[^-]*$/ installed/' >> cabal.project.local; done; fi"
121   - cat cabal.project || true
122   - cat cabal.project.local || true
123   - if [ -f "./configure.ac" ]; then
124       (cd "." && autoreconf -i);
125     fi
126   - rm -f cabal.project.freeze
127   - cabal new-build -w ${HC} ${TEST} ${BENCH} --project-file="cabal.project" --dep -j2 all
128   - rm -rf .ghc.environment.* "."/dist
129   - DISTDIR=$(mktemp -d /tmp/dist-test.XXXX)
130
131 # Here starts the actual work to be performed for the package under test;
132 # any command which exits with a non-zero exit code causes the build to fail.
133 script:
134   # test that source-distributions can be generated
135   - (cd "." && cabal sdist)
136   - mv "."/dist/mtl-*.tar.gz ${DISTDIR}/
137   - cd ${DISTDIR} || false
138   - find . -maxdepth 1 -name '*.tar.gz' -exec tar -xvf '{}' \;
139   - "printf 'packages: mtl-*/*.cabal\\n' > cabal.project"
140   - touch cabal.project.local
141   - "if ! $NOINSTALLEDCONSTRAINTS; then for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/^/constraints: /' | sed 's/-[^-]*$/ installed/' >> cabal.project.local; done; fi"
142   - cat cabal.project || true
143   - cat cabal.project.local || true
144
145   # build & run tests, build benchmarks
146   - cabal new-build -w ${HC} ${TEST} ${BENCH} all
147
148   # cabal check
149   - (cd mtl-* && cabal check)
150
151   # haddock
152   - rm -rf ./dist-newstyle
153   - if $HADDOCK; then cabal new-haddock -w ${HC} ${TEST} ${BENCH} all; else echo "Skipping haddock generation";fi
154
155 # REGENDATA ["-o",".travis.yml","--ghc-head","--irc-channel=irc.freenode.org#haskell-lens","--no-no-tests-no-bench","--no-unconstrained","cabal.project"]
156 # EOF