forked from massbitprotocol/massbitprotocol
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
265 lines (209 loc) · 8.23 KB
/
Copy pathMakefile
File metadata and controls
265 lines (209 loc) · 8.23 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
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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
#################### Init commands #######################
init-code-compiler:
@echo "Installing all the dependencies for Code compiler ..."
pip install ipfshttpclient flask flask_cors
init-docker:
@echo "Installing docker"
sudo apt update
sudo apt install -y apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository 'deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable'
sudo apt update
apt-cache policy docker-ce
sudo apt install -y docker-ce docker-compose
init-python:
sudo apt install -y python3
sudo apt install -y python3.8
sudo rm /usr/bin/python3
sudo ln -s python3.8 /usr/bin/python3
sudo apt install -y python3-pip wget unzip libpq-dev python3-dev
sudo pip3 install setuptools-rust
sudo pip3 install --upgrade pip
sudo pip3 install PyQtWebEngine
init-npm:
sudo apt install -y npm
curl -fsSL https://deb.nodesource.com/setup_14.x | bash -
sudo apt-get install -y nodejs
init-test:
@echo "Installing some important libraries for scripting ..."
sudo apt install -y tmux
@echo "Installing all the dependencies for E2E tests ..."
pip3 install robotframework robotframework-requests robotframework-databaselibrary rpaframework
pip3 install psycopg2 rpaframework robotframework-seleniumlibrary robotframework-sshlibrary
#################### Test commands #######################
create-git-hook:
@echo "Every push to origin need to run the E2E tests"
@echo "Creating symlink..."
ln -s -f ../../.githooks/pre-push .git/hooks/pre-push
@echo "You can remove all the git-hooks with the 'make remove-all-git-hook'" command
remove-all-git-hook:
@echo "Removing all symlinks..."
rm .git/hooks/*
test-run-contract:
@echo "Running health check tests ..."
cd e2e-test/health-check && robot health-check.robot || true
@echo "Running polygon contract tests ..."
cd e2e-test/polygon && robot contract.robot
make restart-chain-reader-indexer-manager
@echo "Running bsc contract tests ..."
cd e2e-test/bsc && robot contract.robot
test-run-chain:
@echo "Running health check tests ..."
cd e2e-test/health-check && robot health-check.robot || true
@echo "Running polygon contract tests ..."
cd e2e-test/polygon && robot chain.robot
#This test for run all test when the component already up
test-run-basic:
@echo "Running health check tests ..."
cd e2e-test/health-check && robot health-check.robot || true
@echo "Running basic solana tests ..."
cd e2e-test/solana && robot basic.robot
make restart-chain-reader-indexer-manager
@echo "Running basic ethereum tests ..."
cd e2e-test/ethereum && robot basic.robot
make restart-chain-reader-indexer-manager
#This test start/restart all service and run all test
test-run-basic-and-up:
@echo "Close all services before running test"
make services-down
make kill-all-tmux || true
@echo "Restart services before running test"
make services-up
#tmux new -d -s services "make services-up"
sleep 5;
make run-all-tmux
tmux ls
sleep 5;
@echo "Running health check tests ..."
cd e2e-test/health-check && robot health-check.robot || true
@echo "Running basic solana tests ..."
cd e2e-test/solana && robot basic.robot || true
make restart-chain-reader-indexer-manager
@echo "Running basic ethereum tests ..."
cd e2e-test/ethereum && robot basic.robot || true
make restart-chain-reader-indexer-manager
test-init:
@echo "Installing all the dependencies for E2E tests ..."
pip install robotframework robotframework-requests robotframework-databaselibrary psycopg2 rpaframework robotframework-seleniumlibrary robotframework-sshlibrary
@echo "Installing Webdriver for Selenium to run tests ..."
sudo pip install webdrivermanager
sudo webdrivermanager firefox chrome --linkpath /usr/local/bin
create-list-user-example-json-file:
@echo "Create list user examples json file ..."
cd user-example && python create_example_json.py
restart-chain-reader-indexer-manager:
@echo "Stop indexer-manager and chain-reader in tmux"
tmux kill-session -t chain-reader
tmux kill-session -t indexer-manager
@echo "Run indexer-manager in tmux"
tmux new -d -s indexer-manager scripts/run-indexer-sol.sh
@echo "Run chain-reader in tmux"
tmux new -d -s chain-reader scripts/run-chain-reader.sh
#################### Dev commands ##########################
deploy-wasm:
@echo "Deploy already build indexer $(id)"
curl --location --request POST 'localhost:5000/deploy/wasm' \
--header 'Content-Type: application/json' \
--data-raw '{"compilation_id": "$(id)" }'
deploy-so:
@echo "Deploy already build indexer $(id)"
curl --location --request POST 'localhost:5000/deploy/so' \
--header 'Content-Type: application/json' \
--data-raw '{"compilation_id": "$(id)" }'
deploy:
@echo "Deploy already build indexer $(id)"
cargo run --bin massbit-sol -- deploy -u http://127.0.0.1:3031/indexers/deploy -d code-compiler/generated/$(id)
run-indexer-manager:
@echo "Run indexer-manager"
cargo run --bin indexer-manager
run-chain-reader:
@echo "Run chain-reader"
cargo run --bin chain-reader
run-code-compiler:
@echo "Run code-compiler"
cd code-compiler/ && python app.py
run-indexer-api:
@echo "Run indexer-api"
cargo run --bin indexer-api
services-dev-up:
@echo "Run all services in dev mode"
docker-compose -f docker-compose.min.yml up
services-dev-down:
@echo "Stop all services"
docker-compose -f docker-compose.min.yml down
services-prod-up:
@echo "Run all services in production mode"
docker-compose -f docker-compose.prod.yml up -d
services-prod-down:
@echo "Stop all services"
docker-compose -f docker-compose.prod.yml down
#################### Production commands ##################
tmux-start-all:
@echo "A quick fix to bypass the not able to start tmux error"
export TERM=xterm
@echo "Run indexer-sol in tmux"
tmux new -d -s indexer-sol scripts/run-indexer-sol.sh
@echo "Run indexer-eth in tmux"
tmux new -d -s indexer-eth scripts/run-indexer-eth.sh
@echo "Run chain-reader in tmux"
tmux new -d -s chain-reader scripts/run-chain-reader.sh
@echo "Run code-compiler in tmux"
tmux new -d -s code-compiler scripts/run-code-compiler.sh
tmux ls
tmux-kill-all:
@echo "Kill all tmux services"
tmux list-sessions | awk 'BEGIN{FS=":"}{print $1}' | xargs -n 1 tmux kill-session -t
tmux-code-compiler:
@echo "Run code-compiler in tmux"
tmux new -d -s code-compiler scripts/run-code-compiler.sh
tmux ls
tmux-indexer-sol:
@echo "Run Indexer Solana in tmux"
tmux new -d -s indexer-sol scripts/run-indexer-sol.sh
tmux ls
tmux-indexer-eth:
@echo "Run Indexer Ethereum in tmux"
tmux new -d -s indexer-eth scripts/run-indexer-eth.sh
tmux ls
tmux-chain-reader:
@echo "Run Chain Reader in tmux"
tmux new -d -s chain-reader scripts/run-chain-reader.sh
tmux ls
tmux-indexer-eth-binary:
@echo "Run Indexer Ethereum in tmux with binary"
tmux new -d -s indexer-eth scripts/run-indexer-eth-binary.sh
tmux ls
tmux-chain-reader-binary:
@echo "Run Chain Reader in tmux with binary"
tmux new -d -s chain-reader scripts/run-chain-reader-binary.sh
tmux ls
tmux-indexer-api-binary:
@echo "Run Index API in tmux with binary"
tmux new -d -s indexer-api scripts/run-indexer-api-binary.sh
tmux ls
#################### Long running test commands ##################
index-quickswap-full:
@echo "A quick fix to bypass the not able to start tmux error"
export TERM=xterm
@echo "Run indexer-manager in tmux"
tmux new -d -s indexer-manager scripts/run-indexer-sol.sh
@echo "Run chain-reader in tmux"
tmux new -d -s chain-reader scripts/run-chain-reader.sh
@echo "Run code-compiler in tmux"
tmux new -d -s code-compiler scripts/run-code-compiler.sh
@echo "Wait for the services to start"
sleep 15;
@echo "Running only the quickswap Ethereum test ..."
cd e2e-test/polygon && robot -t "Compile and Deploy WASM Test Quickswap" basic.robot;
@echo "Running report email services"
tmux new -d -s report_email "cd e2e-test && python check_log.py"
tmux ls
index-quickswap:
@echo "Start indexing Quickswap (Polygon) ..."
cd e2e-test/polygon && robot -t "Index Quickswap" contract.robot
index-pancakeswap:
@echo "Start indexing Pancakeswap (BSC) ..."
cd e2e-test/bsc && robot -t "Index Pancakeswap" contract.robot
index-harmony:
@echo "Start indexing Harmony (Harmony) ..."
cd e2e-test/harmony && robot -t "Index Harmony" contract.robot