@@ -1,24 +1,23 @@
11# This Travis job script has been generated by a script via
22#
3−# haskell-ci '--branches' 'master' '--haddock=>=8.4' '--output' '.travis.yml' 'swagger2.cabal'
3+# haskell-ci '--branches' 'master' '--haddock-jobs=>=8.4' '--output' '.travis.yml' 'swagger2.cabal'
44#
55# For more information, see https://github.com/haskell-CI/haskell-ci
66#
7+# version: 0.3.20190413
8+#
79language: c
810dist: xenial
9−
1011git:
11− submodules: false # whether to recursively clone submodules
12−
12+ # whether to recursively clone submodules
13+ submodules: false
1314branches:
1415 only:
1516 - master
16−
1717cache:
1818 directories:
1919 - $HOME/.cabal/packages
2020 - $HOME/.cabal/store
21−
2221before_cache:
2322 - rm -fv $CABALHOME/packages/hackage.haskell.org/build-reports.log
2423 # remove files that are regenerated by 'cabal update'
@@ -27,94 +26,124 @@ before_cache:
2726 - rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.cache
2827 - rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.tar
2928 - rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.tar.idx
30−
3129 - rm -rfv $CABALHOME/packages/head.hackage
32−
3330matrix:
3431 include:
35− - compiler: "ghc-8.6.2"
36− addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.4,ghc-8.6.2], sources: [hvr-ghc]}}
37− - compiler: "ghc-8.4.4"
38− addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.4,ghc-8.4.4], sources: [hvr-ghc]}}
39− - compiler: "ghc-8.2.2"
40− addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.4,ghc-8.2.2], sources: [hvr-ghc]}}
41− - compiler: "ghc-8.0.2"
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− addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.4,ghc-7.10.3], sources: [hvr-ghc]}}
45− - compiler: "ghc-7.8.4"
46− addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.4,ghc-7.8.4], sources: [hvr-ghc]}}
47−
32+ - compiler: ghc-8.6.4
33+ addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.6.4","cabal-install-2.4"]}}
34+ - compiler: ghc-8.4.4
35+ addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.4.4","cabal-install-2.4"]}}
36+ - compiler: ghc-8.2.2
37+ addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.2.2","cabal-install-2.4"]}}
38+ - compiler: ghc-8.0.2
39+ addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.0.2","cabal-install-2.4"]}}
40+ - compiler: ghc-7.10.3
41+ addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-7.10.3","cabal-install-2.4"]}}
42+ - compiler: ghc-7.8.4
43+ addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-7.8.4","cabal-install-2.4"]}}
4844before_install:
49− - HC=/opt/ghc/bin/${CC}
50− - HCPKG=${HC/ghc/ghc-pkg}
45+ - HC=$(echo "/opt/$CC/bin/ghc" | sed 's/-/\//')
46+ - HCPKG="$HC-pkg"
5147 - unset CC
5248 - CABAL=/opt/ghc/bin/cabal
5349 - CABALHOME=$HOME/.cabal
54− - "export PATH=\"$CABALHOME/bin:$PATH\""
55− - ROOTDIR=$(pwd)
50+ - export PATH="$CABALHOME/bin:$PATH"
51+ - TOP=$(pwd)
5652 - HCNUMVER=$(( $(${HC} --numeric-version|sed -E 's/([0-9]+)\.([0-9]+)\.([0-9]+).*/\1 * 10000 + \2 * 100 + \3/') ))
5753 - echo $HCNUMVER
58−
54+ - CABAL="$CABAL -vnormal+nowrap+markoutput"
55+ - set -o pipefail
56+ - |
57+ echo 'function blue(s) { printf "\033[0;34m" s "\033[0m " }' >> .colorful.awk
58+ echo 'BEGIN { state = "output"; }' >> .colorful.awk
59+ echo '/^-----BEGIN CABAL OUTPUT-----$/ { state = "cabal" }' >> .colorful.awk
60+ echo '/^-----END CABAL OUTPUT-----$/ { state = "output" }' >> .colorful.awk
61+ echo '!/^(-----BEGIN CABAL OUTPUT-----|-----END CABAL OUTPUT-----)/ {' >> .colorful.awk
62+ echo ' if (state == "cabal") {' >> .colorful.awk
63+ echo ' print blue($0)' >> .colorful.awk
64+ echo ' } else {' >> .colorful.awk
65+ echo ' print $0' >> .colorful.awk
66+ echo ' }' >> .colorful.awk
67+ echo '}' >> .colorful.awk
68+ - cat .colorful.awk
69+ - |
70+ color_cabal_output () {
71+ awk -f $TOP/.colorful.awk
72+ }
73+ - echo text | color_cabal_output
5974install:
6075 - ${CABAL} --version
6176 - echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]"
6277 - TEST=--enable-tests
6378 - BENCH=--enable-benchmarks
6479 - GHCHEAD=${GHCHEAD-false}
65− - travis_retry ${CABAL} update -v
66− - "sed -i.bak 's/^jobs:/-- jobs:/' $CABALHOME/config"
67− - rm -fv cabal.project cabal.project.local
68− - grep -Ev -- '^\s*--' $CABALHOME/config | grep -Ev '^\s*$'
69− - rm -f cabal.project
80+ - rm -f $CABALHOME/config
81+ - |
82+ echo "verbose: normal +nowrap +markoutput" >> $CABALHOME/config
83+ echo "remote-build-reporting: anonymous" >> $CABALHOME/config
84+ echo "remote-repo-cache: $CABALHOME/packages" >> $CABALHOME/config
85+ echo "logs-dir: $CABALHOME/logs" >> $CABALHOME/config
86+ echo "world-file: $CABALHOME/world" >> $CABALHOME/config
87+ echo "extra-prog-path: $CABALHOME/bin" >> $CABALHOME/config
88+ echo "symlink-bindir: $CABALHOME/bin" >> $CABALHOME/config
89+ echo "build-summary: $CABALHOME/logs/build.log" >> $CABALHOME/config
90+ echo "store-dir: $CABALHOME/store" >> $CABALHOME/config
91+ echo "install-dirs user" >> $CABALHOME/config
92+ echo " prefix: $CABALHOME" >> $CABALHOME/config
93+ echo "repository hackage.haskell.org" >> $CABALHOME/config
94+ echo " url: http://hackage.haskell.org/" >> $CABALHOME/config
95+ - cat $CABALHOME/config
96+ - rm -fv cabal.project cabal.project.local cabal.project.freeze
97+ - travis_retry ${CABAL} v2-update -v
98+ # Generate cabal.project
99+ - rm -rf cabal.project cabal.project.local cabal.project.freeze
70100 - touch cabal.project
71− - "printf 'packages: \".\"\\n' >> cabal.project"
72− - "printf 'write-ghc-environment-files: always\\n' >> cabal.project"
73− - touch cabal.project.local
101+ - |
102+ echo 'packages: "."' >> cabal.project
103+ - |
104+ echo "write-ghc-environment-files: always" >> cabal.project
74105 - "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | grep -vE -- '^(swagger2)$' | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done"
75106 - cat cabal.project || true
76107 - cat cabal.project.local || true
77108 - if [ -f "./configure.ac" ]; then (cd "." && autoreconf -i); fi
78− - rm -f cabal.project.freeze
79− - ${CABAL} new-freeze -w ${HC} ${TEST} ${BENCH} --project-file="cabal.project" --dry
80− - "cat \"cabal.project.freeze\" | sed -E 's/^(constraints: *| *)//' | sed 's/any.//'"
81− - rm "cabal.project.freeze"
82− - ${CABAL} new-build -w ${HC} ${TEST} ${BENCH} --project-file="cabal.project" --dep -j2 all
83− - ${CABAL} new-build -w ${HC} --disable-tests --disable-benchmarks --project-file="cabal.project" --dep -j2 all
84− - rm -rf .ghc.environment.* "."/dist
85− - DISTDIR=$(mktemp -d /tmp/dist-test.XXXX)
86−
87−# Here starts the actual work to be performed for the package under test;
88−# any command which exits with a non-zero exit code causes the build to fail.
109+ - ${CABAL} v2-freeze -w ${HC} ${TEST} ${BENCH} | color_cabal_output
110+ - "cat cabal.project.freeze | sed -E 's/^(constraints: *| *)//' | sed 's/any.//'"
111+ - rm cabal.project.freeze
112+ - ${CABAL} v2-build -w ${HC} ${TEST} ${BENCH} --dep -j2 all | color_cabal_output
113+ - ${CABAL} v2-build -w ${HC} --disable-tests --disable-benchmarks --dep -j2 all | color_cabal_output
89114script:
90− # test that source-distributions can be generated
91− - ${CABAL} new-sdist all
115+ - DISTDIR=$(mktemp -d /tmp/dist-test.XXXX)
116+ # Packaging...
117+ - ${CABAL} v2-sdist all | color_cabal_output
118+ # Unpacking...
92119 - mv dist-newstyle/sdist/*.tar.gz ${DISTDIR}/
93120 - cd ${DISTDIR} || false
94121 - find . -maxdepth 1 -name '*.tar.gz' -exec tar -xvf '{}' \;
95− - rm -f cabal.project
122+ # Generate cabal.project
123+ - rm -rf cabal.project cabal.project.local cabal.project.freeze
96124 - touch cabal.project
97− - "printf 'packages: \"swagger2-*/*.cabal\"\\n' >> cabal.project"
98− - "printf 'write-ghc-environment-files: always\\n' >> cabal.project"
99− - touch cabal.project.local
125+ - |
126+ echo 'packages: "swagger2-*/*.cabal"' >> cabal.project
127+ - |
128+ echo "write-ghc-environment-files: always" >> cabal.project
100129 - "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | grep -vE -- '^(swagger2)$' | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done"
101130 - cat cabal.project || true
102131 - cat cabal.project.local || true
132+ # Building...
103133 # this builds all libraries and executables (without tests/benchmarks)
104− - ${CABAL} new-build -w ${HC} --disable-tests --disable-benchmarks all
105−
134+ - ${CABAL} v2-build -w ${HC} --disable-tests --disable-benchmarks all | color_cabal_output
135+ # Building with tests and benchmarks...
106136 # build & run tests, build benchmarks
107− - ${CABAL} new-build -w ${HC} ${TEST} ${BENCH} all
108− - if [ "x$TEST" = "x--enable-tests" ]; then ${CABAL} new-test -w ${HC} ${TEST} ${BENCH} all; fi
109−
110− # ${CABAL} check
111− - (cd swagger2-* && ${CABAL} check)
112−
113− # haddock
114− - if [ $HCNUMVER -ge 80400 ] ; then ${CABAL} new-haddock -w ${HC} ${TEST} ${BENCH} all ; fi
115−
116− # Build without installed constraints for packages in global-db
117− - rm -f cabal.project.local; ${CABAL} new-build -w ${HC} --disable-tests --disable-benchmarks all;
137+ - ${CABAL} v2-build -w ${HC} ${TEST} ${BENCH} all | color_cabal_output
138+ # Testing...
139+ - ${CABAL} v2-test -w ${HC} ${TEST} ${BENCH} all | color_cabal_output
140+ # cabal check...
141+ - (cd swagger2-* && ${CABAL} -vnormal check)
142+ # haddock...
143+ - if [ $HCNUMVER -ge 80400 ] ; then ${CABAL} v2-haddock -w ${HC} ${TEST} ${BENCH} all | color_cabal_output ; fi
144+ # Building without installed constraints for packages in global-db...
145+ - rm -f cabal.project.local
146+ - ${CABAL} v2-build -w ${HC} --disable-tests --disable-benchmarks all | color_cabal_output
118147
119−# REGENDATA ["--branches","master","--haddock=>=8.4","--output",".travis.yml","swagger2.cabal"]
148+# REGENDATA ["--branches","master","--haddock-jobs=>=8.4","--output",".travis.yml","swagger2.cabal"]
120149# EOF