hpc-coveralls 0.2.0 → 0.2.1
raw patch · 5 files changed
+136/−1 lines, 5 files
Files
- CHANGELOG.md +12/−0
- README.md +87/−0
- hpc-coveralls.cabal +8/−1
- src/HpcCoverallsCmdLine.hs +23/−0
- src/Trace/Hpc/Coveralls/Config.hs +6/−0
+ CHANGELOG.md view
@@ -0,0 +1,12 @@+[0.2.1](https://github.com/guillaume-nargeot/hpc-coveralls/issues?milestone=2&state=closed)+-----+* Additional CI services support (issue #1)+* Fixed an issue in which mix files could not be found, @maoe contribution (issue #5)+* Introduced a command line argument to exclude files located under a given folder from the coverage report (issue #6)+* Return with non-zero exit code when the tix file is not found (issue #7)+* Introduced a command line argument to specify a custom cabal executable name (issue #8)+* Parse and display response from coveralls.io (issue #9)++0.1.0+-----+* Initial release
+ README.md view
@@ -0,0 +1,87 @@+hpc-coveralls [](https://travis-ci.org/guillaume-nargeot/hpc-coveralls)+=============++hpc-coveralls converts and sends Haskell projects hpc code coverage to [coverall.io](http://coveralls.io/).++At the moment, only [Travis CI](http://travis-ci.org) has been tested, but hpc-coveralls should be compatible with other CI services (Check `HpcCoverallsMain` [source](https://github.com/guillaume-nargeot/hpc-coveralls/blob/master/src/HpcCoverallsMain.hs) for the list).++hpc-coveralls is still under development and any contributions are welcome!++# Usage++## Travis CI++Commands to add to your project `.travis.yml`:+```yaml+before_install:+ - cabal install hpc-coveralls+script:+ - cabal configure --enable-tests --enable-library-coverage && cabal build+ - run-cabal-test [options] [cabal-test-options]+after_script:+ - hpc-coveralls [options] [test-suite-name]+```++Note that the usual `cabal test` command is replaced by `run-cabal-test`.+The reason for this is explained in the next section.++For an example usage, please refer to [this-project](https://github.com/guillaume-nargeot/project-euler-haskell) `.travis.yml` file ([result on coveralls](https://coveralls.io/r/guillaume-nargeot/project-euler-haskell)).++## The run-cabal-test command++When using hpc 0.6, `cabal test` outputs an error message and exits with the error code `1`, which results in a build failure.++In order to prevent this from happening, hpc-coveralls provides the `run-cabal-test` command which runs `cabal test` and returns with `0` if the regex `^Test suite .*: FAIL$` never matches any line of the output.++This hpc issue should be fixed in version 0.7 (not yet available on Travis CI).++### Options++The `--cabal-name` option can be used to specify a custom executable name instead of the default `cabal` when calling `cabal test`.<br/>+Below is an example which can be useful for projects with a Travis configuration based on [multi-ghc-travis](https://github.com/hvr/multi-ghc-travis):++```yaml+run-cabal-test --cabal-name=cabal-1.18+```++## The hpc-coveralls command++At the moment, you can specify only one suite. For example, if your test suite is named `test-all`, use the command as follows:++```yaml+hpc-coveralls test-all+```++### Options++The `--exclude-dir` option can be used to exclude source files located under a given directory from the coverage report.<br/>+You can exclude source files located under the `test/` by using this option as in the following example:++```yaml+hpc-coveralls --exclude-dir=test [test-suite-name]+```++# Limitations++As Coveralls doesn't support yet partial-line coverage, the following convention is used to represent line coverage with line hit counts:+- `0` : the line is never hit,+- `1` : the line is partially covered,+- `2` : the line is fully covered.++This convention is the same as the one used by [cloverage](https://github.com/lshift/cloverage) coveralls output for Clojure projects code coverage.++There's an [open issue](https://github.com/lemurheavy/coveralls-public/issues/216) to improve this.++# Contributing++hpc-coveralls is still under development and any contributions are welcome!++[Future Plans and Ideas](https://github.com/guillaume-nargeot/hpc-coveralls/wiki/Future-Plans-and-Ideas)++# License++BSD3 ([tl;dr](https://tldrlegal.com/license/bsd-3-clause-license-(revised)))++# Notes++- HPC publication: http://ittc.ku.edu/~andygill/papers/Hpc07.pdf
hpc-coveralls.cabal view
@@ -1,5 +1,5 @@ name: hpc-coveralls-version: 0.2.0+version: 0.2.1 synopsis: Coveralls.io support for Haskell. description: This utility converts and sends Haskell projects hpc code coverage to@@ -32,6 +32,10 @@ bug-reports: https://github.com/guillaume-nargeot/hpc-coveralls homepage: https://github.com/guillaume-nargeot/hpc-coveralls/issues +extra-source-files:+ README.md,+ CHANGELOG.md+ source-repository head type: git location: https://github.com/guillaume-nargeot/hpc-coveralls.git@@ -39,13 +43,16 @@ library hs-source-dirs: src exposed-modules:+ HpcCoverallsCmdLine, Trace.Hpc.Coveralls,+ Trace.Hpc.Coveralls.Config, Trace.Hpc.Coveralls.Curl, Trace.Hpc.Lix build-depends: aeson, base < 5, bytestring >= 0.10,+ cmdargs >= 0.10, curl >= 1.3.8, hpc >= 0.6.0.0, regex-posix
+ src/HpcCoverallsCmdLine.hs view
@@ -0,0 +1,23 @@+{-# LANGUAGE DeriveDataTypeable #-}++module HpcCoverallsCmdLine where++import Data.List+import Data.Version (Version(..))+import Paths_hpc_coveralls (version)+import System.Console.CmdArgs++data HpcCoverallsArgs = CmdMain+ { excludeDirs :: Maybe [String]+ , testSuites :: [String]+ , displayReport :: Bool+ } deriving (Data, Show, Typeable)++hpcCoverallsArgs :: HpcCoverallsArgs+hpcCoverallsArgs = CmdMain+ { excludeDirs = Nothing &= explicit &= typDir &= name "exclude-dir" &= help "Exclude sources files under the matching directory from the coverage report send to coveralls.io"+ , displayReport = False &= explicit &= name "display-report" &= help "Display the json code coverage report that will be sent to coveralls.io"+ , testSuites = [] &= typ "TEST-SUITE" &= args+ } &= summary ("hpc-coveralls-" ++ versionString version ++ ", (C) Guillaume Nargeot 2014")+ &= program "hpc-coveralls"+ where versionString = intercalate "." . map show . versionBranch
+ src/Trace/Hpc/Coveralls/Config.hs view
@@ -0,0 +1,6 @@+module Trace.Hpc.Coveralls.Config where++data Config = Config {+ testSuiteNames :: [String],+ excludedDirs :: [String]+ }