Merge pull request #118
[packages/unix.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' '--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 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-8.6.1"
32       env: GHCHEAD=true
33       addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-8.6.1], sources: [hvr-ghc]}}
34     - compiler: "ghc-8.4.3"
35     # env: TEST=--disable-tests BENCH=--disable-benchmarks
36       addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-8.4.3], sources: [hvr-ghc]}}
37     - compiler: "ghc-8.4.2"
38     # env: TEST=--disable-tests BENCH=--disable-benchmarks
39       addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-8.4.2], sources: [hvr-ghc]}}
40     - compiler: "ghc-8.4.1"
41     # env: TEST=--disable-tests BENCH=--disable-benchmarks
42       addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-8.4.1], sources: [hvr-ghc]}}
43     - compiler: "ghc-8.2.2"
44     # env: TEST=--disable-tests BENCH=--disable-benchmarks
45       addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-8.2.2], sources: [hvr-ghc]}}
46     - compiler: "ghc-8.2.1"
47     # env: TEST=--disable-tests BENCH=--disable-benchmarks
48       addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-8.2.1], sources: [hvr-ghc]}}
49     - compiler: "ghc-8.0.2"
50     # env: TEST=--disable-tests BENCH=--disable-benchmarks
51       addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-8.0.2], sources: [hvr-ghc]}}
52     - compiler: "ghc-8.0.1"
53     # env: TEST=--disable-tests BENCH=--disable-benchmarks
54       addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-8.0.1], sources: [hvr-ghc]}}
55     - compiler: "ghc-7.10.3"
56     # env: TEST=--disable-tests BENCH=--disable-benchmarks
57       addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-7.10.3], sources: [hvr-ghc]}}
58     - compiler: "ghc-7.10.2"
59     # env: TEST=--disable-tests BENCH=--disable-benchmarks
60       addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-7.10.2], sources: [hvr-ghc]}}
61     - compiler: "ghc-7.10.1"
62     # env: TEST=--disable-tests BENCH=--disable-benchmarks
63       addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-7.10.1], sources: [hvr-ghc]}}
64     - compiler: "ghc-7.8.4"
65     # env: TEST=--disable-tests BENCH=--disable-benchmarks
66       addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-7.8.4], sources: [hvr-ghc]}}
67     - compiler: "ghc-7.8.3"
68     # env: TEST=--disable-tests BENCH=--disable-benchmarks
69       addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-7.8.3], sources: [hvr-ghc]}}
70     - compiler: "ghc-7.8.2"
71     # env: TEST=--disable-tests BENCH=--disable-benchmarks
72       addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-7.8.2], sources: [hvr-ghc]}}
73     - compiler: "ghc-7.8.1"
74     # env: TEST=--disable-tests BENCH=--disable-benchmarks
75       addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-7.8.1], sources: [hvr-ghc]}}
76     - compiler: "ghc-7.6.3"
77     # env: TEST=--disable-tests BENCH=--disable-benchmarks
78       addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-7.6.3], sources: [hvr-ghc]}}
79     - compiler: "ghc-7.6.2"
80     # env: TEST=--disable-tests BENCH=--disable-benchmarks
81       addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-7.6.2], sources: [hvr-ghc]}}
82     - compiler: "ghc-7.6.1"
83     # env: TEST=--disable-tests BENCH=--disable-benchmarks
84       addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-7.6.1], sources: [hvr-ghc]}}
85     - compiler: "ghc-7.4.2"
86     # env: TEST=--disable-tests BENCH=--disable-benchmarks
87       addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-7.4.2], sources: [hvr-ghc]}}
88     - compiler: "ghc-7.4.1"
89     # env: TEST=--disable-tests BENCH=--disable-benchmarks
90       addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-7.4.1], sources: [hvr-ghc]}}
91     - compiler: "ghc-head"
92       env: GHCHEAD=true
93       addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-head], sources: [hvr-ghc]}}
94
95   allow_failures:
96     - compiler: "ghc-head"
97     - compiler: "ghc-8.6.1"
98
99 before_install:
100   - HC=${CC}
101   - HCPKG=${HC/ghc/ghc-pkg}
102   - unset CC
103   - ROOTDIR=$(pwd)
104   - mkdir -p $HOME/.local/bin
105   - "PATH=/opt/ghc/bin:/opt/ghc-ppa-tools/bin:$HOME/local/bin:$PATH"
106   - HCNUMVER=$(( $(${HC} --numeric-version|sed -E 's/([0-9]+)\.([0-9]+)\.([0-9]+).*/\1 * 10000 + \2 * 100 + \3/') ))
107   - echo $HCNUMVER
108
109 install:
110   - cabal --version
111   - echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]"
112   - BENCH=${BENCH---enable-benchmarks}
113   - TEST=${TEST---enable-tests}
114   - HADDOCK=${HADDOCK-true}
115   - UNCONSTRAINED=${UNCONSTRAINED-true}
116   - NOINSTALLEDCONSTRAINTS=${NOINSTALLEDCONSTRAINTS-false}
117   - GHCHEAD=${GHCHEAD-false}
118   - travis_retry cabal update -v
119   - "sed -i.bak 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config"
120   - rm -fv cabal.project cabal.project.local
121   # Overlay Hackage Package Index for GHC HEAD: https://github.com/hvr/head.hackage
122   - |
123     if $GHCHEAD; then
124       sed -i 's/-- allow-newer: .*/allow-newer: *:base/' ${HOME}/.cabal/config
125       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
126
127       echo 'repository head.hackage'                                                        >> ${HOME}/.cabal/config
128       echo '   url: http://head.hackage.haskell.org/'                                       >> ${HOME}/.cabal/config
129       echo '   secure: True'                                                                >> ${HOME}/.cabal/config
130       echo '   root-keys: 07c59cb65787dedfaef5bd5f987ceb5f7e5ebf88b904bbd4c5cbdeb2ff71b740' >> ${HOME}/.cabal/config
131       echo '              2e8555dde16ebd8df076f1a8ef13b8f14c66bad8eafefd7d9e37d0ed711821fb' >> ${HOME}/.cabal/config
132       echo '              8f79fd2389ab2967354407ec852cbe73f2e8635793ac446d09461ffb99527f6e' >> ${HOME}/.cabal/config
133       echo '   key-threshold: 3'                                                            >> ${HOME}/.cabal.config
134
135       grep -Ev -- '^\s*--' ${HOME}/.cabal/config | grep -Ev '^\s*$'
136
137       cabal new-update head.hackage -v
138     fi
139   - grep -Ev -- '^\s*--' ${HOME}/.cabal/config | grep -Ev '^\s*$'
140   - "printf 'packages: \".\"\\n' > cabal.project"
141   - touch cabal.project.local
142   - "if ! $NOINSTALLEDCONSTRAINTS; then for pkg in $($HCPKG list --simple-output); do echo $pkg  | grep -vw -- unix | sed 's/^/constraints: /' | sed 's/-[^-]*$/ installed/' >> cabal.project.local; done; fi"
143   - cat cabal.project || true
144   - cat cabal.project.local || true
145   - if [ -f "./configure.ac" ]; then
146       (cd "." && autoreconf -i);
147     fi
148   - rm -f cabal.project.freeze
149   - cabal new-build -w ${HC} ${TEST} ${BENCH} --project-file="cabal.project" --dep -j2 all
150   - cabal new-build -w ${HC} --disable-tests --disable-benchmarks --project-file="cabal.project" --dep -j2 all
151   - rm -rf .ghc.environment.* "."/dist
152   - DISTDIR=$(mktemp -d /tmp/dist-test.XXXX)
153
154 # Here starts the actual work to be performed for the package under test;
155 # any command which exits with a non-zero exit code causes the build to fail.
156 script:
157   # test that source-distributions can be generated
158   - (cd "." && cabal sdist)
159   - mv "."/dist/unix-*.tar.gz ${DISTDIR}/
160   - cd ${DISTDIR} || false
161   - find . -maxdepth 1 -name '*.tar.gz' -exec tar -xvf '{}' \;
162   - "printf 'packages: unix-*/*.cabal\\n' > cabal.project"
163   - touch cabal.project.local
164   - "if ! $NOINSTALLEDCONSTRAINTS; then for pkg in $($HCPKG list --simple-output); do echo $pkg  | grep -vw -- unix | sed 's/^/constraints: /' | sed 's/-[^-]*$/ installed/' >> cabal.project.local; done; fi"
165   - cat cabal.project || true
166   - cat cabal.project.local || true
167   # this builds all libraries and executables (without tests/benchmarks)
168   - cabal new-build -w ${HC} --disable-tests --disable-benchmarks all
169
170   # build & run tests, build benchmarks
171   - cabal new-build -w ${HC} ${TEST} ${BENCH} all
172
173   # cabal check
174   - (cd unix-* && cabal check)
175
176   # haddock
177   - rm -rf ./dist-newstyle
178   - if $HADDOCK; then cabal new-haddock -w ${HC} ${TEST} ${BENCH} all; else echo "Skipping haddock generation";fi
179
180 # REGENDATA ["-o",".travis.yml","--ghc-head","--no-unconstrained","cabal.project"]
181 # EOF