git.iko.soy/typeable/pandoc
on master help sign in
New .travis.yml.

Autgenerated using make_travis_yml.hs. This script has been modified to add GHCOPTS. 'make .travis.yml' regenerates it based on the tested-with field of the cabal file.

commitc13494c8089fcbac70c83967ceaa5e88cdd30fac authorJohn MacFarlane <jgm@berkeley.edu> dateThu 8 Oct 2015, 13:39 (11 years ago) parent00e2ae8
4 files changed+275−19
.travis.yml+63−18 Makefile+3 make_travis_yml.hs+208 pandoc.cabal+1−1
.travis.yml+63−18
@@ -1,37 +1,82 @@
1−# NB: don't set `language: haskell` here
2−
3−# Ensures that sudo is disabled, so that containerized builds are allowed
1+# This file has been generated -- see https://github.com/hvr/multi-ghc-travis
2+language: c
43sudo: false
54
6−# The following enables several GHC versions to be tested; often it's enough to test only against the last release in a major GHC version. Feel free to omit lines listings versions you don't need/want testing for.
5+cache:
6+ directories:
7+ - $HOME/.cabsnap
8+ - $HOME/.cabal/packages
9+
10+before_cache:
11+ - rm -fv $HOME/.cabal/packages/hackage.haskell.org/build-reports.log
12+ - rm -fv $HOME/.cabal/packages/hackage.haskell.org/00-index.tar
13+
714matrix:
8− include:
9− - env: CABALVER=1.18 GHCVER=7.6.3 GHCOPTS="-Werror"
10− addons: {apt: {packages: [cabal-install-1.18, ghc-7.6.3], sources: [hvr-ghc]}}
11− - env: CABALVER=1.18 GHCVER=7.8.4 GHCOPTS="-Werror"
12− addons: {apt: {packages: [cabal-install-1.18, ghc-7.8.4], sources: [hvr-ghc]}}
13− - env: CABALVER=1.22 GHCVER=7.10.2 GHCOPTS=""
14− addons: {apt: {packages: [cabal-install-1.22, ghc-7.10.2],sources: [hvr-ghc]}}
15−
16−# Note: the distinction between `before_install` and `install` is not important.
15+ include:
16+ - env: CABALVER=1.16 GHCVER=7.6.3 GHCOPTS=-Werror
17+ compiler: ": #GHC 7.6.3"
18+ addons: {apt: {packages: [cabal-install-1.16,ghc-7.6.3], sources: [hvr-ghc]}}
19+ - env: CABALVER=1.18 GHCVER=7.8.4 GHCOPTS=-Werror
20+ compiler: ": #GHC 7.8.4"
21+ addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.4], sources: [hvr-ghc]}}
22+ - env: CABALVER=1.22 GHCVER=7.10.2 GHCOPTS=
23+ compiler: ": #GHC 7.10.2"
24+ addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.2], sources: [hvr-ghc]}}
25+
1726before_install:
27+ - unset CC
1828 - export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$PATH
1929
2030install:
2131 - cabal --version
22− - ghc --version
23− - travis_retry cabal update
24− - cabal install --only-dependencies --enable-tests
32+ - echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]"
33+ - if [ -f $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz ];
34+ then
35+ zcat $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz >
36+ $HOME/.cabal/packages/hackage.haskell.org/00-index.tar;
37+ fi
38+ - travis_retry cabal update -v
39+ - sed -i 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config
40+ - cabal install --only-dependencies --enable-tests --enable-benchmarks --dry -v > installplan.txt
41+ - sed -i -e '1,/^Resolving /d' installplan.txt; cat installplan.txt
2542
26−# Here starts the actual work to be performed for the package under test; any command which exits with a non-zero exit code causes the build to fail.
43+# check whether current requested install-plan matches cached package-db snapshot
44+ - if diff -u installplan.txt $HOME/.cabsnap/installplan.txt;
45+ then
46+ echo "cabal build-cache HIT";
47+ rm -rfv .ghc;
48+ cp -a $HOME/.cabsnap/ghc $HOME/.ghc;
49+ cp -a $HOME/.cabsnap/lib $HOME/.cabsnap/share $HOME/.cabsnap/bin $HOME/.cabal/;
50+ else
51+ echo "cabal build-cache MISS";
52+ rm -rf $HOME/.cabsnap;
53+ mkdir -p $HOME/.ghc $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin;
54+ cabal install --only-dependencies --enable-tests --enable-benchmarks;
55+ fi
56+
57+# snapshot package-db on cache miss
58+ - if [ ! -d $HOME/.cabsnap ];
59+ then
60+ echo "snapshotting package-db to build-cache";
61+ mkdir $HOME/.cabsnap;
62+ cp -a $HOME/.ghc $HOME/.cabsnap/ghc;
63+ cp -a $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin installplan.txt $HOME/.cabsnap/;
64+ fi
65+
66+# Here starts the actual work to be performed for the package under test;
67+# any command which exits with a non-zero exit code causes the build to fail.
2768script:
28− - cabal configure --enable-tests -v2 # -v2 provides useful information for debugging
69+ - if [ -f configure.ac ]; then autoreconf -i; fi
70+ - cabal configure --enable-tests --enable-benchmarks -v2 # -v2 provides useful information for debugging
2971 - cabal build --ghc-options=$GHCOPTS # this builds all libraries and executables (including tests/benchmarks)
3072 - cabal test
3173 - cabal check
3274 - cabal sdist # tests that a source-distribution can be generated
75+
3376# Check that the resulting source distribution can be built & installed.
3477# If there are no other `.tar.gz` files in `dist`, this can be even simpler:
3578# `cabal install --force-reinstalls dist/*-*.tar.gz`
3679 - SRC_TGZ=$(cabal info . | awk '{print $2;exit}').tar.gz &&
3780 (cd dist && cabal install --force-reinstalls "$SRC_TGZ")
81+
82+# EOF
Makefile+3
@@ -34,6 +34,9 @@ dist: man/pandoc.1
3434 cd pandoc-${version}
3535 cabal configure ${CABALARGS} && cabal build && cabal test && cd .. && rm -rf "pandoc-${version}"
3636
37+.travis.yml: pandoc.cabal
38+ runghc make_travis_yml.hs $< > $@
39+
3740debpkg: man/pandoc.1
3841 ./make_deb.sh
3942
make_travis_yml.hsnew file+208
@@ -0,0 +1,208 @@
1+#!/usr/bin/env runghc
2+
3+-- NB: This code deliberately avoids relying on non-standard packages
4+
5+import Control.Monad
6+import Data.List
7+import Data.Version (makeVersion)
8+import System.Environment
9+import System.Exit
10+import System.IO
11+
12+import Distribution.PackageDescription.Parse (readPackageDescription)
13+import Distribution.PackageDescription (packageDescription, testedWith)
14+import Distribution.Compiler (CompilerFlavor(..))
15+import Distribution.Version
16+import Distribution.Text
17+
18+putStrLnErr :: String -> IO ()
19+putStrLnErr m = hPutStrLn stderr ("*ERROR* " ++ m) >> exitFailure
20+
21+putStrLnWarn :: String -> IO ()
22+putStrLnWarn m = hPutStrLn stderr ("*WARNING* " ++ m)
23+
24+putStrLnInfo :: String -> IO ()
25+putStrLnInfo m = hPutStrLn stderr ("*INFO* " ++ m)
26+
27+main :: IO ()
28+main = do
29+ args <- getArgs
30+ case args of
31+ (cabfn:xpkgs) -> do genTravisFromCabalFile cabfn xpkgs
32+ _ -> putStrLnErr (unlines $ [ "expected .cabal file as command-line argument"
33+ , "Usage: make_travis_yml.hs <cabal-file> <extra-apt-packages...>"
34+ , ""
35+ , "Example: make_travis_yml.hs someProject.cabal alex-3.1.4 liblzma-dev > .travis.yml"
36+ ])
37+
38+genTravisFromCabalFile :: FilePath -> [String] -> IO ()
39+genTravisFromCabalFile fn xpkgs = do
40+ gpd <- readPackageDescription maxBound fn
41+
42+ let compilers = testedWith $ packageDescription $ gpd
43+
44+ let unknownComps = nub [ c | (c,_) <- compilers, c /= GHC ]
45+ ghcVerConstrs = [ vc | (GHC,vc) <- compilers ]
46+ ghcVerConstrs' = simplifyVersionRange $ foldr unionVersionRanges noVersion ghcVerConstrs
47+
48+ when (null compilers) $ do
49+ putStrLnErr "empty or missing 'tested-with:' definition in .cabal file"
50+
51+ unless (null unknownComps) $ do
52+ putStrLnWarn $ "ignoring unsupported compilers mentioned in tested-with: " ++ show unknownComps
53+
54+ when (null ghcVerConstrs) $ do
55+ putStrLnErr "'tested-with:' doesn't mention any 'GHC' version"
56+
57+ when (isNoVersion ghcVerConstrs') $ do
58+ putStrLnErr "'tested-with:' describes an empty version range for 'GHC'"
59+
60+ when (isAnyVersion ghcVerConstrs') $ do
61+ putStrLnErr "'tested-with:' allows /any/ 'GHC' version"
62+
63+ let testedGhcVersions = filter (`withinRange` ghcVerConstrs') knownGhcVersions
64+
65+ when (null testedGhcVersions) $ do
66+ putStrLnErr "no known GHC version is allowed by the 'tested-with' specification"
67+
68+ putStrLnInfo $ "Generating Travis-CI config for testing for GHC versions: " ++ (unwords $ map disp' $ testedGhcVersions)
69+
70+ ----------------------------------------------------------------------------
71+ -- travis.yml generation starts here
72+
73+ putStrLn "# This file has been generated -- see https://github.com/hvr/multi-ghc-travis"
74+ putStrLn "language: c"
75+ putStrLn "sudo: false"
76+ putStrLn ""
77+ putStrLn "cache:"
78+ putStrLn " directories:"
79+ putStrLn " - $HOME/.cabsnap"
80+ putStrLn " - $HOME/.cabal/packages"
81+ putStrLn ""
82+ putStrLn "before_cache:"
83+ putStrLn " - rm -fv $HOME/.cabal/packages/hackage.haskell.org/build-reports.log"
84+ putStrLn " - rm -fv $HOME/.cabal/packages/hackage.haskell.org/00-index.tar"
85+ putStrLn ""
86+ putStrLn "matrix:"
87+ putStrLn " include:"
88+
89+ forM_ testedGhcVersions $ \gv -> do
90+ let cvs = disp' (lookupCabVer gv)
91+ gvs = disp' gv
92+ ghcopts = if gv >= makeVersion [7,10,0]
93+ then ""
94+ else "-Werror"
95+
96+ xpkgs' = concatMap (',':) xpkgs
97+
98+ putStrLn $ concat [ " - env: CABALVER=", cvs, " GHCVER=", gvs,
99+ " GHCOPTS=", ghcopts]
100+ putStrLn $ concat [ " compiler: \": #GHC ", gvs, "\"" ]
101+ putStrLn $ concat [ " addons: {apt: {packages: [cabal-install-", cvs, ",ghc-", gvs, xpkgs'
102+ , "], sources: [hvr-ghc]}}" ]
103+ return ()
104+
105+ let headGhcVers = filter isHead testedGhcVersions
106+
107+ unless (null headGhcVers) $ do
108+ putStrLn ""
109+ putStrLn " allow_failures:"
110+
111+ forM_ headGhcVers $ \gv -> do
112+ let cvs = disp' (lookupCabVer gv)
113+ gvs = disp' gv
114+ putStrLn $ concat [ " - env: CABALVER=", cvs, " GHCVER=", gvs ]
115+
116+ putStrLn ""
117+ putStrLn "before_install:"
118+ putStrLn " - unset CC"
119+ putStrLn " - export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$PATH"
120+
121+ putStrLn ""
122+
123+ putStr $ unlines
124+ [ "install:"
125+ , " - cabal --version"
126+ , " - echo \"$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]\""
127+ , " - if [ -f $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz ];"
128+ , " then"
129+ , " zcat $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz >"
130+ , " $HOME/.cabal/packages/hackage.haskell.org/00-index.tar;"
131+ , " fi"
132+ , " - travis_retry cabal update -v"
133+ , " - sed -i 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config"
134+ , " - cabal install --only-dependencies --enable-tests --enable-benchmarks --dry -v > installplan.txt"
135+ , " - sed -i -e '1,/^Resolving /d' installplan.txt; cat installplan.txt"
136+ , ""
137+ , "# check whether current requested install-plan matches cached package-db snapshot"
138+ , " - if diff -u installplan.txt $HOME/.cabsnap/installplan.txt;"
139+ , " then"
140+ , " echo \"cabal build-cache HIT\";"
141+ , " rm -rfv .ghc;"
142+ , " cp -a $HOME/.cabsnap/ghc $HOME/.ghc;"
143+ , " cp -a $HOME/.cabsnap/lib $HOME/.cabsnap/share $HOME/.cabsnap/bin $HOME/.cabal/;"
144+ , " else"
145+ , " echo \"cabal build-cache MISS\";"
146+ , " rm -rf $HOME/.cabsnap;"
147+ , " mkdir -p $HOME/.ghc $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin;"
148+ , " cabal install --only-dependencies --enable-tests --enable-benchmarks;"
149+ , " fi"
150+ , " "
151+ , "# snapshot package-db on cache miss"
152+ , " - if [ ! -d $HOME/.cabsnap ];"
153+ , " then"
154+ , " echo \"snapshotting package-db to build-cache\";"
155+ , " mkdir $HOME/.cabsnap;"
156+ , " cp -a $HOME/.ghc $HOME/.cabsnap/ghc;"
157+ , " cp -a $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin installplan.txt $HOME/.cabsnap/;"
158+ , " fi"
159+ , ""
160+ , "# Here starts the actual work to be performed for the package under test;"
161+ , "# any command which exits with a non-zero exit code causes the build to fail."
162+ , "script:"
163+ , " - if [ -f configure.ac ]; then autoreconf -i; fi"
164+ , " - cabal configure --enable-tests --enable-benchmarks -v2 # -v2 provides useful information for debugging"
165+ , " - cabal build --ghc-options=$GHCOPTS # this builds all libraries and executables (including tests/benchmarks)"
166+ , " - cabal test"
167+ , " - cabal check"
168+ , " - cabal sdist # tests that a source-distribution can be generated"
169+ , ""
170+ , "# Check that the resulting source distribution can be built & installed."
171+ , "# If there are no other `.tar.gz` files in `dist`, this can be even simpler:"
172+ , "# `cabal install --force-reinstalls dist/*-*.tar.gz`"
173+ , " - SRC_TGZ=$(cabal info . | awk '{print $2;exit}').tar.gz &&"
174+ , " (cd dist && cabal install --force-reinstalls \"$SRC_TGZ\")"
175+ , ""
176+ , "# EOF"
177+ ]
178+
179+ return ()
180+ where
181+ knownGhcVersions :: [Version]
182+ knownGhcVersions = fmap (`Version` [])
183+ [ [7,0,1], [7,0,2], [7,0,3], [7,0,4]
184+ , [7,2,1], [7,2,2]
185+ , [7,4,1], [7,4,2]
186+ , [7,6,1], [7,6,2], [7,6,3]
187+ , [7,8,1], [7,8,2], [7,8,3], [7,8,4]
188+ , [7,10,1], [7,10,2]
189+ , [7,11] -- HEAD
190+ ]
191+
192+ lookupCabVer :: Version -> Version
193+ lookupCabVer (Version (x:y:_) _) = maybe (error "internal error") id $ lookup (x,y) cabalVerMap
194+ where
195+ cabalVerMap = fmap (fmap (`Version` []))
196+ [ ((7, 0), [1,16])
197+ , ((7, 2), [1,16])
198+ , ((7, 4), [1,16])
199+ , ((7, 6), [1,16])
200+ , ((7, 8), [1,18])
201+ , ((7,10), [1,22])
202+ , ((7,11), [1,23]) -- HEAD
203+ ]
204+
205+ isHead (Version (_:y:_) _) = odd (y :: Int)
206+
207+ disp' v | isHead v = "head"
208+ | otherwise = display v
pandoc.cabal+1−1
@@ -11,7 +11,7 @@ Bug-Reports: https://github.com/jgm/pandoc/issues
1111Stability: alpha
1212Homepage: http://pandoc.org
1313Category: Text
14−Tested-With: GHC == 7.4.2, GHC == 7.6.3, GHC == 7.8.2
14+Tested-With: GHC == 7.6.3, GHC == 7.8.4, GHC == 7.10.2
1515Synopsis: Conversion between markup formats
1616Description: Pandoc is a Haskell library for converting from one markup
1717 format to another, and a command-line tool that uses