-
Notifications
You must be signed in to change notification settings - Fork 7
488 lines (439 loc) · 18 KB
/
container-test.yml
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
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
name: IMA container test
on:
push:
branches-ignore:
- 'docs-v*'
pull_request:
branches-ignore:
- 'docs-v*'
jobs:
cancel-runs:
name: Cancel Previous Runs
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
test-comprehensive:
runs-on: self-hosted
steps:
- uses: oven-sh/setup-bun@v1
- name: INIT - force pre-clean
run: |
echo "------------------------------------------------------------------------------------"
sudo docker ps
echo "------------------------------------------------------------------------------------"
sudo docker stop run_sgx_sim_sgxwallet_1 || true
sudo docker stop tm || true
sudo docker stop redis || true
echo "------------------------------------------------------------------------------------"
sudo docker ps
echo "------------------------------------------------------------------------------------"
sudo rm -rf comprehensive-test || true
sudo rm -rf ./sgxwallet || true
sudo rm -rf ./transaction-manager || true
- uses: actions/checkout@v2
with:
submodules: recursive
- uses: oven-sh/setup-bun@v1
- name: INFO - github environment variable checks
run: |
echo ------------ GIT_CURRENT_BRANCH
export GIT_CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
echo $GIT_CURRENT_BRANCH
echo ------------ GIT_SYMBOLIC_BRANCH
export GIT_SYMBOLIC_BRANCH=$(git symbolic-ref --short HEAD)
echo $GIT_SYMBOLIC_BRANCH
echo ------------ GITHUB_WORKFLOW
echo $GITHUB_WORKFLOW
echo ------------ GITHUB_RUN_ID
echo $GITHUB_RUN_ID
echo ------------ GITHUB_RUN_NUMBER
echo $GITHUB_RUN_NUMBER
echo ------------ GITHUB_ACTION
echo $GITHUB_ACTION
echo ------------ GITHUB_ACTIONS
echo $GITHUB_ACTIONS
echo ------------ GITHUB_ACTOR
echo $GITHUB_ACTOR
echo ------------ GITHUB_REPOSITORY
echo $GITHUB_REPOSITORY
echo ------------ GITHUB_EVENT_NAME
echo $GITHUB_EVENT_NAME
echo ------------ GITHUB_EVENT_PATH
echo $GITHUB_EVENT_PATH
echo ------------ GITHUB_WORKSPACE
echo $GITHUB_WORKSPACE
echo ------------ GITHUB_SHA
echo $GITHUB_SHA
echo ------------ GITHUB_REF
echo $GITHUB_REF
echo ------------ GITHUB_HEAD_REF
echo $GITHUB_HEAD_REF
echo ------------ GITHUB_BASE_REF
echo $GITHUB_BASE_REF
- name: INFO - user information checks
run: |
echo ------------ user
echo $USER
echo ------------ home
echo $HOME
echo ------------ path
echo $PATH
- name: INFO - system information checks
run: |
echo ------------ pwd
pwd
echo ------------ unix name - a
uname -a || true
echo ------------ unix name - r
uname -r || true
echo ------------ lsb_release - cat
cat /etc/lsb-release
echo ------------ lsb_release - a
lsb_release -a || true
echo ------------ hostnamectl
hostnamectl || true
echo ------------ /etc/os-release
cat /etc/os-release || true
echo ------------ /proc/version
cat /proc/version || true
echo ------------ lscpu
lscpu || true
- name: UPDATE - system deps and install libc6, net-tools, btrfs-progs, zip, unzip, bash, procps, curl, jq
run: |
sudo apt-get update
sudo apt-get install -y libc6 net-tools btrfs-progs zip unzip build-essential
sudo apt-get install -y bash
sudo apt-get install -y procps
sudo apt-get install -y curl
sudo apt-get install -y jq
- name: INIT - uninstall old Node JS if any
run: |
sudo npm cache clean -f || true &> /dev/null
sudo apt-get remove -y nodejs npm node -y || true &> /dev/null
sudo apt-get purge -y nodejs -y || true &> /dev/null
sudo apt-get autoremove -y || true &> /dev/null
sudo rm -rf /usr/bin/node || true &> /dev/null
sudo rm -rf /usr/include/node || true &> /dev/null
sudo rm -rf /usr/lib/node_modules || true &> /dev/null
sudo rm -rf /usr/local/bin/npm || true &> /dev/null
sudo rm -rf /usr/local/share/man/man1/node* || true &> /dev/null
sudo rm -rf /usr/local/lib/dtrace/node.d || true &> /dev/null
sudo rm -rf ~/.npm || true &> /dev/null
sudo rm -rf ~/.node-gyp || true &> /dev/null
sudo rm -rf /opt/local/bin/node || true &> /dev/null
sudo rm -rf /opt/local/include/node || true &> /dev/null
sudo rm -rf /opt/local/lib/node_modules || true &> /dev/null
sudo rm -rf /usr/local/lib/node* || true &> /dev/null
sudo rm -rf /usr/local/include/node* || true &> /dev/null
sudo rm -rf /usr/local/bin/node* || true &> /dev/null
- name: INIT - install Node JS
run: |
curl -sL https://deb.nodesource.com/setup_18.x | sudo bash -
sudo apt-get install -y nodejs
sudo ln -s /usr/bin/node /usr/local/bin/node || true
- name: INIT - install Node utilities
run: |
sudo npm install --global npm
sudo npm install --global color-support
sudo npm install --global yarn
sudo npm install --global node-gyp
- name: INIT - version checks of Node JS and its utilities
run: |
which node
node --version
which npx
npx --version
which npm
npm --version
which yarn
yarn --version
which node-gyp
node-gyp --version
- name: INIT - version checks of Bun SH
run: |
which bun
bun --version
- name: INIT - Download comprehensive-test
working-directory: ${{env.working-directory}}
run: |
sudo rm -rf ./comprehensive-test || true
export IMA_AGENT_ROOT_DIR=$(pwd)
echo IMA_AGENT_ROOT_DIR = $IMA_AGENT_ROOT_DIR
git clone https://github.com/skalenetwork/comprehensive-test.git --recursive
- name: INIT - install Ethereum Main Net emulation
working-directory: ${{env.working-directory}}
run: |
cd comprehensive-test
pwd
cd cli-hh
./clean.sh
./init.sh
cd ../..
- name: INIT - startup Ethereum Main Net emulation
working-directory: ${{env.working-directory}}
run: |
cd comprehensive-test
cd cli-hh
./run.sh &> ../local_mainnet_output_log.txt &
cd ../..
- name: INIT - Install PYTHON
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: INIT - Install venv for PYTHON
working-directory: ${{env.working-directory}}
run: |
sudo apt-get install -y python3.8-venv
- name: INIT - Install everything in IMA
working-directory: ${{env.working-directory}}
run: |
yarn install
- name: INIT - initialize comprehensive test tokens
working-directory: ${{env.working-directory}}
run: |
cd comprehensive-test/test_tokens
yarn install
cd ../..
- name: INIT - initialize S-Chain configuration creator
working-directory: ${{env.working-directory}}
run: |
cd comprehensive-test
cd s_chain_gen
yarn install
cd ..
cd ..
- name: INIT - initialize S-Chain configuration creator
working-directory: ${{env.working-directory}}
run: |
cd comprehensive-test
cd s_chain_gen
yarn install
cd ..
cd ..
- name: INIT - check skaled can run
working-directory: ${{env.working-directory}}
run: |
cd comprehensive-test
export DETECTED_UBUNTU_VERSION=$(lsb_release -r | cut -f2)
export TRYING_SKALED_AT_PATH=./app_cache/bin_$DETECTED_UBUNTU_VERSION/skaled
$TRYING_SKALED_AT_PATH --colors --version
$TRYING_SKALED_AT_PATH --help
cd ..
- name: INIT - generate configuration files for S-Chain nodes
working-directory: ${{env.working-directory}}
run: |
cd comprehensive-test
cd s_chain_gen
./init.sh
cd ../..
- name: INIT - download Skale Manager
working-directory: ${{env.working-directory}}
run: |
cd comprehensive-test
sudo rm -rf ./skale-manager || true
git clone https://github.com/skalenetwork/skale-manager.git --recursive
cd ..
- name: INIT - install Skale Manager dependencies
working-directory: ${{env.working-directory}}
run: |
cd comprehensive-test
cd skale-manager
yarn install
cd ../..
- name: INIT - install comprehensive engine dependencies
working-directory: ${{env.working-directory}}
run: |
cd comprehensive-test
cd engine
yarn install
cd ../..
- name: SELF-TEST A - use IMA to browse S-Chain via node 00-00 and test last is alive
working-directory: ${{env.working-directory}}
run: |
node ./src/main.mjs --colors --no-gathered --browse-s-chain --url-s-chain=http://127.0.0.1:2164 || true
- name: SELF-TEST B - use IMA to browse S-Chain via node 00-01 and test last is alive
working-directory: ${{env.working-directory}}
run: |
node ./src/main.mjs --colors --no-gathered --browse-s-chain --url-s-chain=http://127.0.0.2:2264 || true
- name: SELF-TEST C - use IMA to browse S-Chain via node 01-00 and test last is alive
working-directory: ${{env.working-directory}}
run: |
node ./src/main.mjs --colors --no-gathered --browse-s-chain --url-s-chain=http://127.0.0.3:2364 || true
- name: SELF-TEST D - use IMA to browse S-Chain via node 01-01 and test last is alive
working-directory: ${{env.working-directory}}
run: |
node ./src/main.mjs --colors --no-gathered --browse-s-chain --url-s-chain=http://127.0.0.4:2464 || true
- name: INIT - build IMA docker container
working-directory: ${{env.working-directory}}
run: |
echo ------------ download binaries
LIB_BLS_RELEASE_TAG="0.2.0-develop.3" bash ./scripts/download_binaries.sh
echo ------------ docker image
export RELEASE=false
export VERSION=13.13.13-test.13
echo "Docker image(will build) version is:" $VERSION
export NAME=ima
export BRANCH=$GIT_CURRENT_BRANCH
export REPO_NAME=skalenetwork/$NAME
export IMAGE_NAME=$REPO_NAME:$VERSION
export LATEST_IMAGE_NAME=$REPO_NAME:latest
echo "Docker image(will build) name for IMA Agent is:" $IMAGE_NAME
bash ./scripts/build_image.sh "" ""
- name: INIT - download SGX Wallet
working-directory: ${{env.working-directory}}
run: |
cd comprehensive-test
sudo docker stop run_sgx_sim_sgxwallet_1 || true
sudo rm -rf ./sgxwallet || true
git clone https://github.com/skalenetwork/sgxwallet.git --recursive
cd sgxwallet
git checkout develop
git fetch
git pull
git branch
git status
cd ..
cd ..
- name: INIT - update docker image SGX Wallet in the emulation mode
working-directory: ${{env.working-directory}}
run: |
cd comprehensive-test
cd sgxwallet/run_sgx_sim
rm -rf ../../local_sgxwallet_output_log.txt &> /dev/null
echo " --------------------------- stopping sgx wallet ------------------------------------------------------------------------------------------------------ "
docker-compose down
echo " --------------------------- fixing sgx wallets docker config ----------------------------------------------------------------------------------------- "
mv docker-compose.yml docker-compose.yml.old-previous || true
echo "version: '3'" > docker-compose.yml
echo 'services:' >> docker-compose.yml
echo ' sgxwallet:' >> docker-compose.yml
echo ' image: skalenetwork/sgxwallet_sim:1.9.0-develop.11' >> docker-compose.yml
echo ' restart: unless-stopped' >> docker-compose.yml
echo ' network_mode: "host"' >> docker-compose.yml
# echo ' ports:' >> docker-compose.yml
# echo ' - "1026:1026"' >> docker-compose.yml
# echo ' - "1027:1027"' >> docker-compose.yml
# echo ' - "1028:1028"' >> docker-compose.yml
# echo ' - "1029:1029"' >> docker-compose.yml
# echo ' - "1030:1030"' >> docker-compose.yml
# echo ' - "1031:1031"' >> docker-compose.yml
echo ' volumes:' >> docker-compose.yml
echo ' - ./sgx_data:/usr/src/sdk/sgx_data' >> docker-compose.yml
echo ' - /dev/urandom:/dev/random' >> docker-compose.yml
echo ' logging:' >> docker-compose.yml
echo ' driver: json-file' >> docker-compose.yml
echo ' options:' >> docker-compose.yml
echo ' max-size: "10m"' >> docker-compose.yml
echo ' max-file: "4"' >> docker-compose.yml
echo ' command: -s -y -V -d' >> docker-compose.yml
echo " --------------------------- pulling sgx wallet ------------------------------------------------------------------------------------------------------- "
docker-compose pull
cd ../..
cd ..
- name: INIT - start SGX Wallet
working-directory: ${{env.working-directory}}
run: |
cd comprehensive-test
cd sgxwallet/run_sgx_sim
docker-compose up &> ../../local_sgxwallet_output_log.txt &
sleep 90
cd ../..
cd ..
- name: INIT - check SGX Wallet has listening ports
working-directory: ${{env.working-directory}}
run: |
echo "sleeping 180 seconds..."
sleep 180
echo "checking port 1026 commonly used by SGX Wallet for HTTPS..."
sudo netstat -tulpn | grep 1026
echo "...Done"
echo "checking port 1027 commonly used by SGX Wallet for HTTP..."
sudo netstat -tulpn | grep 1027
echo "...Done"
- name: INIT - download transaction manager
working-directory: ${{env.working-directory}}
run: |
cd comprehensive-test
sudo rm -rf ./transaction-manager || true
git clone https://github.com/skalenetwork/transaction-manager
cd ..
- name: INIT - start transaction manager and redis
working-directory: ${{env.working-directory}}
run: |
cd comprehensive-test
cd transaction-manager
export SGX_SERVER_URL=http://127.0.0.1:1027
export ENDPOINT=http://127.0.0.1:8545
#export ETH_PRIVATE_KEY=23ABDBD3C61B5330AF61EBE8BEF582F4E5CC08E554053A718BDCE7813B9DC1FC
export ETH_PRIVATE_KEY=fd6d151c4afe5c1c856e5a234950252be7a90210f3aa2bad4e0db037355c1dd6
./scripts/run-test-containers.sh
cd ..
echo "------------------------------------------------------------------------------------"
docker ps
echo "------------------------------------------------------------------------------------"
export TM_CONTAINER_ID=$(docker ps | grep transaction-manager | awk '{print $1;}')
echo "Transaction manager docker container ID:" $TM_CONTAINER_ID
docker logs $TM_CONTAINER_ID -f &> engine/tm.log &
echo "------------------------------------------------------------------------------------"
export REDIS_CONTAINER_ID=$(docker ps | grep redis | awk '{print $1;}')
echo "Redis container ID:" $REDIS_CONTAINER_ID
docker logs $REDIS_CONTAINER_ID -f &> engine/redis.log &
cd ..
- name: INIT - prepare ulimit
working-directory: ${{env.working-directory}}
run: |
ulimit -n 65535 > /dev/null
echo "ulimit is now set to" $(ulimit -n)
- name: RUN - create certificates
working-directory: ${{env.working-directory}}
run: |
cd comprehensive-test
cd engine/create_pems
sudo rm -rf ./new_certs/* || true
sudo rm -rf ./k.key || true
sudo rm -rf ./k.pem || true
sudo rm -rf ./k.crt || true
sudo rm -rf ./client.key || true
sudo rm -rf ./client.pem || true
sudo rm -rf ./client.crt || true
./create_pems.sh
cd ../..
cd ..
- name: RUN - main engine steps
working-directory: ${{env.working-directory}}
run: |
export IMA_AGENT_ROOT_DIR=$(pwd)
echo IMA_AGENT_ROOT_DIR = $IMA_AGENT_ROOT_DIR
cd comprehensive-test/engine
export ALL_SKALE_TEST_CLOUD_RUN=1
#
export VERSION=13.13.13-test.13
echo "Docker image(will run) version is:" $VERSION
export NAME=ima
export BRANCH=$GIT_CURRENT_BRANCH
export REPO_NAME=skalenetwork/$NAME
export IMAGE_NAME=$REPO_NAME:$VERSION
export LATEST_IMAGE_NAME=$REPO_NAME:latest
echo "Docker image(will run) name for IMA Agent is:" $IMAGE_NAME
#
export SEPARATED_IMA_AGENT_MODE=1
node ./index.js
cd ../..
- name: SHUTDOWN - stop SGX Wallet
run: |
cd comprehensive-test
cd sgxwallet/run_sgx_sim
docker-compose down
cd ../..
cd ..
- name: SHUTDOWN - stop transaction manager and redis
run: |
docker stop $TM_CONTAINER_ID $REDIS_CONTAINER_ID || true
docker rm $TM_CONTAINER_ID $REDIS_CONTAINER_ID || true
- name: SHUTDOWN - zombie cleanup, if any
run: |
killall -9 skaled node npx python python3 || true
pkill -9 -f skaled || true