hpc-codecov: Generate codecov report from hpc data

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain] [Publish]

The hpc-codecov package contains an executable and library codes for generating Codeocv JSON coverage report from .tix and .mix files made with hpc. See the README for more info.


[Skip to Readme]

Properties

Versions 0.1.0.0, 0.2.0.0, 0.2.0.1, 0.2.0.2, 0.2.0.2, 0.3.0.0, 0.4.0.0, 0.4.1.0, 0.4.2.0, 0.5.0.0, 0.6.0.0, 0.6.1.0, 0.6.2.0
Change log CHANGELOG.md
Dependencies array (>=0.1 && <0.6), base (>=4.10 && <5), bytestring (>=0.10 && <0.12), directory (>=1.3.0 && <1.4.0), filepath (>=1.4.1 && <1.5), hpc (>=0.6 && <0.7), hpc-codecov [details]
License BSD-3-Clause
Copyright (c) 2020 8c6794b6
Author 8c6794b6
Maintainer 8c6794b6@gmail.com
Category Test, Data
Home page https://github.com/8c6794b6/hpc-codecov#readme
Source repo head: git clone https://github.com/8c6794b6/hpc-codecov.git
Uploaded by AtsuroHoshino at 2021-03-25T10:21:56Z

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


Readme for hpc-codecov-0.2.0.2

[back to package description]

hpc-codecov Hackage Stackage

codecov Travis CircleCI AppVeyor GitHub

The hpc-codecov package contains an executable and library codes for generating Codecov JSON coverage report from .tix and .mix files made with hpc.

The hpc-codecov executable does not try to find out the location of .tix and mix files. Instead, let the user to explicitly specify the file paths and directories. The rational behind the decision is to support multiple versions of multiple build tools, such as cabal-install legacy v1-style build, v2-style build, and stack.

Examples

Following shows two examples for generating test coverage report of the hpc-codecov package itself, one with cabal-install Nix-style local build commands, and another with stack.

With cabal-install

First, run the tests with coverage option to generate .tix and mix files:

$ cabal --version
cabal-install version 3.0.0.0
compiled using version 3.0.0.0 of the Cabal library
$ cabal v2-configure --enable-test --enable-coverage
$ cabal v2-test

Then generate a Codecov JSON coverage data from the .tix and .mix files:

$ proj=hpc-codecov-0.1.0.0
$ tix=$(find ./dist-newstyle -name $proj.tix)
$ mix=$(find ./dist-newstyle -name vanilla -print -quit)/mix/$proj
$ hpc-codecov --mix=$mix --exclude=Paths_hpc_codecov --out=codecov.json $tix

The --out option specifies the output file to write the JSON report. Observing the contents of codecov.json with jq:

$ jq . codecov.json | head -10
{
  "coverage": {
    "src/Trace/Hpc/Codecov/Error.hs": {
      "27": 1,
      "30": 1,
      "31": 1,
      "32": 1,
      "33": 1,
      "34": 1,
      "51": 0,

Send the resulting JSON report file to Codecov with the bash uploader. The file name codecov.json is listed in the uploader script as one of the file name patterns to upload, no need to specify the report filename explicitly:

$ bash <(curl -s https://codecov.io/bash)

According to the Codecov FAQ, the uploader should work from Travis, CircleCI, and AppVeyor for public projects without Codecov token.

With stack

Build the package and run the tests with coverage option:

$ stack --numeric-version
2.3.3
$ stack build --test --coverage

As done in cabal-install example, specify the path of .tix and .mix files. Using path sub-command to get the local hpc root directory and dist directory:

$ hpcroot=$(stack path --local-hpc-root)
$ tix=$(find $hpcroot -name 'test-main.tix')
$ mix=$(stack path --dist-dir)/hpc
$ hpc-codecov --mix=$mix --exclude=Paths_hpc_codecov -o codecov.json $tix

Then send the resulting report file:

$ bash <(curl -s https://codecov.io/bash)

References