-
Notifications
You must be signed in to change notification settings - Fork 374
/
Makefile
65 lines (53 loc) · 2.29 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
.PHONY: help
help:
@echo "Available make commands:"
@cat Makefile | grep '^[a-z][^:]*:' | cut -d: -f1 | sort | sed 's/^/ /'
# command to run dependency utilities, like goimports.
rundep=go run -modfile ../misc/devdeps/go.mod
########################################
# Environment variables
# You can overwrite any of the following by passing a different value on the
# command line, ie. `CGO_ENABLED=1 make test`.
# disable cgo by default. cgo requires some additional dependencies in some
# cases, and is not strictly required by any tm2 code.
CGO_ENABLED ?= 0
export CGO_ENABLED
# flags for `make fmt`. -w will write the result to the destination files.
GOFMT_FLAGS ?= -w
# flags for `make imports`.
GOIMPORTS_FLAGS ?= $(GOFMT_FLAGS)
# test suite flags.
GOTEST_FLAGS ?= -v -p 1 -timeout=30m -tags='ledger_suite'
########################################
# Dev tools
.PHONY: build
_build.tools: _build.aminoscan _build.goscan _build.logjack _build.iaviewer
_build.aminoscan:; go build -o build/aminoscan ./pkg/amino/cmd/aminoscan
_build.goscan:; go build -o build/goscan ./pkg/amino/cmd/goscan
_build.logjack:; go build -o build/logjack ./pkg/autofile/cmd
_build.iaviewer:; go build -o build/iaviewer ./pkg/iavl/cmd/iaviewer
.PHONY: clean
clean:
rm -rf ./build/
.PHONY: fmt
fmt:
$(rundep) mvdan.cc/gofumpt $(GOFMT_FLAGS) .
.PHONY: imports
imports:
$(rundep) golang.org/x/tools/cmd/goimports $(GOIMPORTS_FLAGS) .
.PHONY: lint
lint:
$(rundep) github.com/golangci/golangci-lint/cmd/golangci-lint run --config ../.github/golangci.yml ./...
########################################
# Test suite
.PHONY: test
test: _test.pkg.amino _test.pkg.bft _test.pkg.db _test.pkg.others _test.flappy
_test.flappy:
# flappy tests should work "sometimes" (at least once).
# TODO: support coverage for flappy tests.
TEST_STABILITY=flappy $(rundep) moul.io/testman test -test.v -timeout=20m -retry=10 -run ^TestFlappy \
./pkg/bft/consensus ./pkg/bft/blockchain ./pkg/bft/mempool ./pkg/p2p ./pkg/bft/privval
_test.pkg.others:; go test $(GOTEST_FLAGS) `go list ./pkg/... | grep -Ev 'pkg/(amino|bft|db|iavl/benchmarks)(/|$$)'`
_test.pkg.amino:; go test $(GOTEST_FLAGS) ./pkg/amino/...
_test.pkg.bft:; go test $(GOTEST_FLAGS) ./pkg/bft/...
_test.pkg.db:; go test $(GOTEST_FLAGS) ./pkg/db/... ./pkg/iavl/benchmarks/...