forked from openhive-network/hive
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yaml
291 lines (270 loc) · 10.2 KB
/
.gitlab-ci.yaml
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
stages:
- build
- test
- package
variables:
GIT_DEPTH: 1
GIT_SUBMODULE_STRATEGY: recursive
# pin to specific docker images for build repeatability
RUNTIME_IMAGE_TAG: "@sha256:e1995e7b44d58436ce97fbcd28a5200d8e877f476c9c4bd3e1cc394c17be050b"
BUILDER_IMAGE_TAG: "@sha256:13933b563395cc3c6ea8bcbd95b717eb4c9fcc33c4cd7194e620713aca03180d"
TEST_IMAGE_TAG: "@sha256:fc78e92864645317c82c4703edd5b679c3d22c24bb7253612fb350b629681637"
testnet_node_build:
stage: build
image: "$CI_REGISTRY_IMAGE/builder$BUILDER_IMAGE_TAG"
script:
# TESTNET=ON HIVE_LINT=ON
- ./ciscripts/build.sh ON ON
- mkdir -p "$CI_JOB_NAME"/tests/unit
- mv build/install-root "$CI_JOB_NAME"
- mv contrib/hived.run "$CI_JOB_NAME"
- mv contrib/config-for-docker.ini "$CI_JOB_NAME"
- mv build/tests/unit/chain_test build/tests/unit/plugin_test "$CI_JOB_NAME"/tests/unit
artifacts:
name: "$CI_JOB_NAME-$CI_COMMIT_REF_NAME"
paths:
- "$CI_JOB_NAME"
expire_in: 6 hours
tags:
- public-runner-docker
- hived-for-tests
consensus_build:
stage: build
image: "$CI_REGISTRY_IMAGE/builder$BUILDER_IMAGE_TAG"
script:
# TESTNET=OFF HIVE_LINT=ON
- ./ciscripts/build.sh OFF ON
- mkdir "$CI_JOB_NAME"
- mv build/install-root "$CI_JOB_NAME"
- mv contrib/hived.run "$CI_JOB_NAME"
- mv contrib/config-for-docker.ini "$CI_JOB_NAME"
artifacts:
name: "$CI_JOB_NAME-$CI_COMMIT_REF_NAME"
paths:
- "$CI_JOB_NAME"
expire_in: 6 hours
tags:
- public-runner-docker
chain_test:
stage: test
needs:
- job: testnet_node_build
artifacts: true
image: "$CI_REGISTRY_IMAGE/runtime$RUNTIME_IMAGE_TAG"
variables:
GIT_STRATEGY: none
script:
- ./testnet_node_build/tests/unit/chain_test --log_format=JUNIT --log_sink=chain_test_results.xml --log_level=error > /dev/null 2>&1
artifacts:
reports:
junit: chain_test_results.xml
when: always
expire_in: 6 months
tags:
- public-runner-docker
plugin_test:
stage: test
needs:
- job: testnet_node_build
artifacts: true
image: "$CI_REGISTRY_IMAGE/runtime$RUNTIME_IMAGE_TAG"
variables:
GIT_STRATEGY: none
script:
# note: consider using --result_code=no to force exit code 0 even when tests fail because they currently fail and I want a nice green checkmark
- ./testnet_node_build/tests/unit/plugin_test --log_format=JUNIT --log_sink=plugin_test_results.xml --log_level=error > /dev/null 2>&1
artifacts:
reports:
junit: plugin_test_results.xml
when: always
expire_in: 6 months
tags:
- public-runner-docker
.beem_setup : &beem_setup |
git clone --depth=1 --single-branch --branch master https://gitlab.syncad.com/hive/beem.git
cd beem
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade -r requirements-test.txt
python3 setup.py install
cd ..
mkdir -p build/tests/hive-node-data
beem_tests:
stage: test
needs:
- job: testnet_node_build
artifacts: true
image: "$CI_REGISTRY_IMAGE/test$TEST_IMAGE_TAG"
variables:
PYTHONPATH: $CI_PROJECT_DIR/tests/functional
script:
- *beem_setup
- cd tests/functional/python_tests/dhf_tests
- "python3 run_proposal_tests.py initminer hive.fund 5JNHfZYKGaomSFvd4NUdQ9qMcEAC43kujbfjueTHpVapX1Kzq2n --run-hived $CI_PROJECT_DIR/testnet_node_build/install-root/bin/hived --working-dir=$CI_PROJECT_DIR/build/tests/hive-node-data"
- rm -rf $CI_PROJECT_DIR/build/tests/hive-node-data
- mkdir -p $CI_PROJECT_DIR/build/tests/hive-node-data
- "python3 beem_dhf_tests.py initminer initminer 5JNHfZYKGaomSFvd4NUdQ9qMcEAC43kujbfjueTHpVapX1Kzq2n --run-hived $CI_PROJECT_DIR/testnet_node_build/install-root/bin/hived --working-dir=$CI_PROJECT_DIR/build/tests/hive-node-data --no-erase-proposal --junit-output=beem_dhf_test.xml"
- cd ../hived
- "python3 hived_hybrid_operations_test.py initminer 5JNHfZYKGaomSFvd4NUdQ9qMcEAC43kujbfjueTHpVapX1Kzq2n --run-hived $CI_PROJECT_DIR/testnet_node_build/install-root/bin/hived --working-dir=$CI_PROJECT_DIR/build/tests/hive-node-data"
artifacts:
paths:
- tests/functional/python_tests/dhf_tests/artifacts/
- tests/functional/python_tests/dhf_tests/beem_dhf_tests.log
- tests/functional/python_tests/hived/hived_hybrid_operations_test.log
reports:
junit: tests/functional/python_tests/dhf_tests/beem_dhf_test.xml
when: always
expire_in: 6 months
tags:
- public-runner-docker
list_proposals_tests:
stage: test
needs:
- job: testnet_node_build
artifacts: true
image: "$CI_REGISTRY_IMAGE/test$TEST_IMAGE_TAG"
variables:
PYTHONPATH: $CI_PROJECT_DIR/tests/functional
script:
- *beem_setup
- cd tests/functional/python_tests/dhf_tests
- "python3 list_proposals_tests.py initminer initminer 5JNHfZYKGaomSFvd4NUdQ9qMcEAC43kujbfjueTHpVapX1Kzq2n --run-hived $CI_PROJECT_DIR/testnet_node_build/install-root/bin/hived --working-dir=$CI_PROJECT_DIR/build/tests/hive-node-data --junit-output=list_proposals_tests.xml"
artifacts:
paths:
- tests/functional/python_tests/dhf_tests/hdf_list_proposal.log
reports:
junit: tests/functional/python_tests/dhf_tests/list_proposals_tests.xml
when: always
expire_in: 6 months
tags:
- public-runner-docker
cli_wallet_tests:
stage: test
needs:
- job: testnet_node_build
artifacts: true
image: "$CI_REGISTRY_IMAGE/test$TEST_IMAGE_TAG"
variables:
PYTHONPATH: $CI_PROJECT_DIR/tests/functional
script:
- *beem_setup
- cd tests/functional/python_tests/cli_wallet
- "python3 run.py --hive-path $CI_PROJECT_DIR/testnet_node_build/install-root/bin/hived --hive-working-dir=$CI_PROJECT_DIR/build/tests/hive-node-data --path-to-cli $CI_PROJECT_DIR/testnet_node_build/install-root/bin --creator initminer --wif 5JNHfZYKGaomSFvd4NUdQ9qMcEAC43kujbfjueTHpVapX1Kzq2n --junit-output=cli_wallet_tests.xml"
artifacts:
paths:
- tests/functional/python_tests/cli_wallet/tests/logs/cli_wallet.log
reports:
junit: tests/functional/python_tests/cli_wallet/cli_wallet_tests.xml
when: always
expire_in: 6 months
tags:
- public-runner-docker
hived_options_tests:
stage: test
needs:
- job: testnet_node_build
artifacts: true
image: "$CI_REGISTRY_IMAGE/test$TEST_IMAGE_TAG"
variables:
PYTHONPATH: $CI_PROJECT_DIR/tests/functional
script:
- cd tests/functional/python_tests/hived
- apt-get update -y && apt-get install -y python3 python3-pip python3-dev
- pip3 install -U psutil
- "python3 hived_options_tests.py --run-hived $CI_PROJECT_DIR/testnet_node_build/install-root/bin/hived"
tags:
- public-runner-docker
.test_tools_based:
variables:
PYTHONPATH: "$CI_PROJECT_DIR/tests/test_tools/package"
HIVED_PATH: "$CI_PROJECT_DIR/testnet_node_build/install-root/bin/hived"
CLI_WALLET_PATH: "$CI_PROJECT_DIR/testnet_node_build/install-root/bin/cli_wallet"
GET_DEV_KEY_PATH: "$CI_PROJECT_DIR/testnet_node_build/install-root/bin/get_dev_key"
before_script:
- apt-get update -y && apt-get install -y python3 python3-pip python3-dev
- pip3 install requests
create_account_tests:
stage: test
extends: .test_tools_based
needs:
- job: testnet_node_build
artifacts: true
image: "$CI_REGISTRY_IMAGE/test$TEST_IMAGE_TAG"
script:
- pip3 install pytest
- cd tests/functional/python_tests/create_account_tests
- pytest
tags:
- public-runner-docker
last_irreversible_block_tests:
stage: test
extends: .test_tools_based
needs:
- job: testnet_node_build
artifacts: true
image: "$CI_REGISTRY_IMAGE/test$TEST_IMAGE_TAG"
script:
- pip3 install pytest pytest-timeout
- cd tests/functional/python_tests/last_irreversible_block_tests
- pytest
tags:
- public-runner-docker
test_tools_tests:
stage: test
extends: .test_tools_based
needs:
- job: testnet_node_build
artifacts: true
image: "$CI_REGISTRY_IMAGE/test$TEST_IMAGE_TAG"
script:
- pip3 install pytest
- cd tests/test_tools/tests
- pytest
tags:
- public-runner-docker
hived_replay_tests:
stage: test
needs:
- job: consensus_build
artifacts: true
image: "$CI_REGISTRY_IMAGE/builder$BUILDER_IMAGE_TAG"
variables:
PYTHONPATH: $CI_PROJECT_DIR/tests/functional
script:
- export ROOT_DIRECTORY=$PWD
- mkdir $ROOT_DIRECTORY/replay_logs
- cd tests/functional/python_tests/hived
- apt-get update -y && apt-get install -y python3 python3-pip python3-dev
- pip3 install -U wget psutil junit_xml gcovr secp256k1prp requests
- $CI_PROJECT_DIR/consensus_build/install-root/bin/truncate_block_log /blockchain/block_log /tmp/block_log 3000000
# quick replays for 10k blocks, with node restarts
- "python3 snapshot_1.py --run-hived $CI_PROJECT_DIR/consensus_build/install-root/bin/hived --block-log /tmp/block_log --blocks 10000 --artifact-directory $ROOT_DIRECTORY/replay_logs"
- "python3 snapshot_2.py --run-hived $CI_PROJECT_DIR/consensus_build/install-root/bin/hived --block-log /tmp/block_log --blocks 10000 --artifact-directory $ROOT_DIRECTORY/replay_logs"
# group of tests, that uses one node with 5 milion blocks replayed
- "python3 start_replay_tests.py --run-hived $CI_PROJECT_DIR/consensus_build/install-root/bin/hived --blocks 3000000 --block-log /tmp/block_log --test-directory $PWD/replay_based_tests --artifact-directory $ROOT_DIRECTORY/replay_logs"
artifacts:
paths:
- replay_logs
when: always
expire_in: 6 months
tags:
- public-runner-docker
- hived-for-tests
package_consensus_node:
stage: package
needs:
- job: consensus_build
artifacts: true
image: docker:19.03.11
services:
- docker:19.03.11-dind
variables:
DOCKER_BUILDKIT: 1
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: "/certs"
script:
- "docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY"
- "docker build -f ciscripts/Dockerfile.ci --target=consensus_node --build-arg CI_REGISTRY_IMAGE=$CI_REGISTRY_IMAGE --build-arg RUNTIME_IMAGE_TAG=$RUNTIME_IMAGE_TAG --tag $CI_REGISTRY_IMAGE/consensus_node:$CI_COMMIT_SHORT_SHA ."
- "docker push $CI_REGISTRY_IMAGE/consensus_node:$CI_COMMIT_SHORT_SHA"
- "echo ===> the consensus node image for this build is: $CI_REGISTRY_IMAGE/consensus_node:$CI_COMMIT_SHORT_SHA"
tags:
- public-runner-docker