Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(WIP) Travis: Add coverage check #108

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .travis/coverage_interpolate
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env python3

import sys

for line in sys.stdin:
try:
filename, no_filename = line.split(':')
start_and_end = no_filename.split(' ')[0]
start, end = start_and_end.split(',')
start_line = int(start.split('.')[0])
end_line = int(end.split('.')[0])
except ValueError:
print(line)
continue
for line_num in range(start_line, end_line+1):
print(filename + ':' + str(line_num) + ': Uncovered')
14 changes: 12 additions & 2 deletions .travis/script
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,26 @@

# Upstream q is broken, and this also causes dns-prop279 to be broken.
#travis_retry go get github.com/tcnksm/ghr github.com/mitchellh/gox gopkg.in/alecthomas/gometalinter.v2 github.com/miekg/exdns/q github.com/namecoin/dns-prop279
travis_retry go get github.com/tcnksm/ghr github.com/mitchellh/gox gopkg.in/alecthomas/gometalinter.v2
travis_retry go get github.com/tcnksm/ghr github.com/mitchellh/gox gopkg.in/alecthomas/gometalinter.v2 github.com/bradleyfalzon/revgrep/...

go test -v ./...
go test -v -coverprofile coverage.out ./...
RESULT=$?

echo Done tests with exit code $RESULT
if [ "$RESULT" != "0" ]; then
return $RESULT
fi

echo "Uncovered lines:"
echo ""
grep -v -e " 1$" coverage.out | sed "s_github.com/namecoin/ncdns/__"
echo ""

echo "New/changed uncovered lines:"
echo ""
grep -v -e " 1$" coverage.out | sed "s_github.com/namecoin/ncdns/__" | ./.travis/coverage_interpolate | revgrep "${TRAVIS_BRANCH}"
echo ""

# Static analysis

gometalinter.v2 --install
Expand Down