-
Notifications
You must be signed in to change notification settings - Fork 285
/
circle.yml
693 lines (649 loc) · 20.2 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
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
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
version: 2.1
orbs:
codecov: codecov/codecov@5.0.0
win: circleci/windows@5.0
executors:
lint:
docker:
- image: ethereum/cpp-build-env:22-lint
resource_class: small
environment:
CMAKE_BUILD_PARALLEL_LEVEL: 2
linux-gcc-latest:
docker:
- image: ethereum/cpp-build-env:22-gcc-14
environment:
CMAKE_BUILD_PARALLEL_LEVEL: 4
linux-gcc-multilib:
docker:
- image: ethereum/cpp-build-env:22-gcc-14-multilib
resource_class: small
environment:
CMAKE_BUILD_PARALLEL_LEVEL: 2
linux-clang-xlarge:
docker:
- image: ethereum/cpp-build-env:22-clang-18
resource_class: xlarge
environment:
CMAKE_BUILD_PARALLEL_LEVEL: 8
linux-clang-2xlarge:
docker:
- image: ethereum/cpp-build-env:21-clang-17
resource_class: 2xlarge
environment:
CMAKE_BUILD_PARALLEL_LEVEL: 16
linux-gcc-min:
docker:
- image: ethereum/cpp-build-env:17-gcc-11
resource_class: small
environment:
CMAKE_BUILD_PARALLEL_LEVEL: 2
linux-clang-latest:
docker:
- image: ethereum/cpp-build-env:22-clang-18
environment:
CMAKE_BUILD_PARALLEL_LEVEL: 4
linux-clang-min:
docker:
- image: ethereum/cpp-build-env:19-clang-15
resource_class: small
environment:
CMAKE_BUILD_PARALLEL_LEVEL: 2
linux-base:
docker:
- image: cimg/base:edge-22.04
resource_class: small
environment:
CMAKE_BUILD_PARALLEL_LEVEL: 2
macos:
resource_class: macos.m1.large.gen1
macos:
xcode: 15.4.0
environment:
CMAKE_BUILD_PARALLEL_LEVEL: 8
macos-xcode-min:
resource_class: macos.m1.medium.gen1
macos:
xcode: 15.0.0
environment:
CMAKE_BUILD_PARALLEL_LEVEL: 4
commands:
install_cmake:
parameters:
version:
type: string
steps:
- run:
name: "Install CMake <<parameters.version>>"
working_directory: /usr/local
command: |
curl -L https://github.com/Kitware/CMake/releases/download/v<<parameters.version>>/cmake-<<parameters.version>>-linux-x86_64.tar.gz | sudo tar -xz --strip=1
install_riscv_toolchain:
steps:
- run:
name: "Install RISC-V Toolchain"
working_directory: /usr/local
command: |
curl -L https://github.com/riscv-collab/riscv-gnu-toolchain/releases/download/2023.07.07/riscv32-glibc-ubuntu-22.04-llvm-nightly-2023.07.07-nightly.tar.gz | sudo tar -xz
checkout_submodules:
steps:
- run:
name: "Update submodules"
command: git submodule update --init --recursive
download_execution_tests:
parameters:
repo:
type: string
default: "ethereum/tests"
rev:
type: string
default: develop
commit:
type: string
default: ""
legacy:
description: "Download also legacy tests"
type: boolean
default: true
steps:
- run:
name: "Download execution tests: <<parameters.rev>> <<parameters.commit>>"
working_directory: ~/tests
command: |
find . -delete
git clone --no-checkout --depth=100 --single-branch https://github.com/<<parameters.repo>> . --branch <<parameters.rev>>
<<#parameters.rev>>git checkout <<parameters.rev>><</parameters.rev>>
<<#parameters.commit>>git checkout <<parameters.commit>><</parameters.commit>>
- when:
condition: <<parameters.legacy>>
steps:
- run:
name: "Download legacy execution tests (git submodule)"
working_directory: ~/tests
command: git submodule update --init --recursive --depth=1 --progress
download_execution_spec_tests:
parameters:
repo:
type: string
default: ethereum/execution-spec-tests
release:
type: string
fixtures_suffix:
type: string
default: stable
steps:
- run:
name: "Download execution-spec-tests: <<parameters.release>>"
working_directory: ~/spec-tests
command: |
curl -L https://github.com/<<parameters.repo>>/releases/download/<<parameters.release>>/fixtures_<<parameters.fixtures_suffix>>.tar.gz | tar -xz
ls -l
build:
description: "Build"
steps:
- checkout
- checkout_submodules
- 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 build.info file for cache key.
echo $TOOLCHAIN >> build.info
echo $CMAKE_OPTIONS >> build.info
$CXX --version >> build.info
printf '\n-----------\nbuild.info:\n'
cat build.info
- restore_cache:
name: "Restore Hunter cache"
key: &hunter-cache-key hunter-{{arch}}-{{checksum "build.info"}}-{{checksum "cmake/Hunter/init.cmake"}}-{{checksum "cmake/Hunter/config.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"
shell: bash
working_directory: ~/build
command: ctest -R ${TESTS_FILTER:-'.*'} --schedule-random --output-on-failure --parallel $CMAKE_BUILD_PARALLEL_LEVEL --output-junit ~/test_results/evmone.xml
- store_test_results:
path: ~/test_results
collect_coverage_gcc:
description: "Collect coverage data (GCC)"
steps:
- run:
name: "Collect coverage data (GCC)"
working_directory: ~/build
# Use coveralls to eliminate branch stats (they need more work)
command: |
mkdir -p ~/coverage
gcovr --filter ~/project --coveralls coverage.json --html ~/coverage/coverage.html --html-nested ~/coverage/coverage.html
- store_artifacts:
path: ~/coverage
destination: coverage
upload_coverage:
description: "Upload coverage data"
parameters:
flags:
type: string
steps:
- codecov/upload:
plugins: noop
files: ../build/coverage.json
flags: <<parameters.flags>>
package:
description: "Make package"
steps:
- run:
name: "Build Package"
shell: bash
working_directory: ~/package
command: cmake --build ~/build --target package && mv ~/build/evmone-*.* .
- 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
- run:
name: "Export JSON tests"
working_directory: ~/package
command: tar -C ~/build/test/integration/export -cz fixtures > evmone-tests.tar.gz
- package
release-windows:
executor: win/server-2022
environment:
CMAKE_BUILD_TYPE: Release
CMAKE_BUILD_PARALLEL_LEVEL: 4
steps:
- checkout
- checkout_submodules
- run:
name: "Setup environment (bash)"
shell: bash
command: |
echo 'export PATH=$PATH:"/c/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/bin"' >> $BASH_ENV
- run:
name: 'Configure'
shell: powershell
command: |
$ErrorActionPreference = "Stop"
& 'C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\Launch-VsDevShell.ps1' -Arch amd64
which cmake
cmake -S . -B ~/build -G Ninja -DCMAKE_INSTALL_PREFIX=C:\install -DEVMONE_TESTING=ON
- run:
name: 'Build'
shell: powershell
command: |
$ErrorActionPreference = "Stop"
& 'C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\Launch-VsDevShell.ps1' -Arch amd64
cmake --build ~/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/ghr@v0.12.1
- 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
execution-spec-tests:
executor: linux-gcc-latest
environment:
BUILD_TYPE: Coverage
steps:
- build
- download_execution_spec_tests:
release: v3.0.0
- run:
name: "Execution spec tests (state_tests)"
working_directory: ~/build
command: >
bin/evmone-statetest ~/spec-tests/fixtures/state_tests
- run:
name: "Execution spec tests (blockchain_tests)"
working_directory: ~/build
command: >
bin/evmone-blockchaintest ~/spec-tests/fixtures/blockchain_tests
- download_execution_spec_tests:
release: pectra-devnet-3@v1.5.0
fixtures_suffix: pectra-devnet-3
- run:
name: "Execution spec tests (develop, state_tests)"
# Tests for in-development EVM revision currently passing.
working_directory: ~/spec-tests/fixtures/state_tests
command: >
~/build/bin/evmone-statetest
prague/eip2537_bls_12_381_precompiles
- run:
name: "Execution spec tests (develop, blockchain_tests)"
# Tests for in-development EVM revision currently passing.
working_directory: ~/spec-tests/fixtures/blockchain_tests
command: >
~/build/bin/evmone-blockchaintest
prague/eip2935_historical_block_hashes_from_state
- collect_coverage_gcc
- upload_coverage:
flags: execution_spec_tests
eof-execution-spec-tests:
executor: linux-gcc-latest
environment:
BUILD_TYPE: Coverage
steps:
- build
- download_execution_spec_tests:
release: eip7692@v2.0.0
fixtures_suffix: eip7692-osaka
- run:
name: "EOF pre-release execution spec tests (state_tests)"
working_directory: ~/build
command: >
bin/evmone-statetest ~/spec-tests/fixtures/state_tests/osaka
- run:
name: "EOF pre-release execution spec tests (blockchain_tests)"
working_directory: ~/build
command: >
bin/evmone-blockchaintest ~/spec-tests/fixtures/blockchain_tests/osaka
- run:
name: "EOF pre-release execution spec tests (eof_tests)"
working_directory: ~/build
command: >
bin/evmone-eoftest ~/spec-tests/fixtures/eof_tests
- collect_coverage_gcc
- upload_coverage:
flags: eof_execution_spec_tests
ethereum-tests:
executor: linux-gcc-latest
environment:
BUILD_TYPE: Coverage
steps:
- build
- download_execution_tests:
# Latest commit from the main "develop" branch of ethereum/tests.
commit: 4c87ebbf024a3e9ec842bcce90564f629a3bcd82
- run:
name: "State tests"
working_directory: ~/build
command: >
bin/evmone-statetest
~/tests/GeneralStateTests
~/tests/LegacyTests/Cancun/GeneralStateTests
~/tests/LegacyTests/Constantinople/GeneralStateTests
- run:
name: "EOF validation tests"
working_directory: ~/build
command: >
bin/evmone-eoftest ~/tests/EOFTests
- run:
name: "Blockchain tests (GeneralStateTests)"
working_directory: ~/build
command: >
bin/evmone-blockchaintest
--gtest_filter='*:-VMTests/vmPerformance.*:*.*Call50000_sha256:*.CALLBlake2f_MaxRounds'
~/tests/BlockchainTests/GeneralStateTests
- run:
name: "Blockchain tests (ValidBlocks)"
working_directory: ~/build
command: >
bin/evmone-blockchaintest
--gtest_filter='*:-bcMultiChainTest.*:bcTotalDifficultyTest.*:bcForkStressTest.ForkStressTest:bcGasPricerTest.RPC_API_Test:bcValidBlockTest.SimpleTx3LowS'
~/tests/BlockchainTests/ValidBlocks
~/tests/LegacyTests/Cancun/BlockchainTests/ValidBlocks
- collect_coverage_gcc
- upload_coverage:
flags: ethereum_tests
precompiles-silkpre:
executor: linux-gcc-latest
environment:
BUILD_TYPE: Coverage
CMAKE_OPTIONS: -DCMAKE_CXX_FLAGS=-Og -DEVMONE_PRECOMPILES_SILKPRE=1
steps:
- run:
name: "Install GMP"
command: sudo apt-get -q update && sudo apt-get -qy install libgmp-dev
- build
- download_execution_tests:
rev: v14.1
legacy: false
- run:
name: "State tests"
working_directory: ~/build
command: |
bin/evmone-statetest ~/tests/GeneralStateTests
- collect_coverage_gcc
- upload_coverage:
flags: ethereum_tests_silkpre
gcc-min:
executor: linux-gcc-min
steps:
- build
- test
clang-min:
executor: linux-clang-min
environment:
CMAKE_OPTIONS=-DEVMONE_X86_64_ARCH_LEVEL=3
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: "memcheck"
working_directory: ~/build
command: valgrind --vgdb=no --error-exitcode=99 bin/evmone-unittests
gcc-32bit:
executor: linux-gcc-multilib
environment:
TOOLCHAIN: cxx17-32bit
steps:
- build
- test
clang-latest-sanitizers:
executor: linux-clang-xlarge
environment:
CMAKE_OPTIONS: -DBUILD_SHARED_LIBS=NO -DSANITIZE=address,undefined,shift-exponent,implicit-conversion,nullability
UBSAN_OPTIONS: halt_on_error=1
steps:
- build
- test
clang-tidy:
executor: linux-clang-2xlarge
environment:
CMAKE_OPTIONS: -DCMAKE_CXX_CLANG_TIDY=clang-tidy -DCMAKE_CXX_FLAGS=-g0
BUILD_TYPE: Debug
steps:
- build
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
- test
- 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 -sparse *.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
fuzzing:
executor: linux-clang-xlarge
environment:
CMAKE_OPTIONS: -DEVMONE_FUZZING=ON
steps:
- build
- restore_cache:
name: "Restore fuzzing corpus"
key: fuzzing-corpus
- run:
name: "Run evmone-fuzzer"
working_directory: ~/build
command: |
bin/evmone-fuzzer -runs=5000000 -fork=$CMAKE_BUILD_PARALLEL_LEVEL -fork_corpus_groups=1 ~/corpus -create_missing_dirs=1 -max_len=100 -entropic_scale_per_exec_time=1 2>&1 | sed '/NEW_FUNC/d'
- save_cache:
name: "Save fuzzing corpus"
key: fuzzing-corpus-{{epoch}}
paths:
- ~/corpus
macos-asan:
executor: macos
environment:
BUILD_TYPE: RelWithDebInfo
CMAKE_OPTIONS: -DSANITIZE=address,undefined
TESTS_FILTER: unittests
steps:
- run:
name: "Install System Dependencies"
command: HOMEBREW_NO_AUTO_UPDATE=1 brew install cmake
- build
- test
xcode-min:
executor: macos-xcode-min
steps:
- run:
name: "Install System Dependencies"
command: HOMEBREW_NO_AUTO_UPDATE=1 brew install cmake
- build
- test
cmake-min:
executor: linux-base
steps:
- install_cmake:
version: 3.18.4
- build
- test
x86-64-v1:
executor: linux-gcc-latest
environment:
BUILD_TYPE: Release
QEMU_CPU: core2duo # The lowest 64-bit CPU I could find, but qemu64 should be good too.
steps:
- build
- run:
name: "Check evmone.so"
working_directory: ~/build
command: (! qemu-x86_64-static bin/evmc run --vm ./lib/libevmone.so,trace 6000 2>&1) | grep "CPU does not support"
- run:
name: "Check unittests"
working_directory: ~/build
command: (! qemu-x86_64-static bin/evmone-unittests 2>&1) | grep "CPU does not support"
riscv32:
executor: linux-gcc-latest
environment:
BUILD_TYPE: Release
CMAKE_OPTIONS: -DCMAKE_TOOLCHAIN_FILE=~/project/cmake/toolchains/riscv32.cmake
steps:
- install_riscv_toolchain
- build
- test
workflows:
version: 2
evmone:
jobs:
- lint
- clang-tidy
- release-linux:
filters:
tags:
only: /.*/
- release-windows:
filters:
tags:
only: /.*/
- release-macos:
filters:
tags:
only: /.*/
- deploy:
requires:
- release-linux
- release-windows
- release-macos
filters:
branches:
ignore: /.*/
tags:
only: /^v[0-9].*/
- execution-spec-tests
- eof-execution-spec-tests
- ethereum-tests
- precompiles-silkpre
- cmake-min
- gcc-min
- clang-min
- gcc-latest-coverage
- gcc-latest-memcheck
- clang-latest-sanitizers
- clang-latest-coverage
- macos-asan
- xcode-min
- gcc-32bit
- x86-64-v1
- riscv32
- fuzzing