-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
98 lines (78 loc) · 2.05 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
GO=env GO111MODULE=on go
GONOMOD=env GO111MODULE=off go
IPFSCONTAINERS=`docker ps -a -q --filter="name=ipfs-*"`
COMPOSECOMMAND=env ADDR_NODE1=1 ADDR_NODE2=2 docker-compose -f testenv/docker-compose.yml
VERSION=`git describe --always --tags`
all: deps check build
.PHONY: build
build:
go build -ldflags "-X main.Version=$(VERSION)" ./cmd/nexus
.PHONY: install
install: deps
go install -ldflags "-X main.Version=$(VERSION)" ./cmd/nexus
# Install dependencies
.PHONY: deps
deps:
$(GO) mod vendor
$(GO) get github.com/UnnoTed/fileb0x
$(GO) get github.com/maxbrunsfeld/counterfeiter
$(GO) mod tidy
# Run simple checks
.PHONY: check
check:
go vet ./...
go test -run xxxx ./...
# Execute tests
.PHONY: test
test:
go test -race -cover ./...
.PHONY: testenv
testenv:
$(COMPOSECOMMAND) up -d postgres
# Clean up containers and things
.PHONY: clean
clean:
$(COMPOSECOMMAND) down
docker stop $(IPFSCONTAINERS) || true
docker rm $(IPFSCONTAINERS) || true
rm -f ./nexus
find . -name tmp -type d -exec rm -f -r {} +
# Gen runs all code generators
.PHONY: gen
gen:
fileb0x b0x.yml
counterfeiter -o ./ipfs/mock/ipfs.mock.go \
./ipfs/ipfs.go NodeClient
counterfeiter -o ./temporal/mock/networks.mock.go \
./temporal/database.go PrivateNetworks
.PHONY: release
release:
bash .scripts/release.sh
#####################
# DEVELOPMENT UTILS #
#####################
NETWORK=test_network
TESTFLAGS=-dev -config ./config.dev.json
.PHONY: example-config
example-config: build
./nexus -config ./config.example.json init
.PHONY: dev-config
dev-config: build
./nexus $(TESTFLAGS) init
.PHONY: config
config: example-config dev-config
.PHONY: daemon
daemon: build
./nexus $(TESTFLAGS) daemon
.PHONY: new-network
new-network: build
./nexus $(TESTFLAGS) dev network $(NETWORK)
.PHONY: start-network
start-network: build
./nexus $(TESTFLAGS) ctl --pretty StartNetwork Network=$(NETWORK)
.PHONY: stat-network
stat-network:
./nexus $(TESTFLAGS) ctl --pretty NetworkStats Network=$(NETWORK)
.PHONY: diag-network
diag-network:
./nexus $(TESTFLAGS) ctl NetworkDiagnostics Network=$(NETWORK)