Skip to content

Commit

Permalink
Added test-coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
dpaz authored and smola committed Jun 28, 2017
1 parent 7e827e4 commit ded3e2c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ install:
- go get -v -t ./...

script:
- make test
- make test-coverage

after_success:
- bash <(curl -s https://codecov.io/bash)
17 changes: 17 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
COVERAGE_REPORT := coverage.txt
COVERAGE_PROFILE := profile.out
COVERAGE_MODE := atomic

LINGUIST_PATH = .linguist

$(LINGUIST_PATH):
Expand All @@ -6,6 +10,19 @@ $(LINGUIST_PATH):
test: $(LINGUIST_PATH)
go test -v ./...

test-coverage: $(LINGUIST_PATH)
@echo "mode: $(COVERAGE_MODE)" > $(COVERAGE_REPORT); \
for dir in `find . -name "*.go" | grep -o '.*/' | sort -u | grep -v './fixtures/' | grep -v './.linguist/'`; do \
go test $$dir -coverprofile=$(COVERAGE_PROFILE) -covermode=$(COVERAGE_MODE); \
if [ $$? != 0 ]; then \
exit 2; \
fi; \
if [ -f $(COVERAGE_PROFILE) ]; then \
tail -n +2 $(COVERAGE_PROFILE) >> $(COVERAGE_REPORT); \
rm $(COVERAGE_PROFILE); \
fi; \
done;

code-generate: $(LINGUIST_PATH)
mkdir -p data
go run internal/code-generator/main.go
Expand Down

0 comments on commit ded3e2c

Please sign in to comment.