build: just use go {test,vet} ./... for targets vet, test and generate

This commit is contained in:
Christian Schwarz 2018-12-11 22:00:03 +01:00
parent c1aab0bee9
commit 38b0bd76f5
2 changed files with 3 additions and 54 deletions

View File

@ -30,7 +30,6 @@ matrix:
- make - make
- make vet - make vet
- make test - make test
- go test ./...
- make artifacts/zrepl-freebsd-amd64 - make artifacts/zrepl-freebsd-amd64
- make artifacts/zrepl-linux-amd64 - make artifacts/zrepl-linux-amd64
- make artifacts/zrepl-darwin-amd64 - make artifacts/zrepl-darwin-amd64
@ -49,7 +48,6 @@ matrix:
- make - make
- make vet - make vet
- make test - make test
- go test ./...
- make artifacts/zrepl-freebsd-amd64 - make artifacts/zrepl-freebsd-amd64
- make artifacts/zrepl-linux-amd64 - make artifacts/zrepl-linux-amd64
- make artifacts/zrepl-darwin-amd64 - make artifacts/zrepl-darwin-amd64

View File

@ -1,38 +1,6 @@
.PHONY: generate build test vet cover release docs docs-clean clean vendordeps .PHONY: generate build test vet cover release docs docs-clean clean vendordeps
.DEFAULT_GOAL := build .DEFAULT_GOAL := build
ROOT := github.com/zrepl/zrepl
SUBPKGS += client
SUBPKGS += config
SUBPKGS += daemon
SUBPKGS += daemon/filters
SUBPKGS += daemon/job
SUBPKGS += daemon/logging
SUBPKGS += daemon/nethelpers
SUBPKGS += daemon/pruner
SUBPKGS += daemon/snapper
SUBPKGS += daemon/streamrpcconfig
SUBPKGS += daemon/transport
SUBPKGS += daemon/transport/connecter
SUBPKGS += daemon/transport/serve
SUBPKGS += endpoint
SUBPKGS += logger
SUBPKGS += pruning
SUBPKGS += pruning/retentiongrid
SUBPKGS += replication
SUBPKGS += replication/fsrep
SUBPKGS += replication/pdu
SUBPKGS += replication/internal/diff
SUBPKGS += tlsconf
SUBPKGS += util
SUBPKGS += util/socketpair
SUBPKGS += util/watchdog
SUBPKGS += util/envconst
SUBPKGS += version
SUBPKGS += zfs
_TESTPKGS := $(ROOT) $(foreach p,$(SUBPKGS),$(ROOT)/$(p))
ARTIFACTDIR := artifacts ARTIFACTDIR := artifacts
ifdef ZREPL_VERSION ifdef ZREPL_VERSION
@ -60,34 +28,17 @@ vendordeps:
generate: #not part of the build, must do that manually generate: #not part of the build, must do that manually
protoc -I=replication/pdu --go_out=replication/pdu replication/pdu/pdu.proto protoc -I=replication/pdu --go_out=replication/pdu replication/pdu/pdu.proto
@for pkg in $(_TESTPKGS); do\ go generate -x ./...
go generate "$$pkg" || exit 1; \
done;
build: build:
@echo "INFO: In case of missing dependencies, run 'make vendordeps'" @echo "INFO: In case of missing dependencies, run 'make vendordeps'"
$(GO_BUILD) -o "$(ARTIFACTDIR)/zrepl" $(GO_BUILD) -o "$(ARTIFACTDIR)/zrepl"
test: test:
@for pkg in $(_TESTPKGS); do \ go test ./...
echo "Testing $$pkg"; \
go test "$$pkg" || exit 1; \
done;
vet: vet:
@for pkg in $(_TESTPKGS); do \ go vet ./...
echo "Vetting $$pkg"; \
go vet "$$pkg" || exit 1; \
done;
cover: artifacts
@for pkg in $(_TESTPKGS); do \
profile="$(ARTIFACTDIR)/cover-$$(basename $$pkg).out"; \
go test -coverprofile "$$profile" $$pkg || exit 1; \
if [ -f "$$profile" ]; then \
go tool cover -html="$$profile" -o "$${profile}.html" || exit 2; \
fi; \
done;
$(ARTIFACTDIR): $(ARTIFACTDIR):
mkdir -p "$@" mkdir -p "$@"