Skip to content

Commit f84fa56

Browse files
ajnavarromcuadros
authored andcommitted
travis: add codecov.io (#13)
1 parent 1dfacf9 commit f84fa56

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

.travis.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,8 @@ install:
1717

1818
script:
1919
- cd $GOPATH/src/srcd.works/go-billy.v1
20-
- go test -v ./...
20+
- go test -v ./...
21+
- make test-coverage
22+
23+
after_success:
24+
- bash <(curl -s https://codecov.io/bash)

Makefile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# General
2+
WORKDIR = $(PWD)
3+
4+
# Go parameters
5+
GOCMD = go
6+
GOTEST = $(GOCMD) test -v
7+
8+
# Coverage
9+
COVERAGE_REPORT = coverage.txt
10+
COVERAGE_PROFILE = profile.out
11+
COVERAGE_MODE = atomic
12+
13+
test-coverage:
14+
cd $(WORKDIR); \
15+
echo "" > $(COVERAGE_REPORT); \
16+
for dir in `find . -name "*.go" | grep -o '.*/' | sort | uniq`; do \
17+
$(GOTEST) $$dir -coverprofile=$(COVERAGE_PROFILE) -covermode=$(COVERAGE_MODE); \
18+
if [ $$? != 0 ]; then \
19+
exit 2; \
20+
fi; \
21+
if [ -f $(COVERAGE_PROFILE) ]; then \
22+
cat $(COVERAGE_PROFILE) >> $(COVERAGE_REPORT); \
23+
rm $(COVERAGE_PROFILE); \
24+
fi; \
25+
done; \

0 commit comments

Comments
 (0)