Merge pull request #56 from owickstrom/docs
[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-installed' '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.4.3"
40     # env: TEST=--disable-tests BENCH=--disable-benchmarks
41       addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-8.4.3], sources: [hvr-ghc]}}
42     - compiler: "ghc-8.2.2"
43     # env: TEST=--disable-tests BENCH=--disable-benchmarks
44       addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-8.2.2], sources: [hvr-ghc]}}
45     - compiler: "ghc-8.0.2"
46     # env: TEST=--disable-tests BENCH=--disable-benchmarks
47       addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-8.0.2], 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-2.2,ghc-7.10.3], sources: [hvr-ghc]}}
51     - compiler: "ghc-7.8.4"
52     # env: TEST=--disable-tests BENCH=--disable-benchmarks
53       addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-7.8.4], sources: [hvr-ghc]}}
54     - compiler: "ghc-7.6.3"
55       env: HADDOCK=false
56       addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-7.6.3], sources: [hvr-ghc]}}
57     - compiler: "ghc-7.4.2"
58     # env: TEST=--disable-tests BENCH=--disable-benchmarks
59       addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-7.4.2], sources: [hvr-ghc]}}
60     - compiler: "ghc-7.2.2"
61     # env: TEST=--disable-tests BENCH=--disable-benchmarks
62       addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-7.2.2], sources: [hvr-ghc]}}
63     - compiler: "ghc-7.0.4"
64     # env: TEST=--disable-tests BENCH=--disable-benchmarks
65       addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-7.0.4], sources: [hvr-ghc]}}
66     - compiler: "ghc-head"
67       env: GHCHEAD=true
68       addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-head], sources: [hvr-ghc]}}
69
70   allow_failures:
71     - compiler: "ghc-head"
72
73 before_install:
74   - HC=${CC}
75   - HCPKG=${HC/ghc/ghc-pkg}
76   - unset CC
77   - ROOTDIR=$(pwd)
78   - mkdir -p $HOME/.local/bin
79   - "PATH=/opt/ghc/bin:/opt/ghc-ppa-tools/bin:$HOME/local/bin:$PATH"
80   - HCNUMVER=$(( $(${HC} --numeric-version|sed -E 's/([0-9]+)\.([0-9]+)\.([0-9]+).*/\1 * 10000 + \2 * 100 + \3/') ))
81   - echo $HCNUMVER
82
83 install:
84   - cabal --version
85   - echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]"
86   - BENCH=${BENCH---enable-benchmarks}
87   - TEST=${TEST---enable-tests}
88   - HADDOCK=${HADDOCK-true}
89   - INSTALLED=${INSTALLED-true}
90   - GHCHEAD=${GHCHEAD-false}
91   - travis_retry cabal update -v
92   - "sed -i.bak 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config"
93   - rm -fv cabal.project cabal.project.local
94   # Overlay Hackage Package Index for GHC HEAD: https://github.com/hvr/head.hackage
95   - |
96     if $GHCHEAD; then
97       sed -i.bak 's/-- allow-newer:.*/allow-newer: *:base, *:template-haskell, *:ghc, *:Cabal/' ${HOME}/.cabal/config
98
99       echo 'repository head.hackage'                                                        >> ${HOME}/.cabal/config
100       echo '   url: http://head.hackage.haskell.org/'                                       >> ${HOME}/.cabal/config
101       echo '   secure: True'                                                                >> ${HOME}/.cabal/config
102       echo '   root-keys: 07c59cb65787dedfaef5bd5f987ceb5f7e5ebf88b904bbd4c5cbdeb2ff71b740' >> ${HOME}/.cabal/config
103       echo '              2e8555dde16ebd8df076f1a8ef13b8f14c66bad8eafefd7d9e37d0ed711821fb' >> ${HOME}/.cabal/config
104       echo '              8f79fd2389ab2967354407ec852cbe73f2e8635793ac446d09461ffb99527f6e' >> ${HOME}/.cabal/config
105       echo '   key-threshold: 3'                                                            >> ${HOME}/.cabal.config
106
107       cabal new-update head.hackage -v
108     fi
109   - grep -Ev -- '^\s*--' ${HOME}/.cabal/config | grep -Ev '^\s*$'
110   - "printf 'packages: \".\"\\n' > cabal.project"
111   - cat cabal.project
112   - if [ -f "./configure.ac" ]; then
113       (cd "." && autoreconf -i);
114     fi
115   - rm -f cabal.project.freeze
116   - cabal new-build -w ${HC} ${TEST} ${BENCH} --project-file="cabal.project" --dep -j2 all
117   - rm -rf .ghc.environment.* "."/dist
118   - DISTDIR=$(mktemp -d /tmp/dist-test.XXXX)
119
120 # Here starts the actual work to be performed for the package under test;
121 # any command which exits with a non-zero exit code causes the build to fail.
122 script:
123   # test that source-distributions can be generated
124   - (cd "." && cabal sdist)
125   - mv "."/dist/mtl-*.tar.gz ${DISTDIR}/
126   - cd ${DISTDIR} || false
127   - find . -maxdepth 1 -name '*.tar.gz' -exec tar -xvf '{}' \;
128   - "printf 'packages: mtl-*/*.cabal\\n' > cabal.project"
129   - cat cabal.project
130
131
132   # build & run tests, build benchmarks
133   - cabal new-build -w ${HC} ${TEST} ${BENCH} all
134
135   # cabal check
136   - (cd mtl-* && cabal check)
137
138   # haddock
139   - rm -rf ./dist-newstyle
140   - if $HADDOCK; then cabal new-haddock -w ${HC} ${TEST} ${BENCH} all; else echo "Skipping haddock generation";fi
141
142 # REGENDATA ["-o",".travis.yml","--ghc-head","--irc-channel=irc.freenode.org#haskell-lens","--no-no-tests-no-bench","--no-installed","cabal.project"]
143 # EOF