Skip to content

dedifferentiator/codecov-haskell

Repository files navigation

codecov-haskell

Build Status CircleCI codecov BSD3 License Version on Hackage

codecov-haskell converts and sends Haskell projects hpc code coverage to codecov.io.

At the moment, Travis CI and Circle CI has been tested, but codecov-haskell should be compatible with other CI services in the future.

codecov-haskell is still under development and any contributions are welcome!

Usage

Travis CI

Below is a sample configuration for a project .travis.yml using cabal-install:

language: c
os: linux
git:
  depth: 3

cache:
  directories:
    - $HOME/.cabal/packages
    - $HOME/.cabal/store

jobs:
  include:
    - addons:
        apt: {sources: [hvr-ghc], packages: [cabal-install-3.0,ghc-8.8.2]}

install:
  - export PATH=/opt/ghc/bin:$PATH
  - travis_retry cabal v2-update

script:
  - cabal v2-configure --enable-tests --enable-coverage
  - cabal v2-build
  - cabal v2-test

after_script:
  # Building and installing codecov-haskell from git HEAD
  - git clone --depth 3 https://github.com/8c6794b6/codecov-haskell
  - ( cd codecov-haskell && cabal v2-install )
  - export PATH=$HOME/.cabal/bin:$PATH
  - which codecov-haskell

  # Variables for .tix and .mix arguments
  - VANILLA=$(find ./dist-newstyle -name 'vanilla' | head -1)
  - PKG=$(echo $VANILLA | cut -d/ -f6)
  - TIX=$VANILLA/tix/$PKG/$PKG.tix
  - MIX_DIR=$VANILLA/mix/$PKG
  - codecov-haskell --tix=$TIX --mix-dir=$MIX_DIR ccovhs-example-test

The codecov-haskell command

This command parses the hpc generated output, converts its to Codecov json format and finally sends it to codecov.io over http.

Options

--exclude-dir

The --exclude-dir option allows to exclude source files located under a given directory from the coverage report.
You can exclude source files located under the test/ directory by using this option as in the following example:

codecov-haskell --exclude-dir=test [test-suite-names]

You can specify multiple excluded folders by using the following example syntax:

codecov-haskell --exclude-dir=test1 --exclude-dir=test2 [test-suite-names]

--display-report

This boolean option prints the raw json coverage report to be sent to codecov.io.

--dont-send

This boolean option prevents codecov-haskell from sending the coverage report to codecov.io. This option can be used together with --display-report for testing purpose.
For example, you can try various combinations of the other options and confirm the difference in the resulting report outputs.

--print-response

This boolean option prints the raw json response received after posting the coverage report to codecov.io.

Limitations

Total coverage

Because of the way hpc works, coverage data is only generated for modules that are referenced directly or indirectly by the test suites. As a result, the total package coverage computed by Codecov may be higher than what it really is. An option will be added soon in order to allow specifying source folders to include in the total coverage computation.

Expression level coverage

Even though hpc supports expression level coverage, this version of codecov-haskell does not support it yet, but this feature will be implemented soon. Meanwhile, the hpc coverage information is converted into a line based report, in which a line can be: fully covered (green), partially covered (yellow) and not covered (red).

Contributing

codecov-haskell is still under development and any contributions are welcome!

License

BSD3 (tl;dr)

Notes

About

Uploader of haskell code coverage to codecov [WIP]

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 6