[llvm] [CI] Make Premerge only Comment if Tests Failed (PR #169102)
Aiden Grossman via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 21 15:19:24 PST 2025
https://github.com/boomanaiden154 updated https://github.com/llvm/llvm-project/pull/169102
>From c8bbdf45262089384982a18ea0c3620c8fb62b93 Mon Sep 17 00:00:00 2001
From: Aiden Grossman <aidengrossman at google.com>
Date: Fri, 21 Nov 2025 21:58:48 +0000
Subject: [PATCH 1/7] [CI] Make Premerge only Comment if Tests Failed
---
.ci/monolithic-linux.sh | 43 ---------------------------------------
.ci/monolithic-windows.sh | 13 ------------
2 files changed, 56 deletions(-)
diff --git a/.ci/monolithic-linux.sh b/.ci/monolithic-linux.sh
index e6a59a2ae1306..e92287df90ae6 100755
--- a/.ci/monolithic-linux.sh
+++ b/.ci/monolithic-linux.sh
@@ -63,46 +63,3 @@ cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \
-D LLVM_ENABLE_WERROR=ON
start-group "ninja"
-
-if [[ -n "${targets}" ]]; then
- # Targets are not escaped as they are passed as separate arguments.
- ninja -C "${BUILD_DIR}" -k 0 ${targets} |& tee ninja.log
- cp ${BUILD_DIR}/.ninja_log ninja.ninja_log
-fi
-
-if [[ -n "${runtime_targets}" ]]; then
- start-group "ninja Runtimes"
-
- ninja -C "${BUILD_DIR}" ${runtime_targets} |& tee ninja_runtimes.log
- cp ${BUILD_DIR}/.ninja_log ninja_runtimes.ninja_log
-fi
-
-# Compiling runtimes with just-built Clang and running their tests
-# as an additional testing for Clang.
-if [[ -n "${runtime_targets_needs_reconfig}" ]]; then
- start-group "CMake Runtimes C++26"
-
- cmake \
- -D LIBCXX_TEST_PARAMS="std=c++26" \
- -D LIBCXXABI_TEST_PARAMS="std=c++26" \
- "${BUILD_DIR}"
-
- start-group "ninja Runtimes C++26"
-
- ninja -C "${BUILD_DIR}" ${runtime_targets_needs_reconfig} \
- |& tee ninja_runtimes_needs_reconfig1.log
- cp ${BUILD_DIR}/.ninja_log ninja_runtimes_needs_reconig.ninja_log
-
- start-group "CMake Runtimes Clang Modules"
-
- cmake \
- -D LIBCXX_TEST_PARAMS="enable_modules=clang" \
- -D LIBCXXABI_TEST_PARAMS="enable_modules=clang" \
- "${BUILD_DIR}"
-
- start-group "ninja Runtimes Clang Modules"
-
- ninja -C "${BUILD_DIR}" ${runtime_targets_needs_reconfig} \
- |& tee ninja_runtimes_needs_reconfig2.log
- cp ${BUILD_DIR}/.ninja_log ninja_runtimes_needs_reconfig2.ninja_log
-fi
diff --git a/.ci/monolithic-windows.sh b/.ci/monolithic-windows.sh
index 36941644c6a6c..c76c93dea9192 100755
--- a/.ci/monolithic-windows.sh
+++ b/.ci/monolithic-windows.sh
@@ -50,16 +50,3 @@ cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \
-D LLVM_ENABLE_RUNTIMES="${runtimes}"
start-group "ninja"
-
-if [[ -n "${targets}" ]]; then
- # Targets are not escaped as they are passed as separate arguments.
- ninja -C "${BUILD_DIR}" -k 0 ${targets} |& tee ninja.log
- cp ${BUILD_DIR}/.ninja_log ninja.ninja_log
-fi
-
-if [[ -n "${runtimes_targets}" ]]; then
- start-group "ninja runtimes"
-
- ninja -C "${BUILD_DIR}" -k 0 ${runtimes_targets} |& tee ninja_runtimes.log
- cp ${BUILD_DIR}/.ninja_log ninja_runtimes.ninja_log
-fi
>From 0eaec06172e3df4a97b924c934f4c4475cf5f609 Mon Sep 17 00:00:00 2001
From: Aiden Grossman <aidengrossman at google.com>
Date: Fri, 21 Nov 2025 22:39:42 +0000
Subject: [PATCH 2/7] fix
---
.ci/premerge_advisor_explain.py | 24 +++++++++---------------
1 file changed, 9 insertions(+), 15 deletions(-)
diff --git a/.ci/premerge_advisor_explain.py b/.ci/premerge_advisor_explain.py
index 69568895e9030..335f1a83aac3f 100644
--- a/.ci/premerge_advisor_explain.py
+++ b/.ci/premerge_advisor_explain.py
@@ -79,16 +79,6 @@ def main(
pr_number: The number of the PR associated with this run.
return_code: The numerical return code of ninja/CMake.
"""
- if return_code == 0:
- with open("comment", "w") as comment_file_handle:
- comment = get_comment(
- github_token,
- pr_number,
- ":white_check_mark: With the latest revision this PR passed "
- "the premerge checks.",
- )
- if "id" in comment:
- json.dump([comment], comment_file_handle)
junit_objects, ninja_logs = generate_test_report_lib.load_info_from_files(
build_log_files
)
@@ -114,10 +104,10 @@ def main(
advisor_response = requests.get(
PREMERGE_ADVISOR_URL, json=explanation_request, timeout=5
)
+ comment = None
if advisor_response.status_code == 200:
print(advisor_response.json())
- comments = [
- get_comment(
+ comment = get_comment(
github_token,
pr_number,
generate_test_report_lib.generate_report(
@@ -128,11 +118,15 @@ def main(
failure_explanations_list=advisor_response.json(),
),
)
- ]
- with open("comments", "w") as comment_file_handle:
- json.dump(comments, comment_file_handle)
else:
print(advisor_response.reason)
+ if comment:
+ if return_code == 0 and "id" not in comment:
+ # If the job succeeds and there is not an existing comment, we
+ # should not write one to reduce noise.
+ return
+ with open("comments", "w") as comment_file_handle:
+ json.dump([comment], comment_file_handle)
if __name__ == "__main__":
>From a1ed604637e826027fa9c8b12a562069de1b7320 Mon Sep 17 00:00:00 2001
From: Aiden Grossman <aidengrossman at google.com>
Date: Fri, 21 Nov 2025 22:47:16 +0000
Subject: [PATCH 3/7] fix
---
.ci/premerge_advisor_explain.py | 56 +++++++++++++++++----------------
1 file changed, 29 insertions(+), 27 deletions(-)
diff --git a/.ci/premerge_advisor_explain.py b/.ci/premerge_advisor_explain.py
index 335f1a83aac3f..775c5604307cd 100644
--- a/.ci/premerge_advisor_explain.py
+++ b/.ci/premerge_advisor_explain.py
@@ -95,38 +95,40 @@ def main(
explanation_request["failures"].append(
{"name": name, "message": failure_messsage}
)
- else:
+ elif return_code != 0:
ninja_failures = generate_test_report_lib.find_failure_in_ninja_logs(ninja_logs)
for name, failure_message in ninja_failures:
explanation_request["failures"].append(
{"name": name, "message": failure_message}
)
- advisor_response = requests.get(
- PREMERGE_ADVISOR_URL, json=explanation_request, timeout=5
- )
- comment = None
- if advisor_response.status_code == 200:
- print(advisor_response.json())
- comment = get_comment(
- github_token,
- pr_number,
- generate_test_report_lib.generate_report(
- generate_test_report_lib.compute_platform_title(),
- return_code,
- junit_objects,
- ninja_logs,
- failure_explanations_list=advisor_response.json(),
- ),
- )
- else:
- print(advisor_response.reason)
- if comment:
- if return_code == 0 and "id" not in comment:
- # If the job succeeds and there is not an existing comment, we
- # should not write one to reduce noise.
- return
- with open("comments", "w") as comment_file_handle:
- json.dump([comment], comment_file_handle)
+ comments = []
+ advisor_explanations = []
+ if return_code != 0:
+ advisor_response = requests.get(
+ PREMERGE_ADVISOR_URL, json=explanation_request, timeout=5
+ )
+ if advisor_response.status_code == 200:
+ print(advisor_response.json())
+ advisor_explanations = advisor_response.json()
+ else:
+ print(advisor_response.reason)
+ comments.append(get_comment(
+ github_token,
+ pr_number,
+ generate_test_report_lib.generate_report(
+ generate_test_report_lib.compute_platform_title(),
+ return_code,
+ junit_objects,
+ ninja_logs,
+ failure_explanations_list=advisor_explanations,
+ ),
+ ))
+ if return_code == 0 and "id" not in comments[0]:
+ # If the job succeeds and there is not an existing comment, we
+ # should not write one to reduce noise.
+ comments = []
+ with open("comments", "w") as comment_file_handle:
+ json.dump(comments, comment_file_handle)
if __name__ == "__main__":
>From 64ab7fcda7e77ace4262f03316475682c37af10e Mon Sep 17 00:00:00 2001
From: Aiden Grossman <aidengrossman at google.com>
Date: Fri, 21 Nov 2025 22:58:50 +0000
Subject: [PATCH 4/7] test fail
---
.ci/monolithic-linux.sh | 43 +++++++++++++++++++++++++++++
.ci/monolithic-windows.sh | 13 +++++++++
llvm/utils/TableGen/llvm-tblgen.cpp | 2 ++
3 files changed, 58 insertions(+)
diff --git a/.ci/monolithic-linux.sh b/.ci/monolithic-linux.sh
index e92287df90ae6..7ed67963f6b7d 100755
--- a/.ci/monolithic-linux.sh
+++ b/.ci/monolithic-linux.sh
@@ -63,3 +63,46 @@ cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \
-D LLVM_ENABLE_WERROR=ON
start-group "ninja"
+
+if [[ -n "${targets}" ]]; then
+ # Targets are not escaped as they are passed as separate arguments.
+ ninja -C "${BUILD_DIR}" ${targets} |& tee ninja.log
+ cp ${BUILD_DIR}/.ninja_log ninja.ninja_log
+fi
+
+if [[ -n "${runtime_targets}" ]]; then
+ start-group "ninja Runtimes"
+
+ ninja -C "${BUILD_DIR}" ${runtime_targets} |& tee ninja_runtimes.log
+ cp ${BUILD_DIR}/.ninja_log ninja_runtimes.ninja_log
+fi
+
+# Compiling runtimes with just-built Clang and running their tests
+# as an additional testing for Clang.
+if [[ -n "${runtime_targets_needs_reconfig}" ]]; then
+ start-group "CMake Runtimes C++26"
+
+ cmake \
+ -D LIBCXX_TEST_PARAMS="std=c++26" \
+ -D LIBCXXABI_TEST_PARAMS="std=c++26" \
+ "${BUILD_DIR}"
+
+ start-group "ninja Runtimes C++26"
+
+ ninja -C "${BUILD_DIR}" ${runtime_targets_needs_reconfig} \
+ |& tee ninja_runtimes_needs_reconfig1.log
+ cp ${BUILD_DIR}/.ninja_log ninja_runtimes_needs_reconig.ninja_log
+
+ start-group "CMake Runtimes Clang Modules"
+
+ cmake \
+ -D LIBCXX_TEST_PARAMS="enable_modules=clang" \
+ -D LIBCXXABI_TEST_PARAMS="enable_modules=clang" \
+ "${BUILD_DIR}"
+
+ start-group "ninja Runtimes Clang Modules"
+
+ ninja -C "${BUILD_DIR}" ${runtime_targets_needs_reconfig} \
+ |& tee ninja_runtimes_needs_reconfig2.log
+ cp ${BUILD_DIR}/.ninja_log ninja_runtimes_needs_reconfig2.ninja_log
+fi
diff --git a/.ci/monolithic-windows.sh b/.ci/monolithic-windows.sh
index c76c93dea9192..b6bb7c2c92b75 100755
--- a/.ci/monolithic-windows.sh
+++ b/.ci/monolithic-windows.sh
@@ -50,3 +50,16 @@ cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \
-D LLVM_ENABLE_RUNTIMES="${runtimes}"
start-group "ninja"
+
+if [[ -n "${targets}" ]]; then
+ # Targets are not escaped as they are passed as separate arguments.
+ ninja -C "${BUILD_DIR}" ${targets} |& tee ninja.log
+ cp ${BUILD_DIR}/.ninja_log ninja.ninja_log
+fi
+
+if [[ -n "${runtimes_targets}" ]]; then
+ start-group "ninja runtimes"
+
+ ninja -C "${BUILD_DIR}" -k 0 ${runtimes_targets} |& tee ninja_runtimes.log
+ cp ${BUILD_DIR}/.ninja_log ninja_runtimes.ninja_log
+fi
diff --git a/llvm/utils/TableGen/llvm-tblgen.cpp b/llvm/utils/TableGen/llvm-tblgen.cpp
index a38382472a992..4bb792c1278fc 100644
--- a/llvm/utils/TableGen/llvm-tblgen.cpp
+++ b/llvm/utils/TableGen/llvm-tblgen.cpp
@@ -12,6 +12,8 @@
#include "Basic/TableGen.h"
+#error bad
+
/// Command line parameters are shared between llvm-tblgen and llvm-min-tblgen.
/// The indirection to tblgen_main exists to ensure that the static variables
/// for the llvm::cl:: mechanism are linked into both executables.
>From 59c9e54e40a38cc94f179c135fe853be135cc8b4 Mon Sep 17 00:00:00 2001
From: Aiden Grossman <aidengrossman at google.com>
Date: Fri, 21 Nov 2025 23:06:31 +0000
Subject: [PATCH 5/7] different failure
---
.ci/monolithic-linux.sh | 43 -----------------------------
llvm/utils/TableGen/llvm-tblgen.cpp | 2 +-
2 files changed, 1 insertion(+), 44 deletions(-)
diff --git a/.ci/monolithic-linux.sh b/.ci/monolithic-linux.sh
index 7ed67963f6b7d..e92287df90ae6 100755
--- a/.ci/monolithic-linux.sh
+++ b/.ci/monolithic-linux.sh
@@ -63,46 +63,3 @@ cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \
-D LLVM_ENABLE_WERROR=ON
start-group "ninja"
-
-if [[ -n "${targets}" ]]; then
- # Targets are not escaped as they are passed as separate arguments.
- ninja -C "${BUILD_DIR}" ${targets} |& tee ninja.log
- cp ${BUILD_DIR}/.ninja_log ninja.ninja_log
-fi
-
-if [[ -n "${runtime_targets}" ]]; then
- start-group "ninja Runtimes"
-
- ninja -C "${BUILD_DIR}" ${runtime_targets} |& tee ninja_runtimes.log
- cp ${BUILD_DIR}/.ninja_log ninja_runtimes.ninja_log
-fi
-
-# Compiling runtimes with just-built Clang and running their tests
-# as an additional testing for Clang.
-if [[ -n "${runtime_targets_needs_reconfig}" ]]; then
- start-group "CMake Runtimes C++26"
-
- cmake \
- -D LIBCXX_TEST_PARAMS="std=c++26" \
- -D LIBCXXABI_TEST_PARAMS="std=c++26" \
- "${BUILD_DIR}"
-
- start-group "ninja Runtimes C++26"
-
- ninja -C "${BUILD_DIR}" ${runtime_targets_needs_reconfig} \
- |& tee ninja_runtimes_needs_reconfig1.log
- cp ${BUILD_DIR}/.ninja_log ninja_runtimes_needs_reconig.ninja_log
-
- start-group "CMake Runtimes Clang Modules"
-
- cmake \
- -D LIBCXX_TEST_PARAMS="enable_modules=clang" \
- -D LIBCXXABI_TEST_PARAMS="enable_modules=clang" \
- "${BUILD_DIR}"
-
- start-group "ninja Runtimes Clang Modules"
-
- ninja -C "${BUILD_DIR}" ${runtime_targets_needs_reconfig} \
- |& tee ninja_runtimes_needs_reconfig2.log
- cp ${BUILD_DIR}/.ninja_log ninja_runtimes_needs_reconfig2.ninja_log
-fi
diff --git a/llvm/utils/TableGen/llvm-tblgen.cpp b/llvm/utils/TableGen/llvm-tblgen.cpp
index 4bb792c1278fc..e91b340b6679d 100644
--- a/llvm/utils/TableGen/llvm-tblgen.cpp
+++ b/llvm/utils/TableGen/llvm-tblgen.cpp
@@ -12,7 +12,7 @@
#include "Basic/TableGen.h"
-#error bad
+#error bad2
/// Command line parameters are shared between llvm-tblgen and llvm-min-tblgen.
/// The indirection to tblgen_main exists to ensure that the static variables
>From b081c650a5535ca0e7e3abeb402e42bb55704518 Mon Sep 17 00:00:00 2001
From: Aiden Grossman <aidengrossman at google.com>
Date: Fri, 21 Nov 2025 23:06:43 +0000
Subject: [PATCH 6/7] fix
---
.ci/monolithic-linux.sh | 43 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 43 insertions(+)
diff --git a/.ci/monolithic-linux.sh b/.ci/monolithic-linux.sh
index e92287df90ae6..7ed67963f6b7d 100755
--- a/.ci/monolithic-linux.sh
+++ b/.ci/monolithic-linux.sh
@@ -63,3 +63,46 @@ cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \
-D LLVM_ENABLE_WERROR=ON
start-group "ninja"
+
+if [[ -n "${targets}" ]]; then
+ # Targets are not escaped as they are passed as separate arguments.
+ ninja -C "${BUILD_DIR}" ${targets} |& tee ninja.log
+ cp ${BUILD_DIR}/.ninja_log ninja.ninja_log
+fi
+
+if [[ -n "${runtime_targets}" ]]; then
+ start-group "ninja Runtimes"
+
+ ninja -C "${BUILD_DIR}" ${runtime_targets} |& tee ninja_runtimes.log
+ cp ${BUILD_DIR}/.ninja_log ninja_runtimes.ninja_log
+fi
+
+# Compiling runtimes with just-built Clang and running their tests
+# as an additional testing for Clang.
+if [[ -n "${runtime_targets_needs_reconfig}" ]]; then
+ start-group "CMake Runtimes C++26"
+
+ cmake \
+ -D LIBCXX_TEST_PARAMS="std=c++26" \
+ -D LIBCXXABI_TEST_PARAMS="std=c++26" \
+ "${BUILD_DIR}"
+
+ start-group "ninja Runtimes C++26"
+
+ ninja -C "${BUILD_DIR}" ${runtime_targets_needs_reconfig} \
+ |& tee ninja_runtimes_needs_reconfig1.log
+ cp ${BUILD_DIR}/.ninja_log ninja_runtimes_needs_reconig.ninja_log
+
+ start-group "CMake Runtimes Clang Modules"
+
+ cmake \
+ -D LIBCXX_TEST_PARAMS="enable_modules=clang" \
+ -D LIBCXXABI_TEST_PARAMS="enable_modules=clang" \
+ "${BUILD_DIR}"
+
+ start-group "ninja Runtimes Clang Modules"
+
+ ninja -C "${BUILD_DIR}" ${runtime_targets_needs_reconfig} \
+ |& tee ninja_runtimes_needs_reconfig2.log
+ cp ${BUILD_DIR}/.ninja_log ninja_runtimes_needs_reconfig2.ninja_log
+fi
>From 3684681e0636e4b00131900b277d13b30c85f105 Mon Sep 17 00:00:00 2001
From: Aiden Grossman <aidengrossman at google.com>
Date: Fri, 21 Nov 2025 23:19:10 +0000
Subject: [PATCH 7/7] clean
---
.ci/monolithic-linux.sh | 43 -----------------------------
.ci/monolithic-windows.sh | 13 ---------
llvm/utils/TableGen/llvm-tblgen.cpp | 2 --
3 files changed, 58 deletions(-)
diff --git a/.ci/monolithic-linux.sh b/.ci/monolithic-linux.sh
index 7ed67963f6b7d..e92287df90ae6 100755
--- a/.ci/monolithic-linux.sh
+++ b/.ci/monolithic-linux.sh
@@ -63,46 +63,3 @@ cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \
-D LLVM_ENABLE_WERROR=ON
start-group "ninja"
-
-if [[ -n "${targets}" ]]; then
- # Targets are not escaped as they are passed as separate arguments.
- ninja -C "${BUILD_DIR}" ${targets} |& tee ninja.log
- cp ${BUILD_DIR}/.ninja_log ninja.ninja_log
-fi
-
-if [[ -n "${runtime_targets}" ]]; then
- start-group "ninja Runtimes"
-
- ninja -C "${BUILD_DIR}" ${runtime_targets} |& tee ninja_runtimes.log
- cp ${BUILD_DIR}/.ninja_log ninja_runtimes.ninja_log
-fi
-
-# Compiling runtimes with just-built Clang and running their tests
-# as an additional testing for Clang.
-if [[ -n "${runtime_targets_needs_reconfig}" ]]; then
- start-group "CMake Runtimes C++26"
-
- cmake \
- -D LIBCXX_TEST_PARAMS="std=c++26" \
- -D LIBCXXABI_TEST_PARAMS="std=c++26" \
- "${BUILD_DIR}"
-
- start-group "ninja Runtimes C++26"
-
- ninja -C "${BUILD_DIR}" ${runtime_targets_needs_reconfig} \
- |& tee ninja_runtimes_needs_reconfig1.log
- cp ${BUILD_DIR}/.ninja_log ninja_runtimes_needs_reconig.ninja_log
-
- start-group "CMake Runtimes Clang Modules"
-
- cmake \
- -D LIBCXX_TEST_PARAMS="enable_modules=clang" \
- -D LIBCXXABI_TEST_PARAMS="enable_modules=clang" \
- "${BUILD_DIR}"
-
- start-group "ninja Runtimes Clang Modules"
-
- ninja -C "${BUILD_DIR}" ${runtime_targets_needs_reconfig} \
- |& tee ninja_runtimes_needs_reconfig2.log
- cp ${BUILD_DIR}/.ninja_log ninja_runtimes_needs_reconfig2.ninja_log
-fi
diff --git a/.ci/monolithic-windows.sh b/.ci/monolithic-windows.sh
index b6bb7c2c92b75..c76c93dea9192 100755
--- a/.ci/monolithic-windows.sh
+++ b/.ci/monolithic-windows.sh
@@ -50,16 +50,3 @@ cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \
-D LLVM_ENABLE_RUNTIMES="${runtimes}"
start-group "ninja"
-
-if [[ -n "${targets}" ]]; then
- # Targets are not escaped as they are passed as separate arguments.
- ninja -C "${BUILD_DIR}" ${targets} |& tee ninja.log
- cp ${BUILD_DIR}/.ninja_log ninja.ninja_log
-fi
-
-if [[ -n "${runtimes_targets}" ]]; then
- start-group "ninja runtimes"
-
- ninja -C "${BUILD_DIR}" -k 0 ${runtimes_targets} |& tee ninja_runtimes.log
- cp ${BUILD_DIR}/.ninja_log ninja_runtimes.ninja_log
-fi
diff --git a/llvm/utils/TableGen/llvm-tblgen.cpp b/llvm/utils/TableGen/llvm-tblgen.cpp
index e91b340b6679d..a38382472a992 100644
--- a/llvm/utils/TableGen/llvm-tblgen.cpp
+++ b/llvm/utils/TableGen/llvm-tblgen.cpp
@@ -12,8 +12,6 @@
#include "Basic/TableGen.h"
-#error bad2
-
/// Command line parameters are shared between llvm-tblgen and llvm-min-tblgen.
/// The indirection to tblgen_main exists to ensure that the static variables
/// for the llvm::cl:: mechanism are linked into both executables.
More information about the llvm-commits
mailing list