GitXplorerGitXplorer
s

ocaml-travis-coveralls

public
4 stars
3 forks
2 issues

Commits

List of commits on branch master.
Unverified
138a2bf9bba18f306f1ede365f9362fcd09c64b6

Update to latest 1.3.0 bisect_ppx release (#14)

ggaborigloi committed 7 years ago
Unverified
038fca483cd8c12778cd84bdf029521eb2a1f48a

Merge pull request #12 from simonjbeaumont/4.02.3-support

ssimonjbeaumont committed 8 years ago
Unverified
89a0bc77661e1a3fd71a30534e56fa1ff760ff0e

test: Update grep for bisect_ppx.1.2.0 summary output

ssimonjbeaumont committed 8 years ago
Unverified
194ef3b65946975940ccc66930e0aca780c4f414

coveralls: Update to bisect_ppx.1.2.0

ssimonjbeaumont committed 8 years ago
Unverified
7a834f073c53d055c622c95571eed72c9bb60b97

Merge pull request #10 from simonjbeaumont/bisect-ppx-report

ssimonjbeaumont committed 9 years ago
Unverified
03947125f658e397afae84b6edb206db8a54d4ad

coveralls: Pin to bisect_ppx.1.0.0

ssimonjbeaumont committed 9 years ago

README

The README file for this repository.

Push OCaml coverage metrics to Coveralls from Travis Build Status

Usage

Append the following install stanza of your .travis.yml:

install:
  ...
  - wget https://raw.githubusercontent.com/simonjbeaumont/ocaml-travis-coveralls/master/travis-coveralls.sh

and add the following to your the script stanza:

script: ... && bash travis-coveralls.sh

Prerequisites

  1. Your project builds with OCaml >= 4.02;
  2. Your project is enabled on Coveralls.io; and
  3. Your project is configured using Oasis.

The dependency on Oasis allows this tool to link in Bisect_ppx (the OCaml tool for collecting coverage metrics) in a predictable way.

Configuration

You can configure the commands used to build and what commands are measured by setting the following environment variables in your .tavis.yml:

  • $COV_CONF: The command used to configure your project, maybe to enable any tests that are not built by default. This defaults to a no-op;
  • $COV_BUILD: The command used to build your project. This defaults to make;
  • $COV_TEST: The command under inspection of the coverage tools. Defaults to make test.

For example, if you need to enable tests with a configure script option you can set the following:

env:
  global:
    ...
    - COV_CONF="./configure --enable-tests"

You can also exclude portions of code from coverage metric collection by adding a .coverage.excludes file to your repo. For example if you wanted to exclude the entire contents of some autogenerated files you could add the following to a .coverage.excludes:

file "lib/ffi_generated.ml" [ regexp ".*" ];
file "lib/ffi_generated_types.ml" [ regexp ".*" ];

Local usage

You can also use this script to see your coverage metrics locally. The script detects that it is not running on Travis and instead outputs the information to stdout and also generates a HTML report.

$ wget https://raw.githubusercontent.com/simonjbeaumont/ocaml-travis-coveralls/master/travis-coveralls.sh
$ bash travis-coveralls.sh
...
Ran: 27 tests in: 0.01 seconds.
OK
$TRAVIS not set; displaying results of bisect-report...
...[ snip ]...
File 'lib/request.ml':
 - 'binding' points: 77/124 (62.10%)
 - 'sequence' points: 2/2 (100.00%)
 - 'for' points: none
 - 'if/then' points: 3/6 (50.00%)
...[ snip ]...
Summary:
 - 'binding' points: 328/637 (51.49%)
 - 'sequence' points: 34/94 (36.17%)
 - 'for' points: 1/1 (100.00%)
 - 'if/then' points: 29/85 (34.12%)
 - 'try' points: 1/1 (100.00%)
 - 'while' points: none
 - 'match/function' points: 124/180 (68.89%)
 - 'class expression' points: none
 - 'class initializer' points: none
 - 'class method' points: none
 - 'class value' points: none
 - 'toplevel expression' points: 1/1 (100.00%)
 - 'lazy operator' points: 4/4 (100.00%)
 - total: 522/1003 (52.04%)

The following Makefile snippet may come in useful to provide a make coverage target that can be run locally:

travis-coveralls.sh:
	wget https://raw.githubusercontent.com/simonjbeaumont/ocaml-travis-coveralls/master/$@

coverage: travis-coveralls.sh
	bash $<

Examples

For an example of using this tool and its features, check out the following Github users' projects: