[llvm] [CI] Make monolithic-* scripts only run Github steps on Github (PR #152197)
Aiden Grossman via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 5 13:33:56 PDT 2025
https://github.com/boomanaiden154 created https://github.com/llvm/llvm-project/pull/152197
We run a couple Github only steps in the monolithic-* scripts like
writing to $GITHUB_STEP_SUMMARY and denoting log groups. These can throw
errors when running the scripts locally or as part of other CI systems
(like buildbot). This patch makes it so that we only run these commands
when in the relevant environment. We also add a $POSTCOMMIT_CI check for
groups so that the annotated builder in buildbot works properly with
these scripts.
>From fc59b05b1a2c1c1fe0155ee04c5dfd206b429274 Mon Sep 17 00:00:00 2001
From: Aiden Grossman <aidengrossman at google.com>
Date: Tue, 5 Aug 2025 20:33:47 +0000
Subject: [PATCH] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20initia?=
=?UTF-8?q?l=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Created using spr 1.3.6
---
.ci/monolithic-linux.sh | 42 +++++++++++++++++++++------------------
.ci/monolithic-windows.sh | 27 +++++++++++++++++--------
2 files changed, 42 insertions(+), 27 deletions(-)
diff --git a/.ci/monolithic-linux.sh b/.ci/monolithic-linux.sh
index 6db24d894eb73..fffd8fef21382 100755
--- a/.ci/monolithic-linux.sh
+++ b/.ci/monolithic-linux.sh
@@ -38,11 +38,25 @@ function at-exit {
# If building fails there will be no results files.
shopt -s nullglob
- python3 "${MONOREPO_ROOT}"/.ci/generate_test_report_github.py ":penguin: Linux x64 Test Results" \
- $retcode "${BUILD_DIR}"/test-results.*.xml >> $GITHUB_STEP_SUMMARY
+ if [[ "$GITHUB_STEP_SUMMARY" != "" ]]; then
+ python3 "${MONOREPO_ROOT}"/.ci/generate_test_report_github.py ":penguin: Linux x64 Test Results" \
+ $retcode "${BUILD_DIR}"/test-results.*.xml >> $GITHUB_STEP_SUMMARY
+ fi
}
trap at-exit EXIT
+function start-group {
+ groupname=$1
+ if [[ "$GITHUB_ACTIONS" != "" ]]; then
+ echo "::endgroup"
+ echo "::group::$groupname"
+ elif [[ "$POSTCOMMIT_CI" != "" ]]; then
+ echo "@@@$STEP@@@"
+ else
+ echo "Starting $groupname"
+ fi
+}
+
projects="${1}"
targets="${2}"
runtimes="${3}"
@@ -52,7 +66,7 @@ enable_cir="${6}"
lit_args="-v --xunit-xml-output ${BUILD_DIR}/test-results.xml --use-unique-output-file-name --timeout=1200 --time-tests"
-echo "::group::cmake"
+start-group "CMake"
export PIP_BREAK_SYSTEM_PACKAGES=1
pip install -q -r "${MONOREPO_ROOT}"/.ci/all_requirements.txt
@@ -83,49 +97,39 @@ cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \
-D LLDB_ENFORCE_STRICT_TEST_REQUIREMENTS=ON \
-D CMAKE_INSTALL_PREFIX="${INSTALL_DIR}"
-echo "::endgroup::"
-echo "::group::ninja"
+start-group "ninja"
# Targets are not escaped as they are passed as separate arguments.
ninja -C "${BUILD_DIR}" -k 0 ${targets}
-echo "::endgroup::"
-
if [[ "${runtime_targets}" != "" ]]; then
- echo "::group::ninja runtimes"
+ start-group "ninja Runtimes"
ninja -C "${BUILD_DIR}" ${runtime_targets}
-
- echo "::endgroup::"
fi
# Compiling runtimes with just-built Clang and running their tests
# as an additional testing for Clang.
if [[ "${runtime_targets_needs_reconfig}" != "" ]]; then
- echo "::group::cmake runtimes C++26"
+ start-group "CMake Runtimes C++26"
cmake \
-D LIBCXX_TEST_PARAMS="std=c++26" \
-D LIBCXXABI_TEST_PARAMS="std=c++26" \
"${BUILD_DIR}"
- echo "::endgroup::"
- echo "::group::ninja runtimes C++26"
+ start-group "ninja Runtimes C++26"
ninja -C "${BUILD_DIR}" ${runtime_targets_needs_reconfig}
- echo "::endgroup::"
- echo "::group::cmake runtimes clang modules"
+ start-group "CMake Runtimes Clang Modules"
cmake \
-D LIBCXX_TEST_PARAMS="enable_modules=clang" \
-D LIBCXXABI_TEST_PARAMS="enable_modules=clang" \
"${BUILD_DIR}"
- echo "::endgroup::"
- echo "::group::ninja runtimes clang modules"
+ start-group "ninja Runtimes Clang Modules"
ninja -C "${BUILD_DIR}" ${runtime_targets_needs_reconfig}
-
- echo "::endgroup::"
fi
diff --git a/.ci/monolithic-windows.sh b/.ci/monolithic-windows.sh
index 50a741677d734..da150829783df 100755
--- a/.ci/monolithic-windows.sh
+++ b/.ci/monolithic-windows.sh
@@ -32,16 +32,30 @@ function at-exit {
# If building fails there will be no results files.
shopt -s nullglob
-
- python "${MONOREPO_ROOT}"/.ci/generate_test_report_github.py ":window: Windows x64 Test Results" \
- $retcode "${BUILD_DIR}"/test-results.*.xml >> $GITHUB_STEP_SUMMARY
+
+ if [[ "$GITHUB_STEP_SUMMARY" != "" ]]; then
+ python "${MONOREPO_ROOT}"/.ci/generate_test_report_github.py ":window: Windows x64 Test Results" \
+ $retcode "${BUILD_DIR}"/test-results.*.xml >> $GITHUB_STEP_SUMMARY
+ fi
}
trap at-exit EXIT
+function start-group {
+ groupname=$1
+ if [[ "$GITHUB_ACTIONS" != "" ]]; then
+ echo "::endgroup"
+ echo "::group::$groupname"
+ elif [[ "$POSTCOMMIT_CI" != "" ]]; then
+ echo "@@@$STEP@@@"
+ else
+ echo "Starting $groupname"
+ fi
+}
+
projects="${1}"
targets="${2}"
-echo "::group::cmake"
+start-group "CMake"
pip install -q -r "${MONOREPO_ROOT}"/.ci/all_requirements.txt
export CC=cl
@@ -71,10 +85,7 @@ cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \
-D CMAKE_MODULE_LINKER_FLAGS="/MANIFEST:NO" \
-D CMAKE_SHARED_LINKER_FLAGS="/MANIFEST:NO"
-echo "::endgroup::"
-echo "::group::ninja"
+start-group "ninja"
# Targets are not escaped as they are passed as separate arguments.
ninja -C "${BUILD_DIR}" -k 0 ${targets}
-
-echo "::endgroup"
More information about the llvm-commits
mailing list