Skip to content

Commit 2330faa

Browse files
committed
Add rule for sending coverage reports to coveralls
1 parent 669d53c commit 2330faa

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
2+
# VARIABLES #
3+
4+
# Define the [Coveralls][1] command (see also [2][2]).
5+
#
6+
# [1]: https://coveralls.io/
7+
# [2]: https://github.com/nickmerwin/node-coveralls
8+
COVERALLS ?= npm install coveralls && $(CAT) $(LCOV_INFO) | $(NODE_MODULES)/coveralls/bin/coveralls.js
9+
10+
ifndef COVERALLS_SERVICE_NAME
11+
COVERALLS_SERVICE_NAME := $(CI_SERVICE)
12+
endif
13+
14+
ifeq ($(CI_SERVICE), travis)
15+
COVERALLS_SERVICE_JOB_ID := $(TRAVIS_JOB_ID)
16+
else
17+
ifeq ($(CI_SERVICE), appveyor)
18+
COVERALLS_SERVICE_JOB_ID := $(APPVEYOR_JOB_ID)
19+
else
20+
ifeq ($(CI_SERVICE), circle)
21+
COVERALLS_SERVICE_JOB_ID := $(CIRCLE_BUILD_NUM)
22+
else
23+
COVERALLS_SERVICE_JOB_ID ?=
24+
endif
25+
endif
26+
endif
27+
28+
# Define a list of environment variables when invoking the Coveralls command:
29+
COVERALLS_ENV_VARS ?= COVERALLS_SERVICE_NAME=$(COVERALLS_SERVICE_NAME) COVERALLS_SERVICE_JOB_ID=$(COVERALLS_SERVICE_JOB_ID)
30+
31+
ifdef COVERALLS_REPO_TOKEN
32+
COVERALLS_ENV_VARS := COVERALLS_REPO_TOKEN=$(COVERALLS_REPO_TOKEN) $(COVERALLS_ENV_VARS)
33+
endif
34+
35+
36+
# TARGETS #
37+
38+
#/
39+
# Sends coverage statistics to [Coveralls][1].
40+
#
41+
# [1]: https://coveralls.io/
42+
#
43+
# @param {string} LCOV_INFO - path of the `lcov.info` file which will be sent to the coverage service
44+
# @param {string} [CI_SERVICE] - continuous integration (CI) service from which the coverage report originates
45+
# @param {string} [COVERALLS_REPO_TOKEN] - the secret repository token from Coveralls
46+
#
47+
# @example
48+
# make coverage-coveralls
49+
#/
50+
coverage-coveralls:
51+
$(QUIET) $(COVERALLS_ENV_VARS) $(COVERALLS) || echo 'Failed to upload coverage reports to Coveralls.'
52+
53+
.PHONY: coverage-coveralls

0 commit comments

Comments
 (0)