Skip to content

Commit 1de1ee9

Browse files
authored
[clang][ci] Move libc++ testing into the main PR pipeline (#93318)
Following the discussion in #93233 (comment), this patch merges `clang-ci` pipeline into main `GitHub Pull Requests` pipeline. `clang-ci` enables additional test coverage for Clang by compiling it, and then using it to compile and test libc++, libc++abi, and libunwind in C++03, C++26, and Clang Modules modes. Additional work we skip and total time savings we should see: 1. Checking out the repo to generate the clang-ci pipeline (2 minutes) 2. Building Clang (3.5 minutes) 3. Uploading the artifacts once, then downloading them 3 times and unpacking 3 times (0.5 minutes) Note that because previously-split jobs for each mode are now under a single Linux job, it now takes around 8 minutes more see the Linux CI results despite total time savings. The primary goal of this patch is to reduce the load of CI by removing duplicated work. I consider this goal achieved. I could keep the job parallelism we had (3 libc++ jobs depending on a main Linux job), but I don't consider it worth the effort and opportunity cost, because parallelism is not helping once the pool of builders is fully subscribed.
1 parent dba2aa2 commit 1de1ee9

File tree

3 files changed

+103
-95
lines changed

3 files changed

+103
-95
lines changed

.ci/generate-buildkite-pipeline-premerge

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,22 @@ function compute-projects-to-test() {
8585
done
8686
}
8787

88+
function compute-runtimes-to-test() {
89+
projects=${@}
90+
for project in ${projects}; do
91+
case ${project} in
92+
clang)
93+
for p in libcxx libcxxabi libunwind; do
94+
echo $p
95+
done
96+
;;
97+
*)
98+
# Nothing to do
99+
;;
100+
esac
101+
done
102+
}
103+
88104
function add-dependencies() {
89105
projects=${@}
90106
for project in ${projects}; do
@@ -178,6 +194,15 @@ function check-targets() {
178194
cross-project-tests)
179195
echo "check-cross-project"
180196
;;
197+
libcxx)
198+
echo "check-cxx"
199+
;;
200+
libcxxabi)
201+
echo "check-cxxabi"
202+
;;
203+
libunwind)
204+
echo "check-unwind"
205+
;;
181206
lldb)
182207
echo "check-all" # TODO: check-lldb may not include all the LLDB tests?
183208
;;
@@ -207,17 +232,6 @@ if echo "$modified_dirs" | grep -q -E "^(libcxx|libcxxabi|libunwind|runtimes|cma
207232
EOF
208233
fi
209234

