-
Notifications
You must be signed in to change notification settings - Fork 173
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #122 from prasek/ci
ci enhancements
- Loading branch information
Showing
10 changed files
with
179 additions
and
106 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 |
---|---|---|
@@ -1 +1,2 @@ | ||
internal/testprotos/protoc | ||
coverage.out |
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
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,88 @@ | ||
# TODO: run golint, errcheck, staticcheck, unused | ||
.PHONY: default | ||
default: deps checkgofmt vet predeclared test | ||
|
||
.PHONY: ci | ||
ci: deps checkgofmt vet predeclared testcover | ||
|
||
.PHONY: deps | ||
deps: | ||
go get -d -v -t ./... | ||
|
||
.PHONY: updatedeps | ||
updatedeps: | ||
go get -d -v -t -u -f ./... | ||
|
||
.PHONY: install | ||
install: | ||
go install ./... | ||
|
||
.PHONY: checkgofmt | ||
checkgofmt: | ||
@if [ -n "$$(go version | awk '{ print $$3 }' | grep -v devel)" ]; then \ | ||
gofmt -s -l . ; \ | ||
if [ -n "$$(gofmt -s -l .)" ]; then \ | ||
echo "Run gofmt on the above files!"; \ | ||
exit 1; \ | ||
fi; \ | ||
fi | ||
|
||
# workaround https://github.com/golang/protobuf/issues/214 until in master | ||
.PHONY: vet | ||
vet: | ||
@echo go vet ./... --ignore internal/testprotos | ||
@for dir in $$(go list ./... | grep -v 'internal/testprotos'); do \ | ||
go vet $$dir ; \ | ||
done | ||
|
||
.PHONY: staticcheck | ||
staticcheck: | ||
@go get honnef.co/go/tools/cmd/staticcheck | ||
staticcheck ./... | ||
|
||
.PHONY: unused | ||
unused: | ||
@go get honnef.co/go/tools/cmd/unused | ||
unused ./... | ||
|
||
.PHONY: ineffassign | ||
ineffassign: | ||
@go get github.com/gordonklaus/ineffassign | ||
ineffassign . | ||
|
||
.PHONY: predeclared | ||
predeclared: | ||
@go get github.com/nishanths/predeclared | ||
predeclared . | ||
|
||
# Intentionally omitted from CI, but target here for ad-hoc reports. | ||
.PHONY: golint | ||
golint: | ||
@go get github.com/golang/lint/golint | ||
golint -min_confidence 0.9 -set_exit_status ./... | ||
|
||
# Intentionally omitted from CI, but target here for ad-hoc reports. | ||
.PHONY: errchack | ||
errcheck: | ||
@go get github.com/kisielk/errcheck | ||
errcheck ./... | ||
|
||
.PHONY: test | ||
test: | ||
go test -cover -race ./... | ||
|
||
.PHONY: generate | ||
generate: | ||
go generate github.com/jhump/protoreflect/internal/testprotos/ | ||
|
||
.PHONY: testcover | ||
testcover: | ||
@echo go test -covermode=atomic ./... | ||
@echo "mode: atomic" > coverage.out | ||
@for dir in $$(go list ./...); do \ | ||
go test -race -coverprofile profile.out -covermode=atomic $$dir ; \ | ||
if [ -f profile.out ]; then \ | ||
tail -n +2 profile.out >> coverage.out && rm profile.out ; \ | ||
fi \ | ||
done | ||
|
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
Oops, something went wrong.