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