-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
76 lines (58 loc) · 1.82 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
66
67
68
69
70
71
72
73
74
75
76
GOLANGCI_LINT := $(shell command -v golangci-lint 2> /dev/null)
install_deps:
go mod download
go install github.com/cespare/[email protected]
go install github.com/golang/protobuf/[email protected]
go install github.com/go-swagger/go-swagger/cmd/[email protected]
start:
go run cmd/main.go
dev:
reflex --start-service -r '\.go$$' make start
# Colorful output
color_off = \033[0m
color_cyan = \033[1;36m
color_green = \033[1;32m
define log_info
@printf "$(color_cyan)$(1)$(color_off)\n"
endef
define log_success
@printf "$(color_green)$(1)$(color_off)\n"
endef
lint: revive-lint golangci-lint
revive-lint:
$(call log_info, Running revive linter)
revive -config .revive.toml ./...
$(call log_success,Linting with revive linter succeeded!)
golangci-lint:
$(call log_info, Running golangci-lint)
golangci-lint run ./...
$(call log_success,Linting with golangci-lint succeeded!)
go-mod-tidy:
$(call log_info,Check that go.mod and go.sum don't contain any unnecessary dependency)
go mod tidy -v
git diff-index --quiet HEAD
$(call log_success,Go mod check succeeded!)
test:
$(call log_info,Run tests and check race conditions)
# https://golang.org/doc/articles/race_detector.html
go test -race -v ./... -cover
$(call log_success,All tests succeeded)
test/ci: test go-mod-tidy
test/watch:
reflex --start-service -r '\.go$$' make test
test/all: test go-mod-tidy lint e2e
build:
CGO_ENABLED=0 go build cmd/main.go
ifndef CI_COMMIT_SHORT_SHA
$(call log_info,SENTRY_RELEASE not set)
else
@printf "${color_green}SENTRY_RELEASE: ${CI_COMMIT_SHORT_SHA}${color_off}\n"
@echo "SENTRY_RELEASE: ${CI_COMMIT_SHORT_SHA}" >> .env.yaml
endif
proto:
protoc --go_out=plugins=grpc:. ./api/grpc/v1/kiwi_iamapi.proto
swagger-validate:
swagger validate ./api/swagger.yml
swagger-serve:
swagger serve ./api/swagger.yml
-include ./tests/e2e/e2e.mk