forked from filecoin-project/lily
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
92 lines (70 loc) · 1.92 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
PG_IMAGE?=postgres:10
REDIS_IMAGE?=redis:6
COMMIT := $(shell git rev-parse --short HEAD)
# GITVERSION is the nearest tag plus number of commits and short form of most recent commit since the tag, if any
GITVERSION=$(shell git describe --always --tag --dirty)
unexport GOFLAGS
CLEAN:=
BINS:=
GOFLAGS:=
ldflags=-X=github.com/filecoin-project/sentinel-visor/version.GitVersion=$(GITVERSION)
ifneq ($(strip $(LDFLAGS)),)
ldflags+=-extldflags=$(LDFLAGS)
endif
GOFLAGS+=-ldflags="$(ldflags)"
.PHONY: all
all: build
.PHONY: build
build: deps visor
# dummy file that marks the last time modules were updated
build/.update-modules:
git submodule update --init --recursive
touch $@
.PHONY: deps
deps: build/.update-modules
cd ./vector; ./fetch_vectors.sh
# test starts dependencies and runs all tests
.PHONY: test
test: testfull
.PHONY: dockerup
dockerup:
docker-compose up -d
.PHONY: dockerdown
dockerdown:
docker-compose down
# testfull runs all tests
.PHONY: testfull
testfull: build
docker-compose up -d
sleep 2
./visor migrate --latest
TZ= PGSSLMODE=disable go test ./... -v || echo ""
docker-compose down
# testshort runs tests that don't require external dependencies such as postgres or redis
.PHONY: testshort
testshort:
go test -short ./... -v
# lint runs linting against code base
.PHONY: lint
lint:
go run github.com/golangci/golangci-lint/cmd/golangci-lint run
.PHONY: visor
visor:
rm -f visor
go build $(GOFLAGS) -o visor -mod=readonly .
BINS+=visor
.PHONY: docker-image
docker-image:
docker build -t "filecoin/sentinel-visor" .
docker tag "filecoin/sentinel-visor:latest" "filecoin/sentinel-visor:$(COMMIT)"
clean:
rm -rf $(CLEAN) $(BINS)
rm ./vector/data/*json
.PHONY: clean
dist-clean:
git clean -xdff
git submodule deinit --all -f
.PHONY: dist-clean
test-coverage:
VISOR_TEST_DB="postgres://postgres:password@localhost:5432/postgres?sslmode=disable" go test -coverprofile=coverage.out ./...
.PHONY: test-coverage