[libcxx-commits] [libcxx] 1361c5e - [libc++] Add format check to CI
Marek Kurdej via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Feb 4 12:15:43 PST 2021
Author: Marek Kurdej
Date: 2021-02-04T21:15:37+01:00
New Revision: 1361c5e7d703607e4ae8bc48201ead4cdb5acdb9
URL: https://github.com/llvm/llvm-project/commit/1361c5e7d703607e4ae8bc48201ead4cdb5acdb9
DIFF: https://github.com/llvm/llvm-project/commit/1361c5e7d703607e4ae8bc48201ead4cdb5acdb9.diff
LOG: [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
Added:
Modified:
libcxx/utils/ci/buildkite-pipeline.yml
libcxx/utils/ci/run-buildbot
Removed:
################################################################################
diff --git a/libcxx/utils/ci/buildkite-pipeline.yml b/libcxx/utils/ci/buildkite-pipeline.yml
index b149a1400d6f..cd6ff77fb8ed 100644
--- a/libcxx/utils/ci/buildkite-pipeline.yml
+++ b/libcxx/utils/ci/buildkite-pipeline.yml
@@ -15,6 +15,19 @@
#
steps:
+ - label: "Format"
+ command: "libcxx/utils/ci/run-buildbot check-format"
+ artifact_paths:
+ - "**/clang-format.patch"
+ agents:
+ queue: "libcxx-builders"
+ retry:
+ automatic:
+ - exit_status: -1 # Agent was lost
+ limit: 2
+ soft_fail:
+ - exit_status: 1
+
- label: "C++03"
command: "libcxx/utils/ci/run-buildbot generic-cxx03"
artifact_paths:
diff --git a/libcxx/utils/ci/run-buildbot b/libcxx/utils/ci/run-buildbot
index 1fb09f3a91aa..56ece0218270 100755
--- a/libcxx/utils/ci/run-buildbot
+++ b/libcxx/utils/ci/run-buildbot
@@ -8,6 +8,7 @@
#===----------------------------------------------------------------------===##
set -ex
+set -o pipefail
PROGNAME="$(basename "${0}")"
@@ -105,6 +106,21 @@ function check-cxx-benchmarks() {
}
case "${BUILDER}" in
+check-format)
+ clean
+ echo "+++ Checking formatting"
+ # We need to set --extensions so that clang-format checks extensionless files.
+ mkdir -p ${BUILD_DIR}
+ git-clang-format \
+ --binary /usr/bin/clang-format --
diff \
+ --extensions ',h,hh,hpp,hxx,c,cc,cxx,cpp' HEAD~1 \
+ -- \
+ libcxx/{benchmarks,include,src,test} \
+ libcxxabi/{fuzz,include,src,test} \
+ | tee ${BUILD_DIR}/clang-format.patch
+ # Check if the
diff is empty, fail otherwise.
+ ! grep -q '^--- a' ${BUILD_DIR}/clang-format.patch
+;;
generic-cxx03)
export CC=clang
export CXX=clang++
More information about the libcxx-commits
mailing list