forked from hyperledger/besu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.yml
475 lines (450 loc) · 13.3 KB
/
config.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
---
version: 2.1
orbs:
win: circleci/windows@2.2.0
executors:
besu_executor_small:
docker:
- image: cimg/openjdk:11.0
resource_class: small
working_directory: ~/project
environment:
GRADLE_OPTS: -Dorg.gradle.daemon=false -Dorg.gradle.parallel=true -Dorg.gradle.workers.max=2
besu_executor_med: # 2cpu, 4G ram
docker:
- image: cimg/openjdk:11.0
resource_class: medium
working_directory: ~/project
environment:
architecture: "amd64"
GRADLE_OPTS: -Dorg.gradle.daemon=false -Dorg.gradle.parallel=true -Dorg.gradle.workers.max=2
besu_arm64_executor_med: # 2cpu, 8G ram
machine:
image: ubuntu-2004:202101-01
resource_class: arm.medium
working_directory: ~/project
environment:
architecture: "arm64"
GRADLE_OPTS: -Dorg.gradle.daemon=false -Dorg.gradle.parallel=true -Dorg.gradle.workers.max=2
besu_executor_xl: # 8cpu, 16G ram
docker:
- image: cimg/openjdk:11.0
resource_class: xlarge
working_directory: ~/project
environment:
GRADLE_OPTS: -Dorg.gradle.daemon=false -Dorg.gradle.parallel=true -Dorg.gradle.workers.max=4
quorum_ats_executor:
docker:
- image: cimg/openjdk:11.0
resource_class: xlarge
working_directory: ~/project
environment:
GRADLE_OPTS: -Dorg.gradle.daemon=false
xl_machine_executor:
machine:
image: ubuntu-2004:202201-02 #Ubuntu 20.04, Docker v20.10.12, Docker Compose v1.29.2, Google Cloud SDK updates
resource_class: xlarge
trivy_executor:
docker:
- image: docker:stable-git
resource_class: small
working_directory: ~/project
commands:
prepare:
description: "Prepare"
steps:
- checkout
- run:
name: Install Packages - LibSodium, nssdb
command: |
sudo apt-get update
sudo apt-get install -y libsodium23 libsodium-dev libjemalloc-dev apt-transport-https haveged libnss3-tools
sudo service haveged restart
- restore_gradle_cache
restore_gradle_cache:
description: "Restore Gradle cache"
steps:
- restore_cache:
name: Restore cached gradle dependencies
keys:
- deps-{{ checksum "gradle/versions.gradle" }}-{{ .Branch }}-{{ .Revision }}
- deps-{{ checksum "gradle/versions.gradle" }}
- deps-
capture_test_results:
description: "Capture test results"
steps:
- run:
name: Jacoco
command: |
./gradlew --no-daemon jacocoTestReport
- run:
name: Gather test results
when: always
command: |
FILES=`find . -name test-results`
for FILE in $FILES
do
MODULE=`echo "$FILE" | sed -e 's@./\(.*\)/build/test-results@\1@'`
TARGET="build/test-results/$MODULE"
mkdir -p "$TARGET"
cp -rf ${FILE}/*/* "$TARGET"
done
- store_test_results:
path: build/test-results
- store_artifacts:
path: besu/build/reports/jacoco
capture_test_logs:
description: "Capture test logs"
steps:
- store_artifacts:
path: acceptance-tests/tests/build/acceptanceTestLogs
destination: acceptance-tests-logs
- store_artifacts:
path: acceptance-tests/tests/build/jvmErrorLogs
jobs:
assemble:
executor: besu_executor_xl
steps:
- prepare
- run:
name: Assemble
command: |
./gradlew --no-daemon clean compileJava compileTestJava assemble
- save_cache:
name: Caching gradle dependencies
key: deps-{{ checksum "gradle/versions.gradle" }}-{{ .Branch }}-{{ .Revision }}
paths:
- .gradle
- ~/.gradle
- persist_to_workspace:
root: ~/project
paths:
- ./
- store_artifacts:
name: Distribution artifacts
path: build/distributions
destination: distributions
when: always
testWindows:
executor: win/default
steps:
- attach_workspace:
at: ~/project
- run:
name: Unzip Windows build
no_output_timeout: 20m
command: |
cd build/distributions
unzip besu-*.zip -d besu-tmp
cd besu-tmp
mv besu-* ../besu
- run:
name: Test Besu Windows executable
no_output_timeout: 10m
command: |
build\distributions\besu\bin\besu.bat --help
build\distributions\besu\bin\besu.bat --version
dockerScan:
executor: trivy_executor
steps:
- checkout
- restore_gradle_cache
- setup_remote_docker:
docker_layer_caching: true
- run:
name: Install trivy
command: |
apk add --update-cache --upgrade curl bash
curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin
- run:
name: Scan with trivy
shell: /bin/sh
command: |
for FILE in $(ls docker)
do
if [[ $FILE == "test.sh" || $FILE == "tests" ]]; then
continue
fi
docker pull -q "hyperledger/besu:develop-$FILE"
trivy -q image --exit-code 1 --no-progress --severity HIGH,CRITICAL "hyperledger/besu:develop-$FILE"
done
unitTests:
executor: besu_executor_xl
steps:
- prepare
- attach_workspace:
at: ~/project
- run:
name: Build
no_output_timeout: 20m
command: |
./gradlew --no-daemon build
- capture_test_results
integrationTests:
executor: xl_machine_executor
steps:
- prepare
- attach_workspace:
at: ~/project
- run:
name: IntegrationTests
command: |
./gradlew --no-daemon integrationTest
- run:
name: Javadoc
command: |
./gradlew --no-daemon javadoc
- run:
name: CompileJmh
command: |
./gradlew --no-daemon compileJmh
- capture_test_results
referenceTests:
executor: besu_executor_xl
steps:
- prepare
- attach_workspace:
at: ~/project
- run:
name: ReferenceTests
no_output_timeout: 30m
command: |
git submodule update --init --recursive
./gradlew --no-daemon referenceTest
- capture_test_results
acceptanceTests:
parallelism: 6
executor: xl_machine_executor
steps:
- prepare
- attach_workspace:
at: ~/project
- run:
name: AcceptanceTests
no_output_timeout: 30m
command: |
CLASSNAMES=$(circleci tests glob "acceptance-tests/tests/src/test/java/**/*.java" \
| sed 's@.*/src/test/java/@@' \
| sed 's@/@.@g' \
| sed 's/.\{5\}$//' \
| circleci tests split --split-by=timings --timings-type=classname)
# Format the arguments to "./gradlew test"
GRADLE_ARGS=$(echo $CLASSNAMES | awk '{for (i=1; i<=NF; i++) print "--tests",$i}')
./gradlew --no-daemon acceptanceTest $GRADLE_ARGS
- capture_test_results
- capture_test_logs
acceptanceTestsQuorum:
parallelism: 1
executor: quorum_ats_executor
steps:
- attach_workspace:
at: ~/project
- setup_remote_docker:
version: 20.10.14
docker_layer_caching: true
- run:
name: Quorum Acceptance Tests
no_output_timeout: 5m
command: ./gradlew --no-daemon acceptanceTestsQuorum
- store_artifacts:
path: build/quorum-at
destination: quorum-at-artifacts
- store_test_results:
path: build/quorum-at/openjdk-latest/reports/xml-report
buildDocker:
executor: besu_executor_med
steps:
- prepare
- attach_workspace:
at: ~/project
- setup_remote_docker
- run:
name: hadoLint_openjdk_11
command: |
docker run --rm -i hadolint/hadolint < docker/openjdk-11/Dockerfile
- run:
name: hadoLint_openjdk_11_debug
command: |
docker run --rm -i hadolint/hadolint < docker/openjdk-11-debug/Dockerfile
- run:
name: hadoLint_openjdk_latest
command: |
docker run --rm -i hadolint/hadolint < docker/openjdk-latest/Dockerfile
- run:
name: hadoLint_graalvm
command: |
docker run --rm -i hadolint/hadolint < docker/graalvm/Dockerfile
- run:
name: build image
command: |
./gradlew --no-daemon distDocker
- run:
name: test image
command: |
mkdir -p docker/reports
curl -L https://github.com/aelsabbahy/goss/releases/download/v0.3.9/goss-linux-amd64 -o ./docker/tests/goss-linux-amd64
./gradlew --no-daemon testDocker
buildArm64Docker:
executor: besu_arm64_executor_med
steps:
- prepare
- attach_workspace:
at: ~/project
- run:
name: hadoLint_openjdk_11
command: |
docker run --rm -i hadolint/hadolint < docker/openjdk-11/Dockerfile
- run:
name: hadoLint_openjdk_latest
command: |
docker run --rm -i hadolint/hadolint < docker/openjdk-latest/Dockerfile
- run:
name: hadoLint_graalvm
command: |
docker run --rm -i hadolint/hadolint < docker/graalvm/Dockerfile
- run:
name: build image
command: |
./gradlew --no-daemon distDocker
- run:
name: test image
command: |
mkdir -p docker/reports
curl -L https://github.com/aelsabbahy/goss/releases/download/v0.3.9/goss-linux-arm -o ./docker/tests/goss-linux-arm64
./gradlew --no-daemon testDocker
publish:
executor: besu_executor_med
steps:
- prepare
- attach_workspace:
at: ~/project
- run:
name: Publish
command: |
./gradlew --no-daemon artifactoryPublish
publishDocker:
executor: besu_executor_med
steps:
- prepare
- attach_workspace:
at: ~/project
- setup_remote_docker
- run:
name: Publish Docker
command: |
docker login --username "${DOCKER_USER_RW}" --password "${DOCKER_PASSWORD_RW}"
./gradlew --no-daemon "-Pbranch=${CIRCLE_BRANCH}" dockerUpload
publishArm64Docker:
executor: besu_arm64_executor_med
steps:
- prepare
- attach_workspace:
at: ~/project
- run:
name: Publish Docker
command: |
docker login --username "${DOCKER_USER_RW}" --password "${DOCKER_PASSWORD_RW}"
./gradlew --no-daemon "-Pbranch=${CIRCLE_BRANCH}" dockerUpload
manifestDocker:
executor: besu_executor_med
steps:
- prepare
- setup_remote_docker
- run:
name: Create and publish docker manifest
command: |
docker login --username "${DOCKER_USER_RW}" --password "${DOCKER_PASSWORD_RW}"
./gradlew --no-daemon "-Pbranch=${CIRCLE_BRANCH}" --parallel manifestDocker
workflows:
version: 2
default:
jobs:
- assemble
- unitTests:
requires:
- assemble
- testWindows:
requires:
- assemble
- referenceTests:
requires:
- assemble
- integrationTests:
requires:
- assemble
- acceptanceTests:
requires:
- assemble
- buildDocker:
requires:
- assemble
- buildArm64Docker:
requires:
- assemble
- publish:
filters:
branches:
only:
- main
- /^release-.*/
requires:
- assemble
- integrationTests
- unitTests
- acceptanceTests
- referenceTests
- buildDocker
- publishDocker:
filters:
branches:
only:
- main
- /^release-.*/
requires:
- assemble
- integrationTests
- unitTests
- acceptanceTests
- referenceTests
- buildDocker
context:
- besu-dockerhub-rw
- publishArm64Docker:
filters:
branches:
only:
- main
- /^release-.*/
requires:
- integrationTests
- unitTests
- acceptanceTests
- referenceTests
- buildArm64Docker
context:
- besu-dockerhub-rw
- manifestDocker:
filters:
branches:
only:
- main
- /^release-.*/
requires:
- publishDocker
- publishArm64Docker
context:
- besu-dockerhub-rw
nightly:
triggers:
- schedule:
cron: "0 19 * * *"
filters:
branches:
only:
- main
jobs:
- assemble
- acceptanceTestsQuorum:
requires:
- assemble
- dockerScan