forked from ethereum/evmone
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcircle.yml
445 lines (415 loc) · 12.7 KB
/
circle.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
version: 2.1
executors:
lint:
docker:
- image: ethereum/cpp-build-env:17-lint
resource_class: small
environment:
CMAKE_BUILD_PARALLEL_LEVEL: 2
linux-gcc-latest:
docker:
- image: ethereum/cpp-build-env:17-gcc-11
environment:
CMAKE_BUILD_PARALLEL_LEVEL: 4
consensus-tests:
docker:
- image: ethereum/cpp-build-env:17-gcc-11
resource_class: xlarge
environment:
CMAKE_BUILD_PARALLEL_LEVEL: 8
linux-gcc-min:
docker:
- image: ethereum/cpp-build-env:15-gcc-8
resource_class: small
environment:
CMAKE_BUILD_PARALLEL_LEVEL: 2
linux-clang-latest:
docker:
- image: ethereum/cpp-build-env:17-clang-13
environment:
CMAKE_BUILD_PARALLEL_LEVEL: 4
linux-clang-min:
docker:
- image: ethereum/cpp-build-env:15-clang-9
resource_class: small
environment:
CMAKE_BUILD_PARALLEL_LEVEL: 2
macos:
macos:
xcode: 13.2.0
environment:
CMAKE_BUILD_PARALLEL_LEVEL: 2
commands:
build_silkworm:
parameters:
branch:
type: string
default: master
commit:
type: string
steps:
- run:
# Fix fixes the cache restore step in case the silkworm dir does not exist
name: "Make Silkworm dir"
command: mkdir -p ~/silkworm
- restore_cache:
name: "Restore Silkworm cache (<<parameters.branch>>-<<parameters.commit>>)"
key: &silkworm-cache-key silkworm-<<parameters.branch>>-<<parameters.commit>>
- run:
name: "Check Silkworm cache"
command: |
if [ -f ~/silkworm/consensus ]; then
echo 'Cached Silkworm binary available - skip build.'
else
echo 'export SILKWORM_BUILD=true' >> $BASH_ENV
fi
- run:
name: "Install GMP-dev"
command: |
[ "$SILKWORM_BUILD" = true ] || exit 0
sudo apt-get -q update && sudo apt-get -qy install --no-install-recommends libgmp-dev
- run:
name: "Checkout Silkworm"
working_directory: ~/silkworm/src
command: |
[ "$SILKWORM_BUILD" = true ] || exit 0
git clone --no-checkout --single-branch https://github.com/torquem-ch/silkworm.git . --branch <<parameters.branch>>
git checkout <<parameters.commit>>
git submodule update --init --recursive --progress
- run:
name: "Configure Silkworm"
working_directory: ~/silkworm
command: |
[ "$SILKWORM_BUILD" = true ] || exit 0
cmake -S src -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=$(pwd)
- run:
name: "Build Silkworm cmd/consensus"
working_directory: ~/silkworm
command: |
[ "$SILKWORM_BUILD" = true ] || exit 0
cmake --build build --target consensus
- save_cache:
name: "Save Silkworm cache"
key: *silkworm-cache-key
paths:
- ~/silkworm/consensus
download_consensus_tests:
parameters:
rev:
type: string
steps:
- run:
name: "Download consensus tests: <<parameters.rev>>"
working_directory: ~/tests
command: curl -L https://github.com/ethereum/tests/archive/<<parameters.rev>>.tar.gz | tar -xz --strip=1
build:
description: "Build"
steps:
- checkout
- run:
name: "Update submodules"
command: git submodule update --init --recursive
- run:
name: "Environment"
command: |
CC=${CC:-cc}
CXX=${CXX:-cpp}
echo CC: $CC
echo CXX: $CXX
$CC --version
$CXX --version
cmake --version
echo CMAKE_BUILD_PARALLEL_LEVEL: $CMAKE_BUILD_PARALLEL_LEVEL
# Create the toolchain.info file for cache key.
echo $TOOLCHAIN >> toolchain.info
$CXX --version >> toolchain.info
- restore_cache:
name: "Restore Hunter cache"
key: &hunter-cache-key hunter-{{arch}}-{{checksum "toolchain.info"}}-{{checksum "cmake/Hunter/init.cmake"}}
- run:
name: "Configure"
working_directory: ~/build
command: |
if [ "$TOOLCHAIN" ]; then
export toolchain_option="-DTOOLCHAIN=$TOOLCHAIN"
fi
cmake ../project $toolchain_option -DCMAKE_INSTALL_PREFIX=~/install -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DEVMONE_TESTING=ON $CMAKE_OPTIONS
- save_cache:
name: "Save Hunter cache"
key: *hunter-cache-key
paths:
- ~/.hunter/_Base/Cache
- run:
name: "Build"
command: cmake --build ~/build
- run:
name: "Install"
command: cmake --build ~/build --target install
test:
description: "Test"
steps:
- run:
name: "Test"
working_directory: ~/build
command: ctest -R ${TESTS_FILTER:-'.*'} --schedule-random --output-on-failure --parallel $CMAKE_BUILD_PARALLEL_LEVEL
collect_coverage_gcc:
description: "Collect coverage data (GCC)"
steps:
- run:
name: "Collect coverage data (GCC)"
working_directory: ~/build
command: |
lcov --capture --directory . --output-file coverage.lcov --exclude='/usr/*' --exclude="$HOME/.hunter/*" --exclude="$PWD/_deps/*"
lcov --zerocounters --directory .
rm -rf ~/coverage
genhtml coverage.lcov --output-directory ~/coverage --title $CIRCLE_PROJECT_REPONAME
- store_artifacts:
path: ~/coverage
destination: coverage
upload_coverage:
description: "Upload coverage data"
parameters:
flags:
type: string
steps:
- run:
name: "Upgrade codecov"
command: sudo pip3 install --upgrade --quiet --no-cache-dir codecov
- run:
name: "Upload to Codecov"
command: |
# Convert to relative paths
sed -i 's|$(pwd)/||' ~/build/coverage.lcov
counter=1
until codecov --flags <<parameters.flags>> --required --file ~/build/coverage.lcov -X gcov || [ $counter = 5 ]; do
counter=$((counter+1))
sleep 1
echo "Try #$counter..."
done
package:
description: "Make package"
steps:
- run:
name: "Build Package"
working_directory: ~/package
command: cmake --build ~/build --target package && mv ~/build/evmone*.tar.gz* .
- store_artifacts:
path: ~/package
destination: package
- persist_to_workspace:
root: ~/package
paths:
- evmone-*
unpack_package:
steps:
- attach_workspace:
at: ~/package
- run:
name: "Unpack evmone"
working_directory: ~/package
command: tar xz < evmone*.tar.gz
jobs:
lint:
executor: lint
steps:
- checkout
- run:
name: "Check code format"
command: |
clang-format --version
find include lib test -name '*.hpp' -o -name '*.cpp' -o -name '*.h' -o -name '*.c' | xargs clang-format -i
git diff --color --exit-code
- run:
name: "Check spelling"
command: |
codespell --quiet-level=4 --skip=.git
release-linux:
executor: linux-gcc-latest
environment:
BUILD_TYPE: Release
steps:
- build
- test
- package
release-macos:
executor: macos
environment:
BUILD_TYPE: Release
steps:
- run:
name: "Install System Dependencies"
command: HOMEBREW_NO_AUTO_UPDATE=1 brew install cmake
- build
- test
- package
deploy:
docker:
- image: circleci/golang
steps:
- run:
name: "Install GHR"
command: |
GO111MODULE=on go get github.com/tcnksm/[email protected]
- attach_workspace:
at: ~/package
- run:
name: "Create GitHub release"
command: |
ls -l ~/package
prerelease_flag=$([[ $CIRCLE_TAG =~ ^v[0-9\.]+$ ]] || echo '-prerelease')
name="$CIRCLE_PROJECT_REPONAME ${CIRCLE_TAG:1}"
echo $name
ghr -u $CIRCLE_PROJECT_USERNAME -r $CIRCLE_PROJECT_REPONAME -n "$name" $prerelease_flag $CIRCLE_TAG ~/package
consensus-tests:
executor: consensus-tests
environment:
BUILD_TYPE: Coverage
CMAKE_OPTIONS: -DEVMONE_TESTING=OFF -DCMAKE_CXX_FLAGS=-Og
steps:
- build
- build_silkworm:
commit: c75b07d26f19d1ce8439f9e73612cecf70dccaea
- download_consensus_tests:
rev: v10.3
- run:
name: "Silkworm-driven consensus tests (Advanced)"
working_directory: ~/build
no_output_timeout: 20m
command: ~/silkworm/consensus --evm lib/libevmone.so,O=2 --tests ~/tests --threads $CMAKE_BUILD_PARALLEL_LEVEL
- run:
name: "Silkworm-driven consensus tests (Baseline)"
working_directory: ~/build
no_output_timeout: 20m
command: ~/silkworm/consensus --evm lib/libevmone.so,O=0 --tests ~/tests --threads $CMAKE_BUILD_PARALLEL_LEVEL
- collect_coverage_gcc
- upload_coverage:
flags: consensus
gcc-min:
executor: linux-gcc-min
steps:
- build
- test
clang-min:
executor: linux-clang-min
steps:
- build
- test
gcc-latest-coverage:
executor: linux-gcc-latest
environment:
BUILD_TYPE: Coverage
TESTS_FILTER: unittests|integration
steps:
- build
- test
- collect_coverage_gcc
- upload_coverage:
flags: unittests
gcc-latest-memcheck:
executor: linux-gcc-latest
environment:
BUILD_TYPE: Debug
CMAKE_OPTIONS: -DCMAKE_CXX_FLAGS=-O1
steps:
- build
- test
- run:
name: "Install valgrind"
command: sudo apt-get -q update && sudo apt-get -qy install --no-install-recommends valgrind
- run:
name: "memcheck"
working_directory: ~/build
command: valgrind --vgdb=no --error-exitcode=99 bin/evmone-unittests
gcc-32bit:
docker:
- image: ethereum/cpp-build-env:17-gcc-11-multilib
resource_class: small
environment:
CMAKE_BUILD_PARALLEL_LEVEL: 2
TOOLCHAIN: cxx17-32bit
steps:
- build
- test
clang-latest-sanitizers:
executor: linux-clang-latest
environment:
CMAKE_OPTIONS: -DBUILD_SHARED_LIBS=NO -DSANITIZE=address,undefined,shift-exponent,implicit-conversion,nullability -DCMAKE_CXX_CLANG_TIDY=clang-tidy
UBSAN_OPTIONS: halt_on_error=1
steps:
- build
- test
clang-latest-coverage:
executor: linux-clang-latest
resource_class: small
environment:
CMAKE_BUILD_PARALLEL_LEVEL: 2
BUILD_TYPE: Coverage
TESTS_FILTER: unittests|integration
steps:
- build
# TODO: use `test` command
- run:
name: "Run unit tests"
working_directory: ~/build
command: |
bin/evmone-unittests
- run:
name: "Coverage report"
working_directory: ~/build
command: |
ARGS='lib/libevmone.so -Xdemangler llvm-cxxfilt -instr-profile=evmone.profdata -ignore-filename-regex=include/evmc'
SHOW_ARGS='-format=html -show-branches=count -show-regions -show-expansions'
mkdir ~/coverage
llvm-profdata merge *.profraw -o evmone.profdata
llvm-cov show $ARGS $SHOW_ARGS > ~/coverage/full.html
llvm-cov show $ARGS $SHOW_ARGS -region-coverage-lt=100 > ~/coverage/missing.html
llvm-cov report $ARGS > ~/coverage/report.txt
llvm-cov report $ARGS -use-color
- store_artifacts:
path: ~/coverage
destination: coverage
macos-asan:
executor: macos
environment:
BUILD_TYPE: RelWithDebInfo
CMAKE_OPTIONS: -DSANITIZE=address
TESTS_FILTER: unittests
steps:
- run:
name: "Install System Dependencies"
command: HOMEBREW_NO_AUTO_UPDATE=1 brew install cmake
- build
- test
workflows:
version: 2
evmone:
jobs:
- lint
- release-linux:
filters:
tags:
only: /.*/
- release-macos:
filters:
branches:
ignore: /.*/
tags:
only: /.*/
- deploy:
requires:
- release-linux
- release-macos
filters:
branches:
ignore: /.*/
tags:
only: /^v[0-9].*/
- consensus-tests
- gcc-min
- clang-min
- gcc-latest-coverage
- gcc-latest-memcheck
- clang-latest-sanitizers
- clang-latest-coverage
- macos-asan
- gcc-32bit