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