forked from TykTechnologies/tyk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
107 lines (81 loc) · 2.2 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
SHELL := /bin/bash
GOCMD=go
GOTEST=$(GOCMD) test
GOCLEAN=$(GOCMD) clean
GOBUILD=$(GOCMD) build
GOINSTALL=$(GOCMD) install
BINARY_NAME=tyk
BINARY_LINUX=tyk
TAGS=coprocess grpc goplugin
CONF=tyk.conf
TEST_REGEX=.
TEST_COUNT=1
BENCH_REGEX=.
BENCH_RUN=NONE
.PHONY: test
test:
$(GOTEST) -run=$(TEST_REGEX) -count=$(TEST_COUNT) ./...
# lint runs all local linters that must pass before pushing
.PHONY: lint lint-install lint-fast
lint: lint-install
goimports -local github.com/TykTechnologies,github.com/TykTechnologies/tyk/internal -w .
gofmt -w .
faillint -ignore-tests -paths "$(shell grep -v '^#' .faillint | xargs echo | sed 's/ /,/g')" ./...
lint-fast:
go generate ./...
go test -count 1 -v ./cli/linter/...
go fmt ./...
go mod tidy
lint-install: lint-fast
go install golang.org/x/tools/cmd/goimports@latest
go install github.com/golangci/golangci-lint/cmd/[email protected]
go install github.com/fatih/faillint@latest
.PHONY: bench
bench:
$(GOTEST) -run=$(BENCH_RUN) -bench=$(BENCH_REGEX) ./...
.PHONY: clean
clean:
$(GOCLEAN)
rm -f $(BINARY_NAME)
.PHONY: dev
dev:
$(GOBUILD) -tags "$(TAGS)" -o $(BINARY_NAME) -v .
./$(BINARY_NAME) --conf $(CONF)
.PHONY: build
build:
$(GOBUILD) -tags "$(TAGS)" -o $(BINARY_NAME) -v .
.PHONY: build-linux
build-linux:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(GOBUILD) -tags "$(TAGS)" -o $(BINARY_LINUX) -v .
.PHONY: install
install:
$(GOINSTALL) -tags "$(TAGS)"
.PHONY: db-start
db-start: redis-start mongo-start
.PHONY: db-stop
db-stop: redis-stop mongo-stop
# Docker start redis
.PHONY: redis-start
redis-start:
docker run -itd --rm --name redis -p 127.0.0.1:6379:6379 redis:4.0-alpine redis-server --appendonly yes
.PHONY: redis-stop
redis-stop:
docker stop redis
.PHONY: redis-cli
redis-cli:
docker exec -it redis redis-cli
# Docker start mongo
.PHONY: mongo-start
mongo-start:
docker run -itd --rm --name mongo -p 127.0.0.1:27017:27017 mongo:3.4-jessie
.PHONY: mongo-stop
mongo-stop:
docker stop mongo
.PHONY: mongo-shell
mongo-shell:
docker exec -it mongo mongo
.PHONY: docker docker-std
docker:
docker build --no-cache --rm -t internal/tyk-gateway --squash .
docker-std: build
docker build --no-cache -t internal/tyk-gateway:std -f ci/Dockerfile.std .