-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathMakefile
More file actions
114 lines (94 loc) · 2.45 KB
/
Makefile
File metadata and controls
114 lines (94 loc) · 2.45 KB
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
107
108
109
110
111
112
113
114
TARGET ?= ...
TEST_FILTER ?= .
ifeq ($(TEST_FILTER),.)
TEST_INTEGRATION_FILTER=TestIntegration
else
TEST_INTEGRATION_FILTER=$(TEST_FILTER)
endif
SRCS=$(shell find . -name '*.go' -type f | grep -v -e ./protos -e /mocks -e '^./config/config.go')
.EXPORT_ALL_VARIABLES:
GO111MODULE ?= on
ifeq ($(CI),)
define docker_compose_up
docker-compose -f docker-compose-testing.yml up -d --force-recreate
sleep 20
endef
define docker_compose_down
docker-compose -f docker-compose-testing.yml down
endef
else
define docker_compose_up
endef
define docker_compose_down
endef
endif
.PHONY: build
build: codegen fmt build-go
@echo "--- build"
.PHONY: bootstrap
bootstrap:
@echo "--- bootstrap"
scripts/bootstrap.sh
.PHONY: bin
bin:
@echo "--- bin"
mkdir -p bin
go build -o bin ./$(TARGET)
.PHONY: build-go
build-go:
@echo "--- build-go"
mkdir -p bin
go build -o bin ./$(TARGET)
.PHONY: test
test: fmt lint
@echo "--- test"
TEST_TYPE=unit go test ./$(TARGET) -run=$(TEST_FILTER)
.PHONY: lint
lint:
@echo "--- lint"
go vet -printfuncs=wrapf,statusf,warnf,infof,debugf,failf,equalf,containsf,fprintf,sprintf ./...
errcheck -ignoretests -ignoregenerated -ignore '.*[rR]ead|[wW]rite|[cC]lose|[dD]ecode|[aA]ctivate|[lL]isten|[rR]emove|[cC]hmod|[mM]arshal|[tT]oken|[rR]egister|[sS]ubscribe' ./internal/server/rpc ./...
ineffassign ./...
.PHONY: integration
integration:
@echo "--- integration"
$(call docker_compose_up)
TEST_TYPE=integration go test ./$(TARGET) -v -p=1 -parallel=1 -timeout=10m -failfast -run=$(TEST_INTEGRATION_FILTER)
$(call docker_compose_down)
.PHONY: functional
functional:
@echo "--- functional"
$(call docker_compose_up)
TEST_TYPE=functional go test ./$(TARGET) -v -p=1 -parallel=1 -timeout=45m -failfast -run=$(TEST_INTEGRATION_FILTER)
$(call docker_compose_down)
.PHONY: codegen
codegen: tag
@echo "--- codegen"
./scripts/mockgen.sh
.PHONY: fmt
fmt:
@echo "--- fmt"
@goimports -l -w -local github.com/coinbase/chainnode $(SRCS)
.PHONY: server
server:
go run ./cmd/server
.PHONY: worker
worker:
go run ./cmd/worker
.PHONY: cron
cron:
go run ./cmd/cron
.PHONY: localstack
localstack:
docker-compose -f docker-compose-local.yml down && docker-compose -f docker-compose-local.yml up
.PHONY: tag
tag:
go run internal/tag_generator/generator.go
make fmt
.PHONY: docker-build
docker-build:
@echo "--- docker-build"
docker build -t coinbase/chainnode .
.PHONY: docker-run
docker-run:
docker run --rm --network host --name chainnode coinbase/chainnode