-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
200 lines (155 loc) · 3.82 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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
# Copyright © 2021 Luther Systems, Ltd. All right reserved.
# Makefile
#
# The primary project makefile that should be run from the root directory and is
# able to build and run the entire application.
PROJECT_REL_DIR=.
include ${PROJECT_REL_DIR}/common.mk
BUILD_IMAGE_PROJECT_DIR=/go/src/${PROJECT_PATH}
GO_SERVICE_PACKAGES=./portal/... ./phylum/...
GO_API_PACKAGES=./api/...
GO_PACKAGES=${GO_SERVICE_PACKAGES} ${GO_API_PACKAGES}
SUBSTRATEHCP_FILE ?= ${PWD}/${SUBSTRATE_PLUGIN_PLATFORM_TARGETED}
export SUBSTRATEHCP_FILE
.DEFAULT_GOAL := default
.PHONY: default
default: all
.PHONY: all push clean test
clean:
rm -rf build
all: plugin
.PHONY: plugin plugin-linux plugin-darwin
plugin: ${SUBSTRATE_PLUGIN}
plugin-linux: ${SUBSTRATE_PLUGIN_LINUX}
plugin-darwin: ${SUBSTRATE_PLUGIN_DARWIN}
all: tests-api
.PHONY: tests-api
tests-api:
cd tests && $(MAKE)
.PHONY: tests-api-clean
tests-api-clean:
cd tests && $(MAKE) clean
all: api
.PHONY: api
api:
cd api && $(MAKE)
all: phylum
.PHONY: phylum
phylum:
cd phylum && $(MAKE)
test: phylumtest
.PHONY: phylumtest
phylumtest:
cd phylum && $(MAKE) test
clean: phylumclean
.PHONY: phylumclean
phylumclean:
cd phylum && $(MAKE) clean
all: portal
.PHONY: portal
portal: plugin
cd ${SERVICE_DIR} && $(MAKE)
clean: portalclean
.PHONY: portalclean
portalclean:
cd ${SERVICE_DIR} && $(MAKE) clean
.PHONY: fabric
all: fabric
fabric:
cd fabric && $(MAKE)
.PHONY: fabricclean
clean: fabricclean
fabricclean:
cd fabric && $(MAKE) clean
.PHONY: storage-up
storage-up:
cd fabric && $(MAKE) up install init
.PHONY: storage-down
storage-down:
-cd fabric && $(MAKE) down
.PHONY: service-up
service-up: api portal
./blockchain_compose.py local up -d
.PHONY: service-down
service-down:
-./blockchain_compose.py local down
.PHONY: up
up: all service-down storage-down storage-up service-up
@
.PHONY: down
down: explorer-down service-down storage-down
@
.PHONY: init
init:
-cd fabric && $(MAKE) init
.PHONY: upgrade
upgrade: all service-down init service-up
@
.PHONY: mem-up
mem-up: all mem-down
./blockchain_compose.py mem up -d
.PHONY: mem-down
mem-down: explorer-down
-./blockchain_compose.py mem down
# citest runs all tests within containers, as in CI.
.PHONY: citest
citest: plugin unit integrationcitest
@
.PHONY: unit-portal
unit-portal:
go test -v ./...
.PHONY: unit
unit: unit-portal unit-other
@echo "all tests passed"
.PHONY: unit-other
unit-other: phylumtest
@echo "phylum tests passed"
# NOTE: The `citest` target manages creating/destroying a compose network. To
# run tests repeatedly execute the `integration` target directly.
.PHONY: integrationcitest
# The `down` wouldn't execute without this syntax
integrationcitest:
$(MAKE) up
$(MAKE) integration
$(MAKE) down
.PHONY: integration
integration:
cd tests && $(MAKE) test-docker
.PHONY: repl
repl:
cd phylum && $(MAKE) repl
# this target is called by git-hooks/pre-push. It's separated into its own target
# to allow us to update the git-hooks without having to reinstall the hook
# It generates postman artifacts and protobuf artifacts.
.PHONY: pre-push
pre-push:
$(MAKE) tests-api
cd api && $(MAKE)
.PHONY:
download: ${SUBSTRATE_PLUGIN}
.PHONY: print-export-path
print-export-path:
@echo "export SUBSTRATEHCP_FILE=${SUBSTRATEHCP_FILE}"
${STATIC_PLUGINS_DUMMY}:
${MKDIR_P} $(dir $@)
./scripts/obtain-plugin.sh
touch $@
${SUBSTRATE_PLUGIN}: ${STATIC_PLUGINS_DUMMY}
@
.PHONY: explorer
explorer: explorer-up-clean
.PHONY: explorer-up
explorer-up:
cd ${PROJECT_REL_DIR}/explorer && make up
.PHONY: explorer-up-clean
explorer-up-clean:
cd ${PROJECT_REL_DIR}/explorer && make up-clean
.PHONY: explorer-down
explorer-down:
cd ${PROJECT_REL_DIR}/explorer && make down
.PHONY: explorer-clean
explorer-clean:
cd ${PROJECT_REL_DIR}/explorer && make down-clean
.PHONY: explorer-watch
explorer-watch:
cd ${PROJECT_REL_DIR}/explorer && make watch