diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | Makefile.build.mk | 4 | ||||
-rw-r--r-- | Makefile.internal.mk | 4 | ||||
-rw-r--r-- | Makefile.util.mk | 28 |
4 files changed, 17 insertions, 20 deletions
@@ -11,4 +11,5 @@ shared/pages/.update # Used by the makefile /.GOPATH +/.cover /bin diff --git a/Makefile.build.mk b/Makefile.build.mk index c576e202..c147e16f 100644 --- a/Makefile.build.mk +++ b/Makefile.build.mk @@ -16,13 +16,13 @@ WITHOUT_BUILD_ID ?= all: gitlab-pages -generate-mocks: .GOPATH/.ok +generate-mocks: $Q go run github.com/golang/mock/mockgen@$(MOCKGEN_VERSION) -source=internal/interface.go -destination=internal/handlers/mock/handler_mock.go -package=mock $Q go run github.com/golang/mock/mockgen@$(MOCKGEN_VERSION) -source=internal/source/source.go -destination=internal/source/mock/source_mock.go -package=mock $Q go run github.com/golang/mock/mockgen@$(MOCKGEN_VERSION) -source=internal/source/gitlab/mock/client_stub.go -destination=internal/source/gitlab/mock/client_mock.go -package=mock $Q go run github.com/golang/mock/mockgen@$(MOCKGEN_VERSION) -source=internal/domain/resolver.go -destination=internal/domain/mock/resolver_mock.go -package=mock -build: .GOPATH/.ok +build: $Q GOBIN=$(BINDIR) go install $(if $V,-v) -ldflags="$(VERSION_FLAGS)" -tags "${GO_BUILD_TAGS}" -buildmode exe $(IMPORT_PATH) ifndef WITHOUT_BUILD_ID GO_BUILD_ID=$$( go tool buildid $(BINDIR)/gitlab-pages ) && \ diff --git a/Makefile.internal.mk b/Makefile.internal.mk index 60e151e9..6dfaa1b3 100644 --- a/Makefile.internal.mk +++ b/Makefile.internal.mk @@ -10,10 +10,6 @@ endif VERSION_FLAGS :=-X "main.VERSION=$(VERSION)" -X "main.REVISION=$(REVISION)" -export GOPATH := $(CURDIR)/.GOPATH export GOBIN := $(CURDIR)/bin Q := $(if $V,,@) - -.GOPATH/.ok: - mkdir -p .GOPATH diff --git a/Makefile.util.mk b/Makefile.util.mk index 0dee14d4..a2eea8bf 100644 --- a/Makefile.util.mk +++ b/Makefile.util.mk @@ -7,38 +7,38 @@ GOLANGCI_VERSION=v1.44.0 GOTESTSUM_VERSION=v1.7.0 COVERAGE_PACKAGES=$(shell (go list ./... | grep -v -e "test/acceptance" | tr "\n", "," | sed 's/\(.*\),/\1 /')) -lint: .GOPATH/.ok +lint: $Q go run github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_VERSION) run ./... --out-format $(OUT_FORMAT) $(LINT_FLAGS) | tee ${REPORT_FILE} -format: .GOPATH/.ok +format: $Q go run github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_VERSION) run ./... --fix --out-format $(OUT_FORMAT) $(LINT_FLAGS) | tee ${REPORT_FILE} -test: .GOPATH/.ok gitlab-pages +test: gitlab-pages rm -f tests.out go run gotest.tools/gotestsum@$(GOTESTSUM_VERSION) --junitfile junit-test-report.xml --format testname -- ./... ${ARGS} -race: .GOPATH/.ok gitlab-pages +race: gitlab-pages go run gotest.tools/gotestsum@$(GOTESTSUM_VERSION) --junitfile junit-test-report.xml --format testname -- -race $(if $V,-v) ./... ${ARGS} -acceptance: .GOPATH/.ok gitlab-pages +acceptance: gitlab-pages go run gotest.tools/gotestsum@$(GOTESTSUM_VERSION) --junitfile junit-test-report.xml --format testname -- $(if $V,-v) ./test/acceptance ${ARGS} -bench: .GOPATH/.ok gitlab-pages +bench: gitlab-pages go test -bench=. -run=^$$ ./... # The acceptance tests cannot count for coverage cover: @echo "NOTE: make cover does not exit 1 on failure, don't use it to check for tests success!" - $Q rm -f .GOPATH/cover/test.coverage - $Q mkdir -p .GOPATH/cover - $Q go test -short -cover -coverpkg=$(COVERAGE_PACKAGES) -coverprofile=.GOPATH/cover/test.coverage ./... - $Q go tool cover -html .GOPATH/cover/test.coverage -o coverage.html + $Q rm -f .cover/test.coverage + $Q mkdir -p .cover + $Q go test -short -cover -coverpkg=$(COVERAGE_PACKAGES) -coverprofile=.cover/test.coverage ./... + $Q go tool cover -html .cover/test.coverage -o coverage.html @echo "" @echo "=====> Total test coverage: <=====" @echo "" - $Q go tool cover -func .GOPATH/cover/test.coverage + $Q go tool cover -func .cover/test.coverage -deps-check: .GOPATH/.ok +deps-check: go mod tidy @if git diff --color=always --exit-code -- go.mod go.sum; then \ echo "go.mod and go.sum are ok"; \ @@ -48,7 +48,7 @@ deps-check: .GOPATH/.ok exit 1; \ fi; -mocks-check: .GOPATH/.ok generate-mocks +mocks-check: generate-mocks @if git diff --color=always --exit-code -- *_mock.go; then \ echo "mocks are ok"; \ else \ @@ -57,7 +57,7 @@ mocks-check: .GOPATH/.ok generate-mocks exit 1; \ fi; -deps-download: .GOPATH/.ok +deps-download: go mod download changelog: |