-
Notifications
You must be signed in to change notification settings - Fork 12
/
Makefile
66 lines (52 loc) · 1.93 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
GO ?= go
GOFMT ?= gofmt
GO_FILES ?= $$(find . -name '*.go' | grep -v vendor)
GOLANG_CI_LINT ?= golangci-lint
GO_IMPORTS ?= goimports
GO_FUMPT ?= gofumpt
GO_GCI ?= gci
GO_IMPORTS_LOCAL ?= github.com/ZupIT/horusec-devkit
HORUSEC ?= horusec
COMPOSE_FILE_NAME ?= docker-compose.yaml
DOCKER_COMPOSE ?= docker-compose
ADDLICENSE ?= addlicense
lint:
$(GO) install github.com/golangci/golangci-lint/cmd/[email protected]
$(GOLANG_CI_LINT) run -v --timeout=5m -c .golangci.yml ./...
coverage:
chmod +x scripts/coverage.sh
scripts/coverage.sh 99.3 "."
test:
$(GO) clean -testcache && $(GO) test -v ./... -timeout=2m -parallel=1 -failfast -short
install-format-dependencies:
$(GO) install golang.org/x/tools/cmd/[email protected]
$(GO) install mvdan.cc/[email protected]
$(GO) install github.com/daixiang0/[email protected]
format: install-format-dependencies
$(GOFMT) -s -l -w $(GO_FILES)
$(GO_IMPORTS) -w -local $(GO_IMPORTS_LOCAL) $(GO_FILES)
$(GO_FUMPT) -l -w $(GO_FILES)
$(GO_GCI) -w -local $(GO_IMPORTS_LOCAL) $(GO_FILES)
security:
ifeq (, $(shell which $(HORUSEC)))
curl -fsSL https://raw.githubusercontent.com/ZupIT/horusec/master/deployments/scripts/install.sh | bash -s latest
$(HORUSEC) start -p="./" -e="true"
else
$(HORUSEC) start -p="./" -e="true"
endif
migrate-up:
chmod +x ./scripts/migration-run.sh
./scripts/migration-run.sh up
migrate-drop:
chmod +x ./scripts/migration-run.sh
./scripts/migration-run.sh drop -f
update-auth-grpc:
protoc --go_out=. --go-grpc_out=. ./pkg/services/grpc/auth/proto/auth.proto
license:
$(GO) install github.com/google/[email protected]
@$(ADDLICENSE) -check -f ./copyright.txt $(shell find -regex '.*\.\(go\|js\|ts\|yml\|yaml\|sh\|dockerfile\)')
license-fix:
$(GO) install github.com/google/[email protected]
@$(ADDLICENSE) -f ./copyright.txt $(shell find -regex '.*\.\(go\|js\|ts\|yml\|yaml\|sh\|dockerfile\)')
pipeline: format lint test coverage security
migrate: migrate-drop migrate-up