Skip to content

Commit 76b896b

Browse files
committed
[skip-tests] Use function to only print group in GHA.
1 parent 4d1e7c3 commit 76b896b

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

ci/build_common.sh

+22-6
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,24 @@ git log -1 || "Not a repository"
128128
echo "========================================"
129129
echo
130130

131+
function begin_group() {
132+
if [ -n "$GITHUB_ACTIONS" ]; then
133+
echo -e "\e[1;34m::group::$1\e[0m"
134+
else
135+
echo "$1"
136+
fi
137+
}
138+
139+
function end_group() {
140+
if [ -n "$GITHUB_ACTIONS" ]; then
141+
echo "::endgroup::"
142+
fi
143+
}
144+
131145
function configure_preset()
132146
{
133-
echo "::group::CMake Configure"
147+
begin_group "CMake Configure"
148+
134149
local BUILD_NAME=$1
135150
local PRESET=$2
136151
local CMAKE_OPTIONS=$3
@@ -141,12 +156,13 @@ function configure_preset()
141156
echo "$BUILD_NAME configure complete."
142157

143158
popd > /dev/null
144-
echo "::endgroup::"
159+
160+
end_group
145161
}
146162

147163
function build_preset()
148164
{
149-
echo "::group::Build"
165+
begin_group "Build"
150166
local BUILD_NAME=$1
151167
local PRESET=$2
152168

@@ -158,12 +174,12 @@ function build_preset()
158174

159175
popd > /dev/null
160176
source "./sccache_stats.sh" "end"
161-
echo "::endgroup::"
177+
end_group
162178
}
163179

164180
function test_preset()
165181
{
166-
echo "::group::Test"
182+
begin_group "Test"
167183
local BUILD_NAME=$1
168184
local PRESET=$2
169185

@@ -173,7 +189,7 @@ function test_preset()
173189
echo "$BUILD_NAME testing complete."
174190

175191
popd > /dev/null
176-
echo "::endgroup::"
192+
end_group
177193
}
178194

179195
function configure_and_build_preset()

0 commit comments

Comments
 (0)