Skip to content

Commit

Permalink
Add coveralls
Browse files Browse the repository at this point in the history
  • Loading branch information
lpgauth committed Feb 9, 2016
1 parent 5686bc2 commit 6620dec
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*.beam
doc/README.md
erl_crash.dump
fprofx.*
_build
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ notifications:
otp_release:
- 18.0
- 17.5
script: "make test"
script: "make travis"
sudo: false
26 changes: 16 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,47 +1,53 @@
CACHEGRIND=qcachegrind
ELVIS=./bin/elvis
REBAR=./bin/rebar3
REBAR3=./bin/rebar3

all: compile

clean:
@echo "Running rebar3 clean..."
@$(REBAR) clean -a
@$(REBAR3) clean -a

compile:
@echo "Running rebar3 compile..."
@$(REBAR) as build compile
@$(REBAR3) as compile compile

coveralls:
@echo "Running rebar3 coveralls send..."
@$(REBAR3) as test coveralls send

dialyzer:
@echo "Running rebar3 dialyze..."
@$(REBAR) dialyzer
@$(REBAR3) dialyzer

edoc:
@echo "Running rebar3 edoc..."
@$(REBAR) edoc
@$(REBAR3) as edoc edoc

elvis:
@echo "Running elvis rock..."
@$(ELVIS) rock

eunit:
@echo "Running rebar3 eunit..."
@$(REBAR) do eunit -cv, cover -v
@$(REBAR3) do eunit -cv, cover -v

profile:
@echo "Profiling..."
@$(REBAR) as test compile
@$(REBAR3) as test compile
@erl -noshell \
-pa _build/test/lib/*/ebin \
-eval 'statsderl_profile:fprofx()' \
-eval 'init:stop()'
@_build/test/lib/fprofx/erlgrindx -p fprofx.analysis
@$(CACHEGRIND) fprofx.cgrind

test: compile dialyzer elvis eunit xref
test: elvis xref eunit dialyzer

travis: test coveralls

xref:
@echo "Running rebar3 xref..."
@$(REBAR) xref
@$(REBAR3) xref

.PHONY: clean compile dialyzer edoc elvis eunit profile xref
.PHONY: clean compile coveralls dialyzer edoc elvis eunit profile xref
19 changes: 15 additions & 4 deletions rebar.config
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
{cover_export_enabled, true}.
{coveralls_coverdata, "_build/test/cover/eunit.coverdata"}.
{coveralls_service_name, "travis-ci"}.

{edoc_opts, [
{app_default, "http://www.erlang.org/doc/man"},
{doclet, edown_doclet},
Expand All @@ -13,7 +17,7 @@
]}.

{profiles, [
{build, [
{compile, [
{erl_opts, [
warnings_as_errors,
warn_export_all,
Expand All @@ -28,13 +32,20 @@
]},
{docs, [
{deps, [
{edown, {git, "https://github.com/uwiger/edown.git", {tag, "0.7"}}}
{edown,
{git, "https://github.com/uwiger/edown.git", {tag, "0.7"}}}
]}
]},
{test, [
{deps, [
{meck, {git, "https://github.com/eproxus/meck.git", {tag, "0.8.3"}}},
{fprofx, {git, "https://github.com/ransomr/fprofx.git", {branch, "master"}}}
{meck,
{git, "https://github.com/eproxus/meck.git", {tag, "0.8.3"}}},
{fprofx,
{git, "https://github.com/ransomr/fprofx.git", {branch, "master"}}}
]},
{plugins, [
{coveralls,
{git, "https://github.com/markusn/coveralls-erl", {branch, "master"}}}
]},
{src_dirs, ["src", "test"]}
]}
Expand Down
7 changes: 7 additions & 0 deletions rebar.config.script
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
case os:getenv("TRAVIS") of
"true" ->
JobId = os:getenv("TRAVIS_JOB_ID"),
lists:keystore(coveralls_service_job_id, 1, CONFIG, {coveralls_service_job_id, JobId});
_ ->
CONFIG
end.

0 comments on commit 6620dec

Please sign in to comment.