-
Notifications
You must be signed in to change notification settings - Fork 2
/
circle.yml
290 lines (268 loc) · 7.88 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
version: 2.1
executors:
linux:
docker:
- image: ethereum/cpp-build-env:11
linux-gcc-9:
docker:
- image: ethereum/cpp-build-env:12-gcc-9
linux-gcc-7:
docker:
- image: ethereum/cpp-build-env:12-gcc-7
linux-clang-9:
docker:
- image: ethereum/cpp-build-env:12-clang-9
macos:
macos:
xcode: 11.1.0
commands:
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
# 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 -- -j4
- run:
name: "Install"
command: cmake --build ~/build --target install
test:
description: "Test"
steps:
- run:
name: "Test"
working_directory: ~/build
command: ctest -R ${TESTS_FILTER:-'.*'} -j4 --schedule-random --output-on-failure
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-*
jobs:
lint:
docker:
- image: ethereum/cpp-build-env:11
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: "Run codespell"
command: |
codespell --quiet-level=4
release-linux:
executor: linux-gcc-9
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
state-tests:
environment:
TESTS_REV: develop
ALETH_REV: 1.8.0
docker:
- image: cimg/base:stable
steps:
- attach_workspace:
at: ~/package
- run:
name: "Unpack evmone"
background: true
command: tar xz < ~/package/evmone*.tar.gz
- run:
name: "Download Aleth"
background: true
command: curl -L https://github.com/ethereum/aleth/releases/download/v$ALETH_REV/aleth-$ALETH_REV-linux-x86_64.tar.gz | tar xz
- run:
name: "Download tests"
command: git clone --depth=1 --single-branch --branch $TESTS_REV https://github.com/ethereum/tests
- run:
name: "Run State Tests"
command: bin/testeth -t GeneralStateTests -- --testpath tests --vm lib/libevmone.so
gcc-min:
executor: linux-gcc-7
steps:
- build
- test
gcc-latest-coverage:
executor: linux-gcc-9
environment:
BUILD_TYPE: Coverage
steps:
- build
- run:
name: "Run unit tests"
working_directory: ~/build
command: |
bin/evmone-unittests
- run:
name: "Upload coverage data"
command: |
codecov --gcov-root ~/build
gcc-32bit:
executor: linux-gcc-9
environment:
TOOLCHAIN: cxx17-32bit
steps:
- run:
name: "Install GCC 32-bit"
command: |
sudo apt -q update && sudo apt -qy install g++-multilib
- build
- test
clang-latest-ubsan:
executor: linux-clang-9
environment:
CMAKE_OPTIONS: -DSANITIZE=undefined,implicit-conversion,nullability
UBSAN_OPTIONS: halt_on_error=1
# TODO: There is unresolved __ubsan_vptr_type_cache in evmone.so
TESTS_FILTER: unittests
steps:
- build
- test
clang-latest-coverage:
executor: linux-clang-9
environment:
BUILD_TYPE: Coverage
TESTS_FILTER: unittests
steps:
- build
- run:
name: "Run unit tests"
working_directory: ~/build
command: |
bin/evmone-unittests
- run:
name: "Coverage report"
working_directory: ~/build
command: |
mkdir ~/coverage
llvm-profdata merge *.profraw -o evmone.profdata
llvm-cov show lib/libevmone.so bin/evmone-unittests -Xdemangler llvm-cxxfilt -instr-profile=evmone.profdata -ignore-filename-regex=include/evmc -region-coverage-lt=100 -format=html > ~/coverage/missing.html
llvm-cov show lib/libevmone.so bin/evmone-unittests -Xdemangler llvm-cxxfilt -instr-profile=evmone.profdata -ignore-filename-regex=include/evmc -format=html > ~/coverage/full.html
llvm-cov report lib/libevmone.so bin/evmone-unittests -Xdemangler llvm-cxxfilt -instr-profile=evmone.profdata -ignore-filename-regex=include/evmc > ~/coverage/report.txt
llvm-cov report lib/libevmone.so bin/evmone-unittests -Xdemangler llvm-cxxfilt -instr-profile=evmone.profdata -ignore-filename-regex=include/evmc -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].*/
- state-tests:
requires:
- release-linux
- gcc-min
- gcc-latest-coverage
- clang-latest-ubsan
- clang-latest-coverage
- macos-asan
- gcc-32bit