-
Notifications
You must be signed in to change notification settings - Fork 312
466 lines (450 loc) · 16.5 KB
/
lint_and_test_cpp.yaml
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
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
name: Cpp CI
on:
# run on each pull request
pull_request:
types: [ synchronize, opened, reopened ]
branches:
- master
- 'v[0-9]+.*' # release branch
- ci-test # testing branch for github action
- '*dev'
paths:
- .github/actions/**
- .github/workflows/lint_and_test_cpp.yaml
- .github/workflows/thirdparty-regular-push.yml
- build_tools/pack_server.sh
- build_tools/pack_tools.sh
- docker/thirdparties-bin/**
- docker/thirdparties-src/**
- CMakeLists.txt
- cmake_modules/**
- run.sh
- src/**
- thirdparty/**
# for manually triggering workflow
workflow_dispatch:
env:
# Update the options to reduce the consumption of the disk space
ONEBOX_OPTS: disk_min_available_space_ratio=5
TEST_OPTS: disk_min_available_space_ratio=5;throttle_test_medium_value_kb=10;throttle_test_large_value_kb=25
jobs:
cpp_clang_format_linter:
name: Format
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: clang-format
run: ./build_tools/run-clang-format.py --clang-format-executable clang-format-14 -e ./src/shell/linenoise -e ./src/shell/sds -e ./thirdparty -r .
cpp_clang_tidy_linter:
name: Tidy
runs-on: ubuntu-22.04
container:
image: apache/pegasus:thirdparties-bin-ubuntu2204-${{ github.base_ref }}
steps:
- name: Install Softwares
run: |
apt-get update
apt-get install clang-tidy -y
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Rebuild thirdparty if needed
uses: "./.github/actions/rebuild_thirdparty_if_needed"
- name: clang-tidy
run: |
git config --global --add safe.directory $(pwd)
./run.sh build --test --compiler clang-14,clang++-14 -t debug --skip_thirdparty -c --cmake_only
./build_tools/clang_tidy.py --rev-range $(git log origin/${{ github.base_ref }} -n1 --format=format:"%H")
shell: bash
iwyu:
name: IWYU
needs:
- cpp_clang_format_linter
runs-on: ubuntu-latest
env:
USE_JEMALLOC: OFF
container:
image: apache/pegasus:thirdparties-bin-ubuntu2204-${{ github.base_ref }}
steps:
- uses: actions/checkout@v4
- name: Free Disk Space (Ubuntu)
run: |
.github/workflows/free_disk_space.sh
- name: Rebuild thirdparty if needed
uses: "./.github/actions/rebuild_thirdparty_if_needed"
- name: Build IWYU binary
run: |
mkdir iwyu && cd iwyu && git clone https://github.com/include-what-you-use/include-what-you-use.git
cd include-what-you-use && git checkout clang_14
cd .. && mkdir build && cd build && cmake -G "Unix Makefiles" -DCMAKE_PREFIX_PATH=/usr/lib/llvm-14 ../include-what-you-use
make -j $(nproc)
- name: Check IWYU
run: |
PWD=`pwd`
./run.sh build --test --compiler clang-14,clang++-14 -j $(nproc) -t release --iwyu ${PWD}/iwyu/build/bin/include-what-you-use --skip_thirdparty
python3 iwyu/include-what-you-use/fix_includes.py --blank_lines --reorder --nocomments --nosafe_headers --separate_project_includes="<tld>" --ignore_re="thrift-gen|rrdb_types|layer2_types|metrics_test.cpp" --dry_run < build/latest/iwyu.out
python3 iwyu/include-what-you-use/fix_includes.py --blank_lines --reorder --nocomments --nosafe_headers --separate_project_includes="<tld>" --ignore_re="thrift-gen|rrdb_types|layer2_types|metrics_test.cpp" --dry_run < build/latest/iwyu.out | egrep "IWYU edited 0 files on your behalf"
build_Release:
name: Build Release
needs:
- cpp_clang_format_linter
runs-on: ubuntu-latest
env:
USE_JEMALLOC: OFF
ARTIFACT_NAME: release
BUILD_OPTIONS: -t release --test
container:
image: apache/pegasus:thirdparties-bin-test-ubuntu2204-${{ github.base_ref }}
steps:
- name: Clone code
uses: actions/checkout@v4
- name: Rebuild thirdparty if needed
uses: "./.github/actions/rebuild_thirdparty_if_needed"
- name: Build Pegasus
uses: "./.github/actions/build_pegasus"
- name: Upload artifact
uses: "./.github/actions/upload_artifact"
test_Release:
name: Test Release
strategy:
fail-fast: false
matrix:
test_module:
- backup_restore_test
- base_api_test
- base_test
- bulk_load_test
# TODO(wangdan): Since the hotspot detection depends on the perf-counters system which
# is being replaced with the new metrics system, its test will fail. Temporarily disable
# the test and re-enable it after the hotspot detection is migrated to the new metrics
# system.
# - detect_hotspot_test
- dsn_aio_test
- dsn_block_service_test
- dsn_client_test
- dsn.failure_detector.tests
- dsn_http_test
- dsn_meta_state_tests
- dsn.meta.test
- dsn_nfs_test
# TODO(wangdan): Since builtin_counters (memused.virt and memused.res) for perf-counters
# have been removed and dsn_perf_counter_test depends on them, disable it.
# - dsn_perf_counter_test
- dsn_ranger_tests
- dsn_replica_backup_test
- dsn_replica_bulk_load_test
- dsn_replica_dup_test
- dsn_replica_split_test
- dsn_rpc_tests
- dsn.replica.test
- dsn_replication_common_test
- dsn.replication.simple_kv
- dsn.rep_tests.simple_kv
- dsn_runtime_tests
- dsn_security_tests
- dsn_task_tests
- dsn_utils_tests
- dsn.zookeeper.tests
# TODO(yingchun): Disable it because we find it's too flaky, we will re-enable it after
# it has been optimized.
# - partition_split_test
- pegasus_geo_test
- pegasus_rproxy_test
- pegasus_unit_test
- recovery_test
- restore_test
- security_test
- throttle_test
needs: build_Release
runs-on: ubuntu-latest
env:
ARTIFACT_NAME: release
container:
image: apache/pegasus:thirdparties-bin-test-ubuntu2204-${{ github.base_ref }}
options: --cap-add=SYS_PTRACE
steps:
- uses: actions/checkout@v4
- name: Download artifact
uses: "./.github/actions/download_artifact"
- name: Run server tests
uses: "./.github/actions/run_server_tests"
build_ASAN:
name: Build ASAN
needs:
- cpp_clang_format_linter
runs-on: ubuntu-latest
env:
USE_JEMALLOC: OFF
ARTIFACT_NAME: release_address
BUILD_OPTIONS: --sanitizer address --disable_gperf --test
container:
image: apache/pegasus:thirdparties-bin-test-ubuntu2204-${{ github.base_ref }}
steps:
- uses: actions/checkout@v4
- name: Rebuild thirdparty if needed
uses: "./.github/actions/rebuild_thirdparty_if_needed"
- name: Build Pegasus
uses: "./.github/actions/build_pegasus"
- name: Upload artifact
uses: "./.github/actions/upload_artifact"
test_ASAN:
name: Test ASAN
strategy:
fail-fast: false
matrix:
test_module:
- backup_restore_test
- base_api_test
- base_test
- bulk_load_test
# TODO(wangdan): Since the hotspot detection depends on the perf-counters system which
# is being replaced with the new metrics system, its test will fail. Temporarily disable
# the test and re-enable it after the hotspot detection is migrated to the new metrics
# system.
# - detect_hotspot_test
- dsn_aio_test
- dsn_block_service_test
- dsn_client_test
- dsn.failure_detector.tests
- dsn_http_test
- dsn_meta_state_tests
- dsn.meta.test
- dsn_nfs_test
# TODO(wangdan): Since builtin_counters (memused.virt and memused.res) for perf-counters
# have been removed and dsn_perf_counter_test depends on them, disable it.
# - dsn_perf_counter_test
- dsn_ranger_tests
- dsn_replica_backup_test
- dsn_replica_bulk_load_test
- dsn_replica_dup_test
- dsn_replica_split_test
- dsn_rpc_tests
- dsn.replica.test
- dsn_replication_common_test
- dsn.replication.simple_kv
- dsn.rep_tests.simple_kv
- dsn_runtime_tests
- dsn_security_tests
- dsn_task_tests
- dsn_utils_tests
- dsn.zookeeper.tests
# TODO(yingchun): Disable it because we find it's too flaky, we will re-enable it after
# it has been optimized.
# - partition_split_test
- pegasus_geo_test
- pegasus_rproxy_test
- pegasus_unit_test
- recovery_test
- restore_test
- security_test
# TODO(yingchun): Disable it because we find it's too flaky, we will re-enable it after
# it has been optimized.
# - throttle_test
needs: build_ASAN
runs-on: ubuntu-latest
env:
ARTIFACT_NAME: release_address
container:
image: apache/pegasus:thirdparties-bin-test-ubuntu2204-${{ github.base_ref }}
options: --cap-add=SYS_PTRACE
steps:
- uses: actions/checkout@v4
- name: Download artifact
uses: "./.github/actions/download_artifact"
- name: Run server tests
uses: "./.github/actions/run_server_tests"
# TODO(yingchun): Build and test UBSAN version would cost a very long time, we will run these tests
# when we are going to release a stable version. So we disable them in regular CI
# before we find any way to reduce the time cost.
# build_UBSAN:
# name: Build UBSAN
# needs:
# - cpp_clang_format_linter
# runs-on: ubuntu-latest
# env:
# USE_JEMALLOC: OFF
# ARTIFACT_NAME: release_undefined
# BUILD_OPTIONS: --sanitizer undefined --disable_gperf --test
# container:
# image: apache/pegasus:thirdparties-bin-test-ubuntu2204-${{ github.base_ref }}
# steps:
# - uses: actions/checkout@v4
# - name: Rebuild thirdparty if needed
# uses: "./.github/actions/rebuild_thirdparty_if_needed"
# - name: Build Pegasus
# uses: "./.github/actions/build_pegasus"
# - name: Upload artifact
# uses: "./.github/actions/upload_artifact"
#
# test_UBSAN:
# name: Test UBSAN
# strategy:
# fail-fast: false
# matrix:
# test_module:
# - backup_restore_test
# - base_api_test
# - base_test
# - bulk_load_test
# # TODO(wangdan): Since the hotspot detection depends on the perf-counters system which
# # is being replaced with the new metrics system, its test will fail. Temporarily disable
# # the test and re-enable it after the hotspot detection is migrated to the new metrics
# # system.
# # - detect_hotspot_test
# - dsn_aio_test
# - dsn_block_service_test
# - dsn_client_test
# - dsn.failure_detector.tests
# - dsn_http_test
# - dsn_meta_state_tests
# - dsn.meta.test
# - dsn_nfs_test
# # TODO(wangdan): Since builtin_counters (memused.virt and memused.res) for perf-counters
# # have been removed and dsn_perf_counter_test depends on them, disable it.
# # - dsn_perf_counter_test
# - dsn_ranger_tests
# - dsn_replica_backup_test
# - dsn_replica_bulk_load_test
# - dsn_replica_dup_test
# - dsn_replica_split_test
# - dsn_rpc_tests
# - dsn.replica.test
# - dsn_replication_common_test
# - dsn.replication.simple_kv
# - dsn.rep_tests.simple_kv
# - dsn_runtime_tests
# - dsn_security_tests
# - dsn_task_tests
# - dsn_utils_tests
# - dsn.zookeeper.tests
# - partition_split_test
# - pegasus_geo_test
# - pegasus_rproxy_test
# - pegasus_unit_test
# - recovery_test
# - restore_test
# - security_test
# - throttle_test
# needs: build_UBSAN
# runs-on: ubuntu-latest
# env:
# ARTIFACT_NAME: release_undefined
# container:
# image: apache/pegasus:thirdparties-bin-test-ubuntu2204-${{ github.base_ref }}
# options: --cap-add=SYS_PTRACE
# steps:
# - uses: actions/checkout@v4
# - name: Download artifact
# uses: "./.github/actions/download_artifact"
# - name: Run server tests
# uses: "./.github/actions/run_server_tests"
build_with_jemalloc:
name: Build with jemalloc
needs:
- cpp_clang_format_linter
runs-on: ubuntu-latest
env:
USE_JEMALLOC: ON
ARTIFACT_NAME: release_jemalloc
BUILD_OPTIONS: -t release --use_jemalloc --test
container:
image: apache/pegasus:thirdparties-bin-test-jemallc-ubuntu2204-${{ github.base_ref }}
steps:
- uses: actions/checkout@v4
- name: Rebuild thirdparty if needed
uses: "./.github/actions/rebuild_thirdparty_if_needed"
# TODO(yingchun): Append "-m dsn_utils_tests" to the command if not needed to pack server or tools, for example, the dependencies are static linked.
- name: Build Pegasus
uses: "./.github/actions/build_pegasus"
- name: Upload artifact
uses: "./.github/actions/upload_artifact"
test_with_jemalloc:
name: Test with jemallc
strategy:
fail-fast: false
matrix:
test_module:
- dsn_utils_tests
needs: build_with_jemalloc
runs-on: ubuntu-latest
env:
ARTIFACT_NAME: release_jemalloc
container:
image: apache/pegasus:thirdparties-bin-test-jemallc-ubuntu2204-${{ github.base_ref }}
options: --cap-add=SYS_PTRACE
steps:
- uses: actions/checkout@v4
- name: Download artifact
uses: "./.github/actions/download_artifact"
- name: Run server tests
uses: "./.github/actions/run_server_tests"
build_release_on_macos:
name: Build Release on macOS
needs:
- cpp_clang_format_linter
runs-on: macos-12
steps:
- name: Install Softwares
run: |
# Preinstalled softwares: https://github.com/actions/virtual-environments/blob/main/images/macos/macos-12-Readme.md
brew install ccache
brew install [email protected]
- uses: actions/checkout@v4
- name: Setup cache
uses: actions/cache@v3
with:
path: |
/Users/runner/Library/Caches/ccache
key: macos_build_ccache
restore-keys: |
macos_build_ccache
macos-12-thirdparty-bins
- name: Build thirdparty
working-directory: thirdparty
run: |
export JAVA_HOME="${JAVA_HOME_8_X64}"
mkdir -p build
cmake -DCMAKE_BUILD_TYPE=Release -B build/ -DROCKSDB_PORTABLE=1
cmake --build build/ -j $(sysctl -n hw.physicalcpu)
- name: Compilation
run: |
ccache -p
ccache -z
./run.sh build --test --skip_thirdparty -j $(sysctl -n hw.physicalcpu)
ccache -s
build_debug_on_centos7:
name: Build Debug on CentOS 7
needs:
- cpp_clang_format_linter
runs-on: ubuntu-latest
env:
USE_JEMALLOC: OFF
BUILD_OPTIONS: -t debug --test --separate_servers
PACK_OPTIONS: --separate_servers
ACTIONS_RUNNER_FORCE_ACTIONS_NODE_VERSION: node16
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
container:
image: apache/pegasus:thirdparties-bin-centos7-${{ github.base_ref }}
steps:
- name: Clone code
uses: actions/checkout@v3
- name: Rebuild thirdparty if needed
uses: "./.github/actions/rebuild_thirdparty_if_needed"
- name: Build Pegasus
uses: "./.github/actions/build_pegasus"