forked from ethereum/evmc
-
Notifications
You must be signed in to change notification settings - Fork 1
/
circle.yml
416 lines (389 loc) · 11.6 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
version: 2.1
executors:
linux-gcc-latest:
docker:
- image: ethereum/cpp-build-env:16-gcc-10
linux-clang-latest:
docker:
- image: ethereum/cpp-build-env:16-clang-11
commands:
install_doxygen:
steps:
- run:
name: "Install doxygen"
command: sudo apt-get -q update && sudo apt-get -qy install doxygen
build:
parameters:
build_type:
type: string
default: ""
toolchain:
type: string
default: ""
steps:
- run:
name: "Environment"
command: |
CC=${CC:-cc}
CXX=${CXX:-cpp}
echo CC: $CC
echo CXX: $CXX
$CC --version
$CXX --version
cmake --version
# Create the toolchain.info file for cache key.
echo '<<parameters.toolchain>>' >> toolchain.info
echo '<<parameters.build_type>>' >> 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: |
cmake ../project <<#parameters.build_type>>-DCMAKE_BUILD_TYPE=<<parameters.build_type>><</parameters.build_type>> <<#parameters.toolchain>>-DCMAKE_TOOLCHAIN_FILE=~/project/cmake/cable/toolchains/<<parameters.toolchain>>.cmake<</parameters.toolchain>> -DCMAKE_INSTALL_PREFIX=~/install -DEVMC_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 -- -j4
- run:
name: "Install"
command: cmake --build ~/build --target install
- run:
name: "Package"
command: |
cmake --build ~/build --target package_source
cmake --build ~/build --target package
mkdir ~/package
mv ~/build/evmc-*.tar.gz ~/package
- store_artifacts:
path: ~/package
destination: package
- persist_to_workspace:
root: ~/build
paths:
- bin/evmc-vmtester
- bin/evmc-example
test:
steps:
- run:
name: "Test"
command: |
cmake --build ~/build --target test -- ARGS="-j4 --schedule-random --output-on-failure"
jobs:
lint:
executor: linux-clang-latest
steps:
- checkout
- run:
name: "Check code format"
command: |
clang-format --version
find bindings examples include lib test tools -name '*.hpp' -o -name '*.cpp' -o -name '*.h' -o -name '*.c' | xargs clang-format -i
git diff --color --exit-code
- run:
name: "Run codespell"
command: |
codespell --quiet-level=4 --ignore-words=./.codespell-whitelist --skip=.git
- run:
name: "Check bumpversion"
command: |
export PATH="/home/builder/.local/bin:$PATH"
pip3 install bumpversion
bumpversion --dry-run --verbose major
bumpversion --dry-run --verbose minor
bumpversion --dry-run --verbose patch
- install_doxygen
- run:
name: "Test documentation"
command: |
cat Doxyfile | sed 's/HTML_OUTPUT = ./HTML_OUTPUT = ..\/docs/' | doxygen - > doxygen.log 2> doxygen.warnings
if [ -s doxygen.warnings ]; then
printf '\n\nDoxygen warnings:\n\n'
cat doxygen.warnings
exit 1
fi
cat doxygen.log
- store_artifacts:
path: ~/docs
destination: docs
upload-docs:
executor: linux-clang-latest
steps:
- checkout
- install_doxygen
- run:
name: "Generate documentation"
command: doxygen Doxyfile
- run:
name: "Upload documentation"
command: |
git config user.email "[email protected]"
git config user.name "Documentation Bot"
git add --all
git commit -m "Update docs"
git push -f "https://[email protected]/ethereum/evmc.git" HEAD:gh-pages
build-clang-coverage:
executor: linux-clang-latest
steps:
- checkout
- build:
build_type: Coverage
- test
- run:
name: "Collect coverage data"
working_directory: ~/build
command: |
find -name '*.profraw'
llvm-profdata merge *.profraw -o evmc.profdata
llvm-cov report -instr-profile evmc.profdata \
-object bin/evmc-unittests \
-object bin/evmc-vmtester
llvm-cov export -instr-profile evmc.profdata -format=lcov > evmc.lcov \
-object bin/evmc-unittests \
-object bin/evmc \
-object bin/evmc-vmtester
genhtml evmc.lcov -o coverage -t EVMC
- store_artifacts:
path: ~/build/coverage
destination: coverage
- run:
name: "Upload to Codecov"
command: |
# Convert to relative paths
sed -i 's|$(pwd)/||' ~/build/evmc.lcov
sudo pip3 install --upgrade --quiet --no-cache-dir codecov==2.1.11
codecov --file ~/build/evmc.lcov -X gcov
build-gcc8:
docker:
- image: ethereum/cpp-build-env:12-gcc-8
steps:
- checkout
- build
- test
build-gcc-sanitizers:
executor: linux-gcc-latest
environment:
CMAKE_OPTIONS: -DSANITIZE=address,undefined
steps:
- checkout
- build
- test
build-clang-sanitizers:
executor: linux-clang-latest
environment:
CMAKE_OPTIONS: -DSANITIZE=address,undefined,nullability,implicit-unsigned-integer-truncation,implicit-signed-integer-truncation
UBSAN_OPTIONS: halt_on_error=1
steps:
- checkout
- build
- test
build-clang9-asan:
docker:
- image: ethereum/cpp-build-env:12-clang-9
environment:
CMAKE_OPTIONS: -DSANITIZE=address
UBSAN_OPTIONS: halt_on_error=1
steps:
- checkout
- build
- test
build-gcc-min:
docker:
- image: ethereum/cpp-build-env:13-gcc-7
steps:
- checkout
- build
- test
build-clang-min:
docker:
- image: ethereum/cpp-build-env:13-clang-5
steps:
- checkout
- build
- test
build-gcc-32bit:
docker:
- image: ethereum/cpp-build-env:14-gcc-10-multilib
steps:
- checkout
- build:
toolchain: cxx11-32bit
- test
build-cmake-min:
docker:
- image: circleci/buildpack-deps:bionic
steps:
- run:
name: "Install default CMake"
command: sudo apt -q update && sudo apt -qy install cmake
- checkout
- build
- test
bindings-go-latest:
docker:
- image: circleci/golang
steps: &bindings-go-steps
- checkout
- run:
name: "Environment"
command: |
go version
go env
gcc --version
- run:
name: "Go Build"
command: |
go build -v ./bindings/go/evmc
go vet -v ./bindings/go/evmc
go generate -v ./bindings/go/evmc
go test -v ./bindings/go/evmc
- run:
name: "Go module integration test"
working_directory: test/gomod
command: |
test -z "$CIRCLE_PR_USERNAME" || { echo "Skip for PRs from forks"; exit 0; }
V=$CIRCLE_TAG
if [ -z $V ]; then
V=$CIRCLE_SHA1
fi
echo "version: $V"
go mod init evmc.ethereum.org/evmc_use
go get -v $(grep -o 'github.com/ethereum/evmc/v.*' ../../go.mod)@$V
go mod tidy -v
go mod graph
g++ -shared -I../../include ../../examples/example_vm/example_vm.cpp -o example-vm.so
go test -v
go mod graph
bindings-go-min:
docker:
- image: circleci/golang:1.11
steps: *bindings-go-steps
bindings-java:
docker:
- image: circleci/openjdk:13-buster
environment:
CMAKE_OPTIONS: -DEVMC_JAVA=ON
steps:
- run:
name: "Install CMake"
command: |
sudo apt -qq update
sudo apt -yq install cmake
- checkout
- build
- test
- run:
name: "Java Lint (spotlessCheck)"
command: cd bindings/java && make lint
- run:
name: "Java Build"
command: cd bindings/java && make clean build
- run:
name: "Java Test"
command: cd bindings/java && make test
bindings-rust:
docker:
- image: rust:1
steps:
- checkout
- run:
name: Update environment
command: |
apt -qq update
apt -yq install libclang-dev clang --no-install-recommends
rustup component add rustfmt
- run:
name: Check formatting
command: |
rustfmt --version
cargo fmt --all -- --check
- run:
name: Build
command: cargo build
- run:
name: Test
command: cargo test
- attach_workspace:
at: ~/build
- run:
name: Test with evmc-vmtester
command: |
~/build/bin/evmc-vmtester target/debug/libexamplerustvm.so
- run:
name: Test with evmc-example
command: |
~/build/bin/evmc-example target/debug/libexamplerustvm.so
- run:
name: Package evmc-sys
# NOTE: can not be run for evmc-vm and evmc-declare due to version dependencies
working_directory: bindings/rust/evmc-sys
command: cargo package
bindings-rust-asan:
docker:
- image: rust:1-bullseye
steps:
- checkout
- run:
name: Update environment
command: |
apt -qq update
apt -yq install llvm-11-dev clang-11 --no-install-recommends
rustup toolchain install nightly-x86_64-unknown-linux-gnu
- run:
name: Build
command: RUSTFLAGS="-Z sanitizer=address" ASAN_OPTIONS=detect_leaks=1 cargo +nightly build --target x86_64-unknown-linux-gnu
- run:
name: Test
command: RUSTFLAGS="-Z sanitizer=address -C opt-level=0" ASAN_OPTIONS=detect_leaks=1 cargo +nightly test --target x86_64-unknown-linux-gnu
- attach_workspace:
at: ~/build
- run:
name: Test with evmc-vmtester
command: |
~/build/bin/evmc-vmtester target/x86_64-unknown-linux-gnu/debug/libexamplerustvm.so
- run:
name: Test with evmc-example
command: |
~/build/bin/evmc-example target/x86_64-unknown-linux-gnu/debug/libexamplerustvm.so
workflows:
version: 2
evmc:
jobs:
- lint
- build-clang-coverage
- build-gcc8
- build-gcc-sanitizers
- build-clang-sanitizers
- build-clang9-asan
- build-gcc-min
- build-clang-min
- build-gcc-32bit
- build-cmake-min
- bindings-go-latest:
filters:
tags:
only: /.*/
- bindings-go-min:
filters:
tags:
only: /.*/
- bindings-java
- bindings-rust:
requires:
- build-gcc8
- bindings-rust-asan:
requires:
- build-clang9-asan
- upload-docs:
requires:
- lint
filters:
branches:
only:
- master