Skip to content

Commit 9e0090d

Browse files
committed
ci: compare clang-tidy against PR base
1 parent d255ec0 commit 9e0090d

2 files changed

Lines changed: 16 additions & 3 deletions

File tree

.github/workflows/build_and_test.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,10 @@ jobs:
5656
- name: clang-debug
5757
cc: clang
5858
cxx: clang++
59-
fetch_depth: 0
60-
build_args: --check_clang_tidy
59+
fetch_depth: 0 # fetch the PR target branch history for clang-tidy
60+
build_args: >-
61+
--check_clang_tidy
62+
--lint_git_target_commit "origin/${{ github.base_ref || github.event.repository.default_branch }}"
6163
steps:
6264
- name: Checkout paimon-cpp
6365
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1

ci/scripts/build_paimon.sh

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
set -eux
1818

1919
usage() {
20-
echo "Usage: $0 --source_dir <path> [--enable_asan] [--enable_ubsan] [--enable_tsan] [--check_clang_tidy] [--build_type <type>]"
20+
echo "Usage: $0 --source_dir <path> [--enable_asan] [--enable_ubsan] [--enable_tsan] [--check_clang_tidy] [--build_type <type>] [--lint_git_target_commit <commit-or-branch>]"
2121
}
2222

2323
source_dir=""
@@ -26,6 +26,7 @@ enable_ubsan="false"
2626
enable_tsan="false"
2727
check_clang_tidy="false"
2828
build_type="Debug"
29+
lint_git_target_commit="origin/main"
2930

3031
while [[ $# -gt 0 ]]; do
3132
case "$1" in
@@ -63,6 +64,15 @@ while [[ $# -gt 0 ]]; do
6364
build_type=$2
6465
shift 2
6566
;;
67+
--lint_git_target_commit)
68+
if [[ $# -lt 2 ]]; then
69+
echo "Missing value for --lint_git_target_commit" >&2
70+
usage >&2
71+
exit 1
72+
fi
73+
lint_git_target_commit=$2
74+
shift 2
75+
;;
6676
-h | --help)
6777
usage
6878
exit 0
@@ -126,6 +136,7 @@ CMAKE_ARGS=(
126136
"-DPAIMON_ENABLE_LUMINA=${ENABLE_LUMINA}"
127137
"-DPAIMON_ENABLE_LUCENE=ON"
128138
"-DPAIMON_ENABLE_TANTIVY=${ENABLE_TANTIVY}"
139+
"-DPAIMON_LINT_GIT_TARGET_COMMIT=${lint_git_target_commit}"
129140
)
130141

131142
if [[ "${enable_asan}" == "true" ]]; then

0 commit comments

Comments
 (0)