-
Notifications
You must be signed in to change notification settings - Fork 6
282 lines (275 loc) · 10.4 KB
/
ci.yml
File metadata and controls
282 lines (275 loc) · 10.4 KB
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
name: CI
on:
push:
branches:
- master
- release/*
pull_request:
branches:
- master
- trunk/*
- release/*
jobs:
linux-clang:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
flags: [
"-DCLANG_TIDY=ON -DCMAKE_BUILD_TYPE=Debug",
# build fuzzers and run 1 iteration (with fixed corpus) during ctest
"-DASAN=ON -DFUZZING=ON -DCMAKE_BUILD_TYPE=Debug",
"-DUBSAN=ON -DFUZZING=ON -DCMAKE_BUILD_TYPE=Debug",
"-DVBK_NO_THREADS=ON -DCMAKE_BUILD_TYPE=Debug",
"-DASAN=ON -DWITH_LEVELDB=ON -DWITH_C_WRAPPER=ON -DTESTING_GO=ON -DCMAKE_BUILD_TYPE=Debug",
"-DASAN=ON -DWITH_ROCKSDB=ON -DWITH_C_WRAPPER=ON -DTESTING_GO=ON -DCMAKE_BUILD_TYPE=Debug",
# release build with all dependencies with rocksdb
"-DWITH_ROCKSDB=ON -DWITH_C_WRAPPER=ON -DTESTING_GO=ON -DWITH_PYPOPTOOLS=ON -DCMAKE_BUILD_TYPE=Release",
# release build with all dependencies with leveldb
"-DWITH_LEVELDB=ON -DWITH_C_WRAPPER=ON -DTESTING_GO=ON -DWITH_PYPOPTOOLS=ON -DCMAKE_BUILD_TYPE=Release",
]
env:
CC: clang
CXX: clang++
CTEST_OUTPUT_ON_FAILURE: 1
VBK_FUZZ_CORPUS_DIR: ${{ github.workspace }}/fuzz-corpus
ASAN_OPTIONS: detect_container_overflow=1:verbosity=1:debug=1:detect_leaks=1:check_initialization_order=1:alloc_dealloc_mismatch=true:use_odr_indicator=true
UBSAN_OPTIONS: print_stacktrace=1
PKG_CONFIG_PATH: /usr/lib/pkgconfig
steps:
- uses: actions/checkout@v1
name: checkout
with:
submodules: recursive
clean: true
- name: checkout fuzz-corpus
uses: actions/checkout@v2
with:
repository: VeriBlock/fuzz-corpus
path: ${{ github.workspace }}/fuzz-corpus
- name: update apt-get
run: sudo apt-get update
- name: install build requirements
run: sudo apt-get install -y python3 python3-pip clang-tidy libboost-python-dev
- name: install new cmake
run: |
pip3 install cmake
- name: Prepare ccache timestamp
if: github.event_name == 'push' || github.event_name == 'pull_request'
id: ccache_cache_timestamp
run: |
echo "::set-output name=timestamp::`date +%s`}"
- name: ccache cache files
if: github.event_name == 'push' || github.event_name == 'pull_request'
uses: actions/cache@v1.1.0
with:
path: ~/.ccache
key: linux-ccache-matrix-${{ matrix.flags }}-${{ steps.ccache_cache_timestamp.outputs.timestamp }}
restore-keys: |
linux-ccache-matrix-${{ matrix.flags }}-
linux-ccache-matrix-
- name: cmake
run: cmake . -Bbuild ${{ matrix.flags }}
- name: build
run: cmake --build build --parallel 2
- name: install
run: sudo cmake --install build
- name: test
run: cd build && ctest -j2
linux-gcc:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
flags: [
"-DASAN=ON -DWITH_LEVELDB=ON -DWITH_C_WRAPPER=ON -DTESTING_GO=ON -DCMAKE_BUILD_TYPE=Debug",
"-DASAN=ON -DWITH_ROCKSDB=ON -DWITH_C_WRAPPER=ON -DTESTING_GO=ON -DCMAKE_BUILD_TYPE=Debug",
# release build with all dependencies with rocksdb
"-DWITH_ROCKSDB=ON -DWITH_C_WRAPPER=ON -DTESTING_GO=ON -DWITH_PYPOPTOOLS=ON -DCMAKE_BUILD_TYPE=Release",
# release build with all dependencies with leveldb
"-DWITH_LEVELDB=ON -DWITH_C_WRAPPER=ON -DTESTING_GO=ON -DWITH_PYPOPTOOLS=ON -DCMAKE_BUILD_TYPE=Release",
]
env:
CC: gcc
CXX: g++
CTEST_OUTPUT_ON_FAILURE: 1
VBK_FUZZ_CORPUS_DIR: ${{ github.workspace }}/fuzz-corpus
ASAN_OPTIONS: detect_container_overflow=1:verbosity=1:debug=1:detect_leaks=1:check_initialization_order=1:alloc_dealloc_mismatch=true:use_odr_indicator=true
UBSAN_OPTIONS: print_stacktrace=1
PKG_CONFIG_PATH: /usr/lib/pkgconfig
steps:
- uses: actions/checkout@v1
name: checkout
with:
submodules: recursive
clean: true
- name: checkout fuzz-corpus
uses: actions/checkout@v2
with:
repository: VeriBlock/fuzz-corpus
path: ${{ github.workspace }}/fuzz-corpus
- name: update apt-get
run: sudo apt-get update
- name: install build requirements
run: sudo apt-get install -y python3 python3-pip libboost-python-dev ccache sudo
- name: install new cmake
run: pip3 install cmake
- name: Prepare ccache timestamp
if: github.event_name == 'push' || github.event_name == 'pull_request'
id: ccache_cache_timestamp
run: |
echo "::set-output name=timestamp::`date +%s`}"
- name: ccache cache files
if: github.event_name == 'push' || github.event_name == 'pull_request'
uses: actions/cache@v1.1.0
with:
path: ~/.ccache
key: linux-ccache-matrix-${{ matrix.flags }}-${{ steps.ccache_cache_timestamp.outputs.timestamp }}
restore-keys: |
linux-ccache-matrix-${{ matrix.flags }}-
linux-ccache-matrix-
- name: cmake
run: cmake . -Bbuild ${{ matrix.flags }}
- name: build
run: cmake --build build --parallel 2
- name: install
run: sudo cmake --install build
- name: test
run: cd build && ctest -j2
coverage:
runs-on: ubuntu-latest
env:
CC: gcc
CXX: g++
CTEST_OUTPUT_ON_FAILURE: 1
steps:
- uses: actions/checkout@v1
name: checkout
with:
submodules: recursive
clean: true
- name: Prepare ccache timestamp
if: github.event_name == 'push' || github.event_name == 'pull_request'
id: ccache_cache_timestamp
run: |
echo "::set-output name=timestamp::`date +%s`}"
- name: ccache cache files
if: github.event_name == 'push' || github.event_name == 'pull_request'
uses: actions/cache@v2
with:
path: ~/.ccache
key: linux-ccache-coverage-${{ steps.ccache_cache_timestamp.outputs.timestamp }}
restore-keys: |
linux-ccache-coverage-
- name: install new cmake
run: |
sudo apt-get update
sudo apt-get install -y python3 python3-pip ccache lcov
pip3 install -U cmake gcovr fastcov
- name: versions
run: |
$CC --version
gcov --version
- name: cmake
run: cmake . -Bbuild -DCOVERAGE=ON -DCODE_COVERAGE_VERBOSE=ON
- name: test
run: cmake --build build --parallel 2 --target ctest_coverage_lcov
- uses: codecov/codecov-action@v2
with:
directory: build
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
flags: unittests # optional
fail_ci_if_error: true # optional (default = false)
verbose: true # optional (default = false)
windows:
runs-on: windows-latest
env:
CTEST_OUTPUT_ON_FAILURE: 1
VCPKG_DEFAULT_TRIPLET: x64-windows
BUILDCACHE_DIR: ~\.cache
BUILDCACHE_DEBUG: 1
steps:
- uses: actions/checkout@v1
name: checkout
with:
submodules: recursive
clean: true
fetch-depth: 1
- name: Prepare ccache timestamp
if: github.event_name == 'push' || github.event_name == 'pull_request'
id: cache_timestamp
run: |
echo "::set-output name=timestamp::$(Get-Date -Format o | ForEach-Object { $_ -replace ":", "." })"
- name: cache files
if: github.event_name == 'push' || github.event_name == 'pull_request'
uses: actions/cache@v1.1.0
with:
path: ~\.cache
key: windows-buildcache-${{ steps.cache_timestamp.outputs.timestamp }}
restore-keys: |
windows-buildcache-
- name: install buildcache
shell: powershell
run: |
wget https://github.com/mbitsnbites/buildcache/releases/download/v0.18.0/buildcache-win-msvc.zip -outfile buildcache-win-msvc.zip
Expand-Archive .\buildcache-win-msvc.zip
mkdir C:\buildcache\
mv .\buildcache-win-msvc\bin\buildcache.exe C:\buildcache\
$oldPath = (Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH).path
$newPath = "$oldPath;c:\buildcache"
Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH -Value $newPath
- name: show buildcache config
run: |
$env:Path += ";c:\buildcache"
buildcache -s
- name: "Run vcpkg"
run: |
vcpkg install zlib
- name: cmake
run: |
$env:Path += ";c:\buildcache"
cmake . -Bbuild -A x64 -Dprotobuf_BUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=TRUE -DWERROR=OFF
- name: build
run: |
$env:Path += ";c:\buildcache"
cmake --build build --parallel 2
# TODO: takes TOO long to run tess
# - name: test
# run: cmake --build build --target RUN_TESTS
macos:
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
flags: ["-DCMAKE_BUILD_TYPE=Release -DASAN=ON"]
env:
CC: clang
CXX: clang++
CTEST_OUTPUT_ON_FAILURE: 1
ASAN_OPTIONS: detect_container_overflow=0:verbosity=1:debug=1:check_initialization_order=1:alloc_dealloc_mismatch=true:use_odr_indicator=true
steps:
- uses: actions/checkout@v1
name: checkout
with:
submodules: recursive
clean: true
- name: Prepare ccache timestamp
id: cache_timestamp
run: |
current_date=`date +%Y%m%d_%H%M%SZ`
echo "::set-output name=timestamp::${current_date}"
- name: ccache cache files
uses: actions/cache@v1.1.0
with:
path: ~/.ccache
key: macos-ccache-${{ steps.cache_timestamp.outputs.timestamp }}
restore-keys: |
macos-ccache-
- name: install ccache
run: brew install ccache
- name: cmake
run: cmake . -Bbuild ${{ matrix.flags }} -DCMAKE_BUILD_TYPE=Release
- name: build
run: cmake --build build --parallel 2
- name: test
run: cd build && ctest -j2