From 394f128f3c732fc0581151b9149832fb97275228 Mon Sep 17 00:00:00 2001 From: Albert Schimpf Date: Sat, 15 Feb 2020 16:13:34 +0100 Subject: [PATCH] Added coverage support --- .travis.yml | 2 ++ Makefile | 3 +++ README.md | 3 ++- rebar.config | 6 ++++++ rebar.config.script | 6 ++++++ 5 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 rebar.config.script diff --git a/.travis.yml b/.travis.yml index 2e8b42007..566eb50d3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,8 @@ install: - ./rebar3 update script: - make test + - make coverage + - ./rebar3 as test coveralls send - make xref - make dialyzer sudo: required diff --git a/Makefile b/Makefile index 7db1cca70..2574b3d0c 100644 --- a/Makefile +++ b/Makefile @@ -36,6 +36,9 @@ pulse: test: compile ${REBAR} eunit +coverage: compile + ${REBAR} cover --verbose + docs: ${REBAR} doc diff --git a/README.md b/README.md index 893e7e27f..b3150235c 100644 --- a/README.md +++ b/README.md @@ -9,9 +9,10 @@ Build upon the essence of Riak KV's core with an up-to-date, modular and extensi ![Language](https://img.shields.io/badge/language-erlang-blue.svg) ![Release](https://img.shields.io/badge/release-R21+-9cf.svg) ![Build](https://img.shields.io/badge/build-rebar3%203.13.0-brightgreen.svg) -[![Hex pm](https://img.shields.io/hexpm/v/riak_core_lite.svg?style=flat)](https://hex.pm/packages/riak_core_lite) +[![Hex pm](https://img.shields.io/hexpm/v/riak_core_lite.svg)](https://hex.pm/packages/riak_core_lite) [![Build Status](https://api.travis-ci.org/riak-core-lite/riak_core_lite.svg?branch=master)](https://api.travis-ci.org/riak-core-lite/riak_core_lite.svg?branch=master) +[![Coverage Status](https://coveralls.io/repos/github/riak-core-lite/riak_core_lite/badge.svg?branch=master)](https://coveralls.io/github/riak-core-lite/riak_core_lite?branch=master) To get started with riak_core_lite you can follow Mariano Guerra's tutorials. diff --git a/rebar.config b/rebar.config index 90a0cf8e7..b3d52f02d 100644 --- a/rebar.config +++ b/rebar.config @@ -16,6 +16,7 @@ {profiles, [ {test, [ {erl_opts, [nowarn_export_all]}, + {plugins, [{coveralls, {git, "https://github.com/markusn/coveralls-erl", {branch, "master"}}}]}, {deps, [ {mustache, ".*", {git, "https://github.com/mojombo/mustache.erl.git", {tag, "v0.1.1"}}}, @@ -31,3 +32,8 @@ ]} ]} ]}. + +{cover_enabled, true}. +{cover_export_enabled, true}. +{coveralls_coverdata, "_build/test/cover/eunit.coverdata"}. +{coveralls_service_name, "travis-ci"}. diff --git a/rebar.config.script b/rebar.config.script new file mode 100644 index 000000000..6c1419104 --- /dev/null +++ b/rebar.config.script @@ -0,0 +1,6 @@ +case os:getenv("TRAVIS") of + "true" -> + lists:keystore(coveralls_service_job_id, 1, CONFIG, {coveralls_service_job_id, os:getenv("TRAVIS_JOB_ID")}); + _ -> + CONFIG +end. \ No newline at end of file