-
Notifications
You must be signed in to change notification settings - Fork 147
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add travis/codecov for pre-commit validation (#13)
The coverage.sh is from codecov. Once 1.10 lands, we'll no longer need it!
- Loading branch information
Showing
3 changed files
with
80 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
sudo: false | ||
language: go | ||
go_import_path: go.uber.org/goleak | ||
|
||
go: | ||
# TODO(prashant): Enable once we have fixed Linux issues with old versions. | ||
#- 1.6 | ||
#- 1.7 | ||
#- 1.8 | ||
- 1.9.2 | ||
env: | ||
- TEST=yes | ||
|
||
matrix: | ||
include: | ||
- go: 1.9.2 | ||
env: COVERAGE=yes LINT=yes | ||
|
||
cache: | ||
directories: | ||
- vendor | ||
|
||
install: | ||
- make install_deps | ||
|
||
script: | ||
- test -z "$TEST" || make test | ||
- test -z "$COVERAGE" || scripts/coverage.sh | ||
- test -z "$LINT" || make install_lint lint | ||
|
||
after_success: | ||
- test -z "$COVERAGE" || bash <(curl -s https://codecov.io/bash) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
PACKAGES := $(shell glide nv) | ||
# Many Go tools take file globs or directories as arguments instead of packages. | ||
PACKAGE_FILES ?= *.go $(shell find internal -type f -iname '*.go') | ||
|
||
.PHONY: build | ||
build: | ||
go build -i $(PACKAGES) | ||
|
||
|
||
.PHONY: install_deps | ||
install_deps: | ||
glide --version || go get github.com/Masterminds/glide | ||
glide install | ||
|
||
|
||
.PHONY: test | ||
test: | ||
go test -v -race $(PACKAGES) | ||
|
||
.PHONY: install_lint | ||
install_lint: | ||
go get github.com/golang/lint/golint | ||
|
||
.PHONY: lint | ||
lint: | ||
@rm -rf lint.log | ||
@echo "Checking formatting..." | ||
@gofmt -d -s $(PACKAGE_FILES) 2>&1 | tee lint.log | ||
@echo "Checking vet..." | ||
@$(foreach dir,$(PACKAGE_FILES),go tool vet $(dir) 2>&1 | tee -a lint.log;) | ||
@echo "Checking lint..." | ||
@$(foreach dir,$(PACKAGES),golint $(dir) 2>&1 | tee -a lint.log;) | ||
@echo "Checking for unresolved FIXMEs..." | ||
@git grep -i fixme | grep -v -e '^vendor/' -e '^Makefile' | tee -a lint.log | ||
@[ ! -s lint.log ] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
echo "" > coverage.txt | ||
|
||
for d in $(go list ./...); do | ||
go test -race -coverprofile=profile.out -covermode=atomic $d | ||
if [ -f profile.out ]; then | ||
cat profile.out >> coverage.txt | ||
rm profile.out | ||
fi | ||
done |