-
Notifications
You must be signed in to change notification settings - Fork 50
/
circle.yml
388 lines (356 loc) · 11.8 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
defaults:
update-submodules: &update-submodules
run:
name: "Update git submodules"
command: |
git submodule update --init
environment-info: &environment-info
run:
name: "Environment info"
command: |
echo CXX: $CXX
echo Generator: $GENERATOR
cmake --version
echo CMake options: $CMAKE_OPTIONS
$CXX --version
$CXX --version >> toolchain
echo $GENERATOR >> toolchain
configure: &configure
run:
name: "Configure"
# Build "out-of-source" to have better coverage report
# (ninja is using relative paths otherwise).
working_directory: ~/build
command: |
cmake ../project -G "$GENERATOR" -DCMAKE_BUILD_TYPE=$BUILD_TYPE $CMAKE_OPTIONS
codespell: &codespell
run:
name: "Run codespell"
command: |
sudo pip3 install --upgrade pip setuptools
sudo pip3 install codespell
codespell --skip=".git"
build: &build
run:
name: "Build"
working_directory: ~/build
command: |
cmake --build . --target package -- -j $BUILD_PARALLEL_JOBS
mkdir -p ~/package
. hera/buildinfo.sh
mv hera.tar.gz ~/package/$PROJECT_NAME-$PROJECT_VERSION-$SYSTEM_NAME-$SYSTEM_PROCESSOR.tar.gz
store-package: &store-package
store_artifacts:
path: ~/package
destination: package
add-package-to-workspace: &add-package-to-workspace
persist_to_workspace:
root: ~/package
paths:
- "*"
save-deps-cache: &save-deps-cache
cache-save:
name: "Save dependencies cache"
key: &deps-cache-key deps-5-{{arch}}-{{checksum "toolchain"}}-{{checksum "cmake/ProjectBinaryen.cmake"}}
paths:
- ~/build/deps
restore-deps-cache: &restore-deps-cache
cache-restore:
name: "Restore dependencies cache"
key: *deps-cache-key
save-aleth-cache: &save-aleth-cache
save_cache:
key: &aleth-cache-key aleth-prebuilt-cache-{{arch}}-{{checksum "toolchain"}}-v1.8.0
paths:
- ~/build
- ~/.hunter
restore-aleth-cache: &restore-aleth-cache
restore_cache:
key: *aleth-cache-key
checkout-aleth: &checkout-aleth
run:
name: "Checkout aleth repo"
working_directory: ~/
command: |
git clone https://github.com/ethereum/aleth --branch v1.8.0 --single-branch --recurse-submodules --depth 1
link-hera: &link-hera
run:
name: "Link hera to prebuilt aleth"
working_directory: ~/project
# TODO: run cmake in hera dir with config flags -DHERA_DEBUGGING=ON
command: |
cd ..
echo "pwd: $(pwd)"
echo "listing files: $(ls -al)"
rm -rf ~/aleth/hera
ln -s ~/project ~/aleth/hera
build-aleth: &build-aleth
run:
name: "Build aleth with linked Hera"
working_directory: ~/project
# export PATH is an alternative to `make install`
command: |
cd ..
mkdir -p build && cd build
cmake ../aleth -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHERA=ON
cmake --build . -- -j $BUILD_PARALLEL_JOBS
echo "build finished."
echo 'export PATH=~/build/test:$PATH' >> $BASH_ENV
cd ../aleth
echo "aleth branch: $(git rev-parse --abbrev-ref HEAD) commit: $(git rev-parse HEAD)"
cd hera
echo "hera branch: $(git rev-parse --abbrev-ref HEAD) commit: $(git rev-parse HEAD)"
install-aleth: &install-aleth
run:
name: "Install aleth"
command: |
VER=1.8.0
OS=$(uname | tr '[:upper:]' '[:lower:]')
URL=https://github.com/ethereum/aleth/releases/download/v$VER/aleth-$VER-$OS-x86_64.tar.gz
echo $URL
curl -L $URL | sudo tar xz -C /usr/local
fetch-tests: &fetch-tests
run:
name: "Fetch eWASM tests"
command: |
git clone https://github.com/ewasm/tests -b wasm-tests --single-branch --depth 1
test: &test-binaryen
run:
name: "Test shared Hera (binaryen)"
command: |
export ASAN_OPTIONS=detect_leaks=0
SO=$([ $(uname) = Darwin ] && echo dylib || echo so)
if [[ $PRELOAD_ASAN ]]; then export LD_PRELOAD=/usr/lib/clang/8/lib/linux/libclang_rt.asan-x86_64.so; fi
testeth --version
testeth -t GeneralStateTests/stEWASMTests -- --testpath tests --vm ~/build/src/libhera.$SO --singlenet Byzantium --evmc engine=binaryen $TESTETH_OPTIONS
test-wabt: &test-wabt
run:
name: "Test shared Hera (wabt)"
command: |
SO=$([ $(uname) = Darwin ] && echo dylib || echo so)
if [[ $PRELOAD_ASAN ]]; then export LD_PRELOAD=/usr/lib/clang/8/lib/linux/libclang_rt.asan-x86_64.so; fi
testeth --version
testeth -t GeneralStateTests/stEWASMTests -- --testpath tests --vm ~/build/src/libhera.$SO --singlenet Byzantium --evmc engine=wabt $TESTETH_OPTIONS
test-wavm: &test-wavm
run:
name: "Test shared Hera (wavm)"
command: |
export ASAN_OPTIONS=detect_leaks=0
SO=$([ $(uname) = Darwin ] && echo dylib || echo so)
if [[ $PRELOAD_ASAN ]]; then export LD_PRELOAD=/usr/lib/clang/8/lib/linux/libclang_rt.asan-x86_64.so; fi
testeth --version
testeth -t GeneralStateTests/stEWASMTests -- --testpath tests --vm ~/build/src/libhera.$SO --singlenet Byzantium --evmc engine=wavm $TESTETH_OPTIONS
evmc-test: &evmc-test
run:
name: "Run evmc tests"
command: |
~/build/evmc/test/evmc-vmtester ~/build/src/libhera.so
evm2wasm-test: &evm2wasm-test
run:
name: "Run evm2wasm state tests (using runevm contract)"
command: |
curl -o /tmp/runevm.wasm -L https://github.com/axic/runevm/releases/download/0.1.0-alpha2/runevm.wasm
test "$(shasum /tmp/runevm.wasm)" = "f9c11823f34bc2910bfa457342e3d6d00801ea5f /tmp/runevm.wasm"
if [[ $PRELOAD_ASAN ]]; then export LD_PRELOAD=/usr/lib/clang/8/lib/linux/libclang_rt.asan-x86_64.so; fi
testeth --version
testeth -t GeneralStateTests/stExample -- --testpath tests --vm ~/build/src/libhera.so --singlenet Byzantium --evmc evm1mode=runevm --evmc sys:runevm=/tmp/runevm.wasm
# This works, but takes too much time (4 minutes)
# testeth -t GeneralStateTests/stStackTests -- --testpath tests --vm ~/build/src/libhera.so --singlenet Byzantium --evmc evm1mode=runevm --evmc sys:runevm=/tmp/runevm.wasm
testeth -t GeneralStateTests/stShift -- --testpath tests --vm ~/build/src/libhera.so --singlenet Byzantium --evmc evm1mode=runevm --evmc sys:runevm=/tmp/runevm.wasm
testeth -t GeneralStateTests/stCodeSizeLimit -- --testpath tests --vm ~/build/src/libhera.so --singlenet Byzantium --evmc evm1mode=runevm --evmc sys:runevm=/tmp/runevm.wasm
upload-coverage-data: &upload-coverage-data
run:
name: "Upload coverage data"
command: |
sudo pip3 install --upgrade --quiet --no-cache-dir codecov
codecov --required --gcov-root ~/build --gcov-exec gcov-8
version: 2
jobs:
linux-clang-shared-release: &linux-clang-shared
environment:
BUILD_TYPE: Release
CXX: clang++
CC: clang
GENERATOR: Ninja
BUILD_PARALLEL_JOBS: 4
CMAKE_OPTIONS: -DBUILD_SHARED_LIBS=ON -DHERA_DEBUGGING=OFF -DHERA_BINARYEN=ON -DHERA_WAVM=ON -DHERA_WABT=ON
docker:
- image: ethereum/cpp-build-env:9
steps:
- checkout
- *update-submodules
- *environment-info
- *restore-deps-cache
- *configure
- *build
- *store-package
- *save-deps-cache
- *install-aleth
- *add-package-to-workspace
- *fetch-tests
# - *test-binaryen
# - *test-wabt
# - *test-wavm
# - *evmc-test
# - *evm2wasm-test
linux-clang-shared-asan:
environment:
BUILD_TYPE: Release
CXX: clang++
CC: clang
GENERATOR: Ninja
BUILD_PARALLEL_JOBS: 4
CMAKE_OPTIONS: -DBUILD_SHARED_LIBS=ON -DHERA_DEBUGGING=OFF -DHERA_BINARYEN=ON -DHERA_WAVM=ON -DHERA_WABT=ON -DSANITIZE=address
# The ASan must the first loaded shared library. Force preloading it with this flag.
PRELOAD_ASAN: true
docker:
- image: ethereum/cpp-build-env:9
steps:
- checkout
- *update-submodules
- *environment-info
- *restore-deps-cache
- *configure
- *build
- *store-package
- *save-deps-cache
- *install-aleth
- *fetch-tests
# - *test-binaryen
# - *test-wabt
# - *test-wavm
# - *evmc-test
# - *evm2wasm-test
linux-gcc-shared-coverage:
environment:
- BUILD_TYPE: Coverage
- CXX: g++
- CC: gcc
- GENERATOR: Unix Makefiles
- BUILD_PARALLEL_JOBS: 4
- CMAKE_OPTIONS: -DBUILD_SHARED_LIBS=ON -DHERA_DEBUGGING=ON -DHERA_BINARYEN=ON -DHERA_WABT=ON -DHERA_WAVM=ON
- TESTETH_OPTIONS: --evmc benchmark=true
docker:
- image: ethereum/cpp-build-env:9
steps:
- checkout
- *update-submodules
- *environment-info
- *restore-deps-cache
- *configure
- *build
- *store-package
- *save-deps-cache
- *install-aleth
- *fetch-tests
# - *test-binaryen
# - *test-wabt
# - *test-wavm
- *upload-coverage-data
linux-gcc-static-debug:
environment:
- BUILD_TYPE: Debug
- CXX: g++
- CC: gcc
- GENERATOR: Unix Makefiles
- BUILD_PARALLEL_JOBS: 4
- CMAKE_OPTIONS: -DBUILD_SHARED_LIBS=OFF -DHERA_DEBUGGING=ON -DHERA_BINARYEN=ON -DHERA_WAVM=ON -DHERA_WABT=ON
docker:
- image: ethereum/cpp-build-env:9
steps:
- checkout
- *update-submodules
- *environment-info
- *restore-deps-cache
- *configure
- *build
- *store-package
- *save-deps-cache
macos:
environment:
- CC: cc
- CXX: c++
- GENERATOR: Unix Makefiles
- BUILD_PARALLEL_JOBS: 4
- CMAKE_OPTIONS: -DHERA_DEBUGGING=ON -DHERA_BINARYEN=ON -DHERA_WABT=ON
macos:
xcode: "11.7.0"
steps:
- run:
name: "Install system dependencies"
command: |
HOMEBREW_NO_AUTO_UPDATE=1 brew install -q cmake ninja leveldb
- checkout
- *update-submodules
- *environment-info
- *restore-deps-cache
- *configure
- *build
- *save-deps-cache
- *store-package
- *add-package-to-workspace
- *install-aleth
- *fetch-tests
# - *test-binaryen
# - *test-wabt
lint:
docker:
- image: ethereum/cpp-build-env:9
steps:
- checkout
- *codespell
test_ghr:
docker:
- image: circleci/golang
steps:
- run:
name: "Install ghr"
command: |
go install github.com/tcnksm/ghr@v0.13.0
ghr --version
# The job collects built packages (available in the workspace) and
# uploads them to the GitHub release matching the git tag.
deploy:
docker:
- image: circleci/golang
steps:
- run:
name: "Install ghr"
command: |
go install github.com/tcnksm/ghr@v0.13.0
- attach_workspace:
at: ~/package
- run:
name: "Create GitHub release"
command: |
ls -l ~/package
prerelease_flag=$([[ $CIRCLE_TAG =~ ^v[0-9\.]+$ ]] || echo '-prerelease')
name="Hera ${CIRCLE_TAG:1}"
echo $name
ghr -u ewasm -r hera -n "$name" $prerelease_flag $CIRCLE_TAG ~/package
workflows:
version: 2
hera:
jobs:
- test_ghr
- lint
- linux-clang-shared-asan
- linux-gcc-shared-coverage
- linux-gcc-static-debug
- linux-clang-shared-release:
filters:
tags:
only: /.*/
- macos:
filters:
tags:
only: /.*/
- deploy:
requires:
- linux-clang-shared-release
- macos
filters:
branches:
ignore: /.*/
tags:
only: /^v[0-9].*/