Skip to content
This repository was archived by the owner on Apr 9, 2020. It is now read-only.

Commit aebbd0d

Browse files
committed
🔧 Added Makefile
1 parent 6b9a7b7 commit aebbd0d

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

Makefile

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
PROJECT_NAMESPACE := $(CI_PROJECT_NAMESPACE)
2+
PROJECT_NAME := $(CI_PROJECT_NAME)
3+
PROJECT_PATH := "$(PROJECT_NAMESPACE)/$(PROJECT_NAME)"
4+
PACKAGE_NAME := "gitlab.com/$(PROJECT_PATH)"
5+
PACKAGE_PATH := "$(GOPATH)/src/$(PACKAGE_NAME)"
6+
PACKAGE_LIST := $(shell go list $(PACKAGE_NAME)/... | grep -v /vendor/)
7+
GO_FILES := $(shell find . -name '*.go' | grep -v /vendor/ | grep -v _test.go)
8+
9+
.PHONY: all lint test rase coverage dep
10+
11+
all: dep test race lint
12+
13+
lint: ## Lint the files
14+
@golangci-lint run ./...
15+
16+
test: ## Run unittests
17+
@go test -short $(PACKAGE_NAME)/...
18+
19+
race: dep ## Run data race detector
20+
@go test -race -short ${PACKAGE_LIST}
21+
22+
coverage: ## Generate global code coverage report
23+
@go test -cover -v -coverpkg=$(PACKAGE_NAME)/... ${PACKAGE_LIST}
24+
25+
dep: ## Get the dependencies
26+
@go get -v -d -t $(PACKAGE_NAME)/...
27+
28+
help: ## Display this help screen
29+
@grep -h -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

0 commit comments

Comments
 (0)