Skip to content

Commit 1361c5e

Browse files
committed
[libc++] Add format check to CI
Note: contrary to what I said previously, I didn't change .clang-format nor utils/generate_feature_test_macro_components.py script. Reviewed By: ldionne, #libc Differential Revision: https://reviews.llvm.org/D92229
1 parent be9889b commit 1361c5e

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

libcxx/utils/ci/buildkite-pipeline.yml

+13
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,19 @@
1515
#
1616

1717
steps:
18+
- label: "Format"
19+
command: "libcxx/utils/ci/run-buildbot check-format"
20+
artifact_paths:
21+
- "**/clang-format.patch"
22+
agents:
23+
queue: "libcxx-builders"
24+
retry:
25+
automatic:
26+
- exit_status: -1 # Agent was lost
27+
limit: 2
28+
soft_fail:
29+
- exit_status: 1
30+
1831
- label: "C++03"
1932
command: "libcxx/utils/ci/run-buildbot generic-cxx03"
2033
artifact_paths:

libcxx/utils/ci/run-buildbot

+16
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#===----------------------------------------------------------------------===##
99

1010
set -ex
11+
set -o pipefail
1112

1213
PROGNAME="$(basename "${0}")"
1314

@@ -105,6 +106,21 @@ function check-cxx-benchmarks() {
105106
}
106107

107108
case "${BUILDER}" in
109+
check-format)
110+
clean
111+
echo "+++ Checking formatting"
112+
# We need to set --extensions so that clang-format checks extensionless files.
113+
mkdir -p ${BUILD_DIR}
114+
git-clang-format \
115+
--binary /usr/bin/clang-format --diff \
116+
--extensions ',h,hh,hpp,hxx,c,cc,cxx,cpp' HEAD~1 \
117+
-- \
118+
libcxx/{benchmarks,include,src,test} \
119+
libcxxabi/{fuzz,include,src,test} \
120+
| tee ${BUILD_DIR}/clang-format.patch
121+
# Check if the diff is empty, fail otherwise.
122+
! grep -q '^--- a' ${BUILD_DIR}/clang-format.patch
123+
;;
108124
generic-cxx03)
109125
export CC=clang
110126
export CXX=clang++

0 commit comments

Comments
 (0)