210-
# If clang changed.
211-
if echo "$modified_dirs" | grep -q -E "^(clang)$"; then
212-
cat <<EOF
213-
- trigger: "clang-ci"
214-
build:
215-
message: "${buildMessage}"
216-
commit: "${BUILDKITE_COMMIT}"
217-
branch: "${BUILDKITE_BRANCH}"
218-
EOF
219-
fi
220-
221235
# Generic pipeline for projects that have not defined custom steps.
222236
#
223237
# Individual projects should instead define the pre-commit CI tests that suits their
@@ -231,6 +245,10 @@ linux_projects_to_test=$(exclude-linux $(compute-projects-to-test ${modified_pro
231245
linux_check_targets=$(check-targets ${linux_projects_to_test} | sort | uniq)
232246
linux_projects=$(add-dependencies ${linux_projects_to_test} | sort | uniq)
233247

248+
linux_runtimes_to_test=$(compute-runtimes-to-test ${linux_projects_to_test})
249+
linux_runtime_check_targets=$(check-targets ${linux_runtimes_to_test} | sort | uniq)
250+
linux_runtimes=$(echo ${linux_runtimes_to_test} | sort | uniq)
251+
234252
windows_projects_to_test=$(exclude-windows $(compute-projects-to-test ${modified_projects}))
235253
windows_check_targets=$(check-targets ${windows_projects_to_test} | sort | uniq)
236254
windows_projects=$(add-dependencies ${windows_projects_to_test} | sort | uniq)
@@ -255,7 +273,7 @@ if [[ "${linux_projects}" != "" ]]; then
255273
CC: 'clang'
256274
CXX: 'clang++'
257275
commands:
258-
- './.ci/monolithic-linux.sh "$(echo ${linux_projects} | tr ' ' ';')" "$(echo ${linux_check_targets})"'
276+
- './.ci/monolithic-linux.sh "$(echo ${linux_projects} | tr ' ' ';')" "$(echo ${linux_check_targets})" "$(echo ${linux_runtimes} | tr ' ' ';')" "$(echo ${linux_runtime_check_targets})"'
259277
EOF
260278
fi
261279

.ci/monolithic-linux.sh

Lines changed: 73 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ set -o pipefail
1818

1919
MONOREPO_ROOT="${MONOREPO_ROOT:="$(git rev-parse --show-toplevel)"}"
2020
BUILD_DIR="${BUILD_DIR:=${MONOREPO_ROOT}/build}"
21+
INSTALL_DIR="${BUILD_DIR}/install"
2122
rm -rf "${BUILD_DIR}"
2223

2324
ccache --zero-stats
@@ -49,8 +50,79 @@ cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \
4950
-D LLVM_ENABLE_LLD=ON \
5051
-D CMAKE_CXX_FLAGS=-gmlt \
5152
-D LLVM_CCACHE_BUILD=ON \
52-
-D MLIR_ENABLE_BINDINGS_PYTHON=ON
53+
-D MLIR_ENABLE_BINDINGS_PYTHON=ON \
54+
-D CMAKE_INSTALL_PREFIX="${INSTALL_DIR}"
5355

5456
echo "--- ninja"
5557
# Targets are not escaped as they are passed as separate arguments.
5658
ninja -C "${BUILD_DIR}" -k 0 ${targets}
59+
60+
runtimes="${3}"
61+
runtime_targets="${4}"
62+
63+
# Compiling runtimes with just-built Clang and running their tests
64+
# as an additional testing for Clang.
65+
if [[ "${runtimes}" != "" ]]; then
66+
if [[ "${runtime_targets}" == "" ]]; then
67+
echo "Runtimes to build are specified, but targets are not."
68+
exit 1
69+
fi
70+
71+
echo "--- ninja install-clang"
72+
73+
ninja -C ${BUILD_DIR} install-clang install-clang-resource-headers
74+
75+
RUNTIMES_BUILD_DIR="${MONOREPO_ROOT}/build-runtimes"
76+
INSTALL_DIR="${BUILD_DIR}/install"
77+
mkdir -p ${RUNTIMES_BUILD_DIR}
78+
79+
echo "--- cmake runtimes C++03"
80+
81+
cmake -S "${MONOREPO_ROOT}/runtimes" -B "${RUNTIMES_BUILD_DIR}" -GNinja \
82+
-D CMAKE_C_COMPILER="${INSTALL_DIR}/bin/clang" \
83+
-D CMAKE_CXX_COMPILER="${INSTALL_DIR}/bin/clang++" \
84+
-D LLVM_ENABLE_RUNTIMES="${runtimes}" \
85+
-D LIBCXX_CXX_ABI=libcxxabi \
86+
-D CMAKE_BUILD_TYPE=RelWithDebInfo \
87+
-D CMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
88+
-D LIBCXX_TEST_PARAMS="std=c++03" \
89+
-D LIBCXXABI_TEST_PARAMS="std=c++03"
90+
91+
echo "--- ninja runtimes C++03"
92+
93+
ninja -vC "${RUNTIMES_BUILD_DIR}" ${runtime_targets}
94+
95+
echo "--- cmake runtimes C++26"
96+
97+
rm -rf "${RUNTIMES_BUILD_DIR}"
98+
cmake -S "${MONOREPO_ROOT}/runtimes" -B "${RUNTIMES_BUILD_DIR}" -GNinja \
99+
-D CMAKE_C_COMPILER="${INSTALL_DIR}/bin/clang" \
100+
-D CMAKE_CXX_COMPILER="${INSTALL_DIR}/bin/clang++" \
101+
-D LLVM_ENABLE_RUNTIMES="${runtimes}" \
102+
-D LIBCXX_CXX_ABI=libcxxabi \
103+
-D CMAKE_BUILD_TYPE=RelWithDebInfo \
104+
-D CMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
105+
-D LIBCXX_TEST_PARAMS="std=c++26" \
106+
-D LIBCXXABI_TEST_PARAMS="std=c++26"
107+
108+
echo "--- ninja runtimes C++26"
109+
110+
ninja -vC "${RUNTIMES_BUILD_DIR}" ${runtime_targets}
111+
112+
echo "--- cmake runtimes clang modules"
113+
114+
rm -rf "${RUNTIMES_BUILD_DIR}"
115+
cmake -S "${MONOREPO_ROOT}/runtimes" -B "${RUNTIMES_BUILD_DIR}" -GNinja \
116+
-D CMAKE_C_COMPILER="${INSTALL_DIR}/bin/clang" \
117+
-D CMAKE_CXX_COMPILER="${INSTALL_DIR}/bin/clang++" \
118+
-D LLVM_ENABLE_RUNTIMES="${runtimes}" \
119+
-D LIBCXX_CXX_ABI=libcxxabi \
120+
-D CMAKE_BUILD_TYPE=RelWithDebInfo \
121+
-D CMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
122+
-D LIBCXX_TEST_PARAMS="enable_modules=clang" \
123+
-D LIBCXXABI_TEST_PARAMS="enable_modules=clang"
124+
125+
echo "--- ninja runtimes clang modules"
126+
127+
ninja -vC "${RUNTIMES_BUILD_DIR}" ${runtime_targets}
128+
fi

clang/utils/ci/buildkite-pipeline.yml

Lines changed: 0 additions & 82 deletions
This file was deleted.

0 commit comments

Comments
 (0)