-
Notifications
You must be signed in to change notification settings - Fork 30
/
circle.yml
365 lines (334 loc) · 10.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
version: 2.1
orbs:
win: circleci/[email protected]
executors:
linux-gcc-latest:
docker:
- image: ethereum/cpp-build-env:21-gcc-13
linux-clang-latest:
docker:
- image: ethereum/cpp-build-env:21-clang-17
macos:
macos:
xcode: 15.4.0
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_deps:
description: "Install dependencies"
steps:
- run:
name: "Install dependencies"
command: |
sudo apt -q update
sudo apt install -qy libgmp-dev
install_powerpc64:
steps:
- run:
name: "Install powerpc64 toolchain"
command: |
sudo apt -q update
sudo apt -qy install g++-powerpc64-linux-gnu
check_code_format:
steps:
- run:
name: "Check code format"
command: |
clang-format --version
git ls-files '*.hpp' '*.cpp' '*.h' '*.c' | xargs clang-format -i
git diff --color --exit-code
build_and_test:
description: "Build & Test"
steps:
- run:
name: "Environment"
command: |
CC=${CC:-cc}
CXX=${CXX:-cpp}
echo CC: $CC
echo CXX: $CXX
$CC --version
$CXX --version
cmake --version
- checkout
- run:
name: "Configure"
command: cmake -B ~/build -DCMAKE_COMPILE_WARNING_AS_ERROR=TRUE -DCMAKE_INSTALL_PREFIX=~/install -DCMAKE_BUILD_TYPE=$BUILD_TYPE $CMAKE_OPTIONS
- run:
name: "Build"
command: |
cmake --build ~/build --parallel
cmake --build ~/build --target package
- run:
name: "Test"
working_directory: ~/build
command: |
ctest -j4 --output-on-failure --schedule-random -R ${TESTS_FILTER:-'.*'}
- run:
name: "Install"
command: cmake --build ~/build --target install
benchmark:
description: "Benchmark"
steps:
- run:
name: "Benchmark"
working_directory: ~/build
command: test/intx-bench --benchmark_min_time=1x
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 -j $CMAKE_BUILD_PARALLEL_LEVEL --ignore-errors mismatch,unused --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: "Install codecov"
command: |
export CODECOV_VERSION=v0.7.1
curl -Os https://uploader.codecov.io/$CODECOV_VERSION/linux/codecov
curl -Os https://uploader.codecov.io/$CODECOV_VERSION/linux/codecov.SHA256SUM
curl -Os https://uploader.codecov.io/$CODECOV_VERSION/linux/codecov.SHA256SUM.sig
gpg --no-default-keyring --keyring trustedkeys.gpg --keyserver keyserver.ubuntu.com --receive-keys 27034E7FDB850E0BBC2C62FF806BB28AED779869
gpgv codecov.SHA256SUM.sig codecov.SHA256SUM
shasum -c codecov.SHA256SUM
chmod +x codecov
sudo mv codecov /usr/local/bin
- run:
name: "Upload to Codecov"
command: |
# Convert to relative paths
sed -i 's|$(pwd)/||' ~/build/coverage.lcov
codecov --flags <<parameters.flags>> --required --file ~/build/coverage.lcov -X gcov
jobs:
lint:
docker:
- image: ethereum/cpp-build-env:21-lint
steps:
- checkout
- check_code_format
build-minimal:
executor: linux-gcc-latest
steps:
- checkout
- run:
name: "Build package"
command: |
cmake -B ~/build -DCMAKE_COMPILE_WARNING_AS_ERROR=TRUE -DINTX_TESTING=OFF
cmake --build ~/build --target package
- run:
name: "Inspect package"
command: tar tvf ~/build/intx*.tar.gz
linux-gcc-coverage:
environment:
BUILD_TYPE: Coverage
TESTS_FILTER: unittests
executor: linux-gcc-latest
steps:
- install_deps
- build_and_test
- collect_coverage_gcc
- upload_coverage:
flags: gcc
linux-clang-coverage:
environment:
BUILD_TYPE: Coverage
TESTS_FILTER: unittests
executor: linux-clang-latest
steps:
- install_deps
- build_and_test
- run:
name: "Coverage"
working_directory: ~/build
command: |
mkdir coverage
find -name '*.profraw'
llvm-profdata merge *.profraw -o intx.profdata
llvm-cov report -use-color -instr-profile intx.profdata -Xdemangler llvm-cxxfilt test/intx-unittests
llvm-cov report -instr-profile intx.profdata -Xdemangler llvm-cxxfilt test/intx-unittests > coverage/report.txt
llvm-cov show -format=html -instr-profile intx.profdata -Xdemangler llvm-cxxfilt -region-coverage-lt=100 test/intx-unittests > coverage/missing.html
llvm-cov show -format=html -instr-profile intx.profdata -Xdemangler llvm-cxxfilt test/intx-unittests > coverage/full.html
llvm-cov export -instr-profile intx.profdata -format=lcov test/intx-unittests > coverage.lcov
genhtml coverage.lcov -o coverage -t $CIRCLE_PROJECT_REPONAME
- store_artifacts:
path: ~/build/coverage
destination: coverage
linux-clang-sanitizers:
environment:
BUILD_TYPE: RelWithDebInfo
CMAKE_OPTIONS: -DSANITIZE=address,undefined,implicit-conversion,nullability -DCMAKE_CXX_CLANG_TIDY=clang-tidy
UBSAN_OPTIONS: halt_on_error=1
executor: linux-clang-latest
steps:
- install_deps
- build_and_test
- benchmark
linux-gcc-sanitizers:
environment:
BUILD_TYPE: RelWithDebInfo
CMAKE_OPTIONS: -DSANITIZE=address,pointer-compare,pointer-subtract,leak,undefined
ASAN_OPTIONS: detect_invalid_pointer_pairs=2
UBSAN_OPTIONS: halt_on_error=1
executor: linux-gcc-latest
steps:
- install_deps
- build_and_test
- benchmark
powerpc64:
environment:
BUILD_TYPE: Release
CMAKE_OPTIONS: -DCMAKE_TOOLCHAIN_FILE=~/project/cmake/toolchains/powerpc64.cmake -DINTX_BENCHMARKING=OFF
executor: linux-gcc-latest
steps:
- install_powerpc64
- build_and_test
arm64:
environment:
BUILD_TYPE: Release
machine:
image: ubuntu-2204:2023.02.1
resource_class: arm.medium
steps:
- build_and_test
no-exceptions:
environment:
BUILD_TYPE: Release
CMAKE_OPTIONS: -DEXCEPTIONS=OFF -DRTTI=OFF
executor: linux-gcc-latest
steps:
- install_deps
- build_and_test
- benchmark
linux-32bit:
environment:
BUILD_TYPE: Release
CMAKE_OPTIONS: -DCMAKE_TOOLCHAIN_FILE=~/project/cmake/toolchains/32bit.cmake -DINTX_BENCHMARKING=OFF
docker:
- image: ethereum/cpp-build-env:21-gcc-13-multilib
steps:
- build_and_test
linux-32bit-coverage:
environment:
BUILD_TYPE: Coverage
CMAKE_OPTIONS: -DCMAKE_TOOLCHAIN_FILE=~/project/cmake/toolchains/32bit.cmake -DINTX_BENCHMARKING=OFF
TESTS_FILTER: unittests
docker:
- image: ethereum/cpp-build-env:21-gcc-13-multilib
steps:
- build_and_test
- collect_coverage_gcc
- upload_coverage:
flags: 32bit
fuzzing:
environment:
- BUILD_TYPE: Release
- CMAKE_OPTIONS: -DINTX_FUZZING=ON
executor: linux-clang-latest
steps:
- install_deps
- build_and_test
- benchmark
- restore_cache:
keys:
- corpus
- run:
name: "Fuzzing"
working_directory: ~/build
command: |
mkdir -p ~/corpus
test/intx-fuzzer ~/corpus -fork=4 -use_value_profile=1 -max_len=129 -runs=1000000
- save_cache:
key: corpus-{{ epoch }}
paths:
- ~/corpus
macos:
environment:
BUILD_TYPE: Release
executor: macos
steps:
- run:
name: "Install deps"
command: |
HOMEBREW_NO_AUTO_UPDATE=1 brew install cmake gmp
- build_and_test
- benchmark
windows-32bit:
executor: win/server-2022
steps:
- checkout
- 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 x86
cmake --version
cmake -S . -B ~/build -G Ninja -DCMAKE_COMPILE_WARNING_AS_ERROR=TRUE -DCMAKE_INSTALL_PREFIX=C:\install -DCMAKE_BUILD_TYPE=Release -DINTX_BENCHMARKING=OFF
- run:
name: 'Build'
shell: powershell
command: |
$ErrorActionPreference = "Stop"
& 'C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\Launch-VsDevShell.ps1' -Arch x86
cmake --build ~/build
- run:
name: 'Test'
shell: powershell
working_directory: ~/build
command: |
$ErrorActionPreference = "Stop"
& 'C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\Launch-VsDevShell.ps1' -Arch x86
ctest -j4 --output-on-failure --schedule-random
cmake-min:
docker:
- image: cimg/base:current-22.04
steps:
- install_cmake:
version: 3.16.3
- install_deps
- build_and_test
workflows:
version: 2
intx:
jobs:
- lint
- build-minimal
- linux-gcc-coverage
- linux-clang-coverage
- linux-clang-sanitizers
- linux-gcc-sanitizers
- no-exceptions
- linux-32bit
- linux-32bit-coverage
- fuzzing
- macos
- cmake-min
- arm64
- powerpc64
- windows-32bit