Skip to content

Commit 0d7c869

Browse files
[CI] Make monolithic-* scripts only run Github steps on Github
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. Reviewers: cmtice, ldionne, Endilll, gburgessiv, Keenuts, dschuff, lnihlen Pull Request: #152197
1 parent 2c2a368 commit 0d7c869

File tree

2 files changed

+42
-27
lines changed

2 files changed

+42
-27
lines changed

.ci/monolithic-linux.sh

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,25 @@ function at-exit {
3838
# If building fails there will be no results files.
3939
shopt -s nullglob
4040

41-
python3 "${MONOREPO_ROOT}"/.ci/generate_test_report_github.py ":penguin: Linux x64 Test Results" \
42-
$retcode "${BUILD_DIR}"/test-results.*.xml >> $GITHUB_STEP_SUMMARY
41+
if [[ "$GITHUB_STEP_SUMMARY" != "" ]]; then
42+
python3 "${MONOREPO_ROOT}"/.ci/generate_test_report_github.py ":penguin: Linux x64 Test Results" \
43+
$retcode "${BUILD_DIR}"/test-results.*.xml >> $GITHUB_STEP_SUMMARY
44+
fi
4345
}
4446
trap at-exit EXIT
4547

48+
function start-group {
49+
groupname=$1
50+
if [[ "$GITHUB_ACTIONS" != "" ]]; then
51+
echo "::endgroup"
52+
echo "::group::$groupname"
53+
elif [[ "$POSTCOMMIT_CI" != "" ]]; then
54+
echo "@@@$STEP@@@"
55+
else
56+
echo "Starting $groupname"
57+
fi
58+
}
59+
4660
projects="${1}"
4761
targets="${2}"
4862
runtimes="${3}"
@@ -52,7 +66,7 @@ enable_cir="${6}"
5266

5367
lit_args="-v --xunit-xml-output ${BUILD_DIR}/test-results.xml --use-unique-output-file-name --timeout=1200 --time-tests"
5468

55-
echo "::group::cmake"
69+
start-group "CMake"
5670
export PIP_BREAK_SYSTEM_PACKAGES=1
5771
pip install -q -r "${MONOREPO_ROOT}"/.ci/all_requirements.txt
5872

@@ -83,49 +97,39 @@ cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \
8397
-D LLDB_ENFORCE_STRICT_TEST_REQUIREMENTS=ON \
8498
-D CMAKE_INSTALL_PREFIX="${INSTALL_DIR}"
8599

86-
echo "::endgroup::"
87-
echo "::group::ninja"
100+
start-group "ninja"
88101

89102
# Targets are not escaped as they are passed as separate arguments.
90103
ninja -C "${BUILD_DIR}" -k 0 ${targets}
91104

92-
echo "::endgroup::"
93-
94105
if [[ "${runtime_targets}" != "" ]]; then
95-
echo "::group::ninja runtimes"
106+
start-group "ninja Runtimes"
96107

97108
ninja -C "${BUILD_DIR}" ${runtime_targets}
98-
99-
echo "::endgroup::"
100109
fi
101110

102111
# Compiling runtimes with just-built Clang and running their tests
103112
# as an additional testing for Clang.
104113
if [[ "${runtime_targets_needs_reconfig}" != "" ]]; then
105-
echo "::group::cmake runtimes C++26"
114+
start-group "CMake Runtimes C++26"
106115

107116
cmake \
108117
-D LIBCXX_TEST_PARAMS="std=c++26" \
109118
-D LIBCXXABI_TEST_PARAMS="std=c++26" \
110119
"${BUILD_DIR}"
111120

112-
echo "::endgroup::"
113-
echo "::group::ninja runtimes C++26"
121+
start-group "ninja Runtimes C++26"
114122

115123
ninja -C "${BUILD_DIR}" ${runtime_targets_needs_reconfig}
116124

117-
echo "::endgroup::"
118-
echo "::group::cmake runtimes clang modules"
125+
start-group "CMake Runtimes Clang Modules"
119126

120127
cmake \
121128
-D LIBCXX_TEST_PARAMS="enable_modules=clang" \
122129
-D LIBCXXABI_TEST_PARAMS="enable_modules=clang" \
123130
"${BUILD_DIR}"
124131

125-
echo "::endgroup::"
126-
echo "::group::ninja runtimes clang modules"
132+
start-group "ninja Runtimes Clang Modules"
127133

128134
ninja -C "${BUILD_DIR}" ${runtime_targets_needs_reconfig}
129-
130-
echo "::endgroup::"
131135
fi

.ci/monolithic-windows.sh

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,30 @@ function at-exit {
3232

3333
# If building fails there will be no results files.
3434
shopt -s nullglob
35-
36-
python "${MONOREPO_ROOT}"/.ci/generate_test_report_github.py ":window: Windows x64 Test Results" \
37-
$retcode "${BUILD_DIR}"/test-results.*.xml >> $GITHUB_STEP_SUMMARY
35+
36+
if [[ "$GITHUB_STEP_SUMMARY" != "" ]]; then
37+
python "${MONOREPO_ROOT}"/.ci/generate_test_report_github.py ":window: Windows x64 Test Results" \
38+
$retcode "${BUILD_DIR}"/test-results.*.xml >> $GITHUB_STEP_SUMMARY
39+
fi
3840
}
3941
trap at-exit EXIT
4042

43+
function start-group {
44+
groupname=$1
45+
if [[ "$GITHUB_ACTIONS" != "" ]]; then
46+
echo "::endgroup"
47+
echo "::group::$groupname"
48+
elif [[ "$POSTCOMMIT_CI" != "" ]]; then
49+
echo "@@@$STEP@@@"
50+
else
51+
echo "Starting $groupname"
52+
fi
53+
}
54+
4155
projects="${1}"
4256
targets="${2}"
4357

44-
echo "::group::cmake"
58+
start-group "CMake"
4559
pip install -q -r "${MONOREPO_ROOT}"/.ci/all_requirements.txt
4660

4761
export CC=cl
@@ -71,10 +85,7 @@ cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \
7185
-D CMAKE_MODULE_LINKER_FLAGS="/MANIFEST:NO" \
7286
-D CMAKE_SHARED_LINKER_FLAGS="/MANIFEST:NO"
7387

74-
echo "::endgroup::"
75-
echo "::group::ninja"
88+
start-group "ninja"
7689

7790
# Targets are not escaped as they are passed as separate arguments.
7891
ninja -C "${BUILD_DIR}" -k 0 ${targets}
79-
80-
echo "::endgroup"

0 commit comments

Comments
 (0)