Skip to content

Conversation

EricWF
Copy link
Member

@EricWF EricWF commented Dec 12, 2023

This improves the CI output by providing collapsable sections for sub-parts of our build.

@EricWF EricWF requested a review from a team as a code owner December 12, 2023 18:40
@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Dec 12, 2023
@llvmbot
Copy link
Member

llvmbot commented Dec 12, 2023

@llvm/pr-subscribers-libcxx

Author: Eric (EricWF)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/75233.diff

1 Files Affected:

  • (modified) libcxx/utils/ci/run-buildbot (+49-14)
diff --git a/libcxx/utils/ci/run-buildbot b/libcxx/utils/ci/run-buildbot
index 445b1becee0c2..098a14eaab3e4 100755
--- a/libcxx/utils/ci/run-buildbot
+++ b/libcxx/utils/ci/run-buildbot
@@ -112,6 +112,27 @@ if [ -z "${CMAKE}" ]; then
     fi
 fi
 
+function start_output_group() {
+  end_output_group
+  export IN_GROUP=1
+
+  if [[ -v GITHUB_ACTIONS ]]; then
+    echo "::group::$1"
+  else
+    echo "--- $1"
+  fi
+}
+
+function end_output_group() {
+  if [[ ! -v GITHUB_ACTIONS ]]; then
+    return
+  fi
+  if [[ -v IN_GROUP ]]; then
+    echo "::endgroup::"
+    unset IN_GROUP
+  fi
+}
+
 function clean() {
     rm -rf "${BUILD_DIR}"
 }
@@ -125,7 +146,7 @@ if [ -n "${ENABLE_STD_MODULES}" ]; then
 fi
 
 function generate-cmake-base() {
-    echo "--- Generating CMake"
+    start_output_group "Generating CMake"
     ${CMAKE} \
           -S "${MONOREPO_ROOT}/runtimes" \
           -B "${BUILD_DIR}" \
@@ -139,6 +160,7 @@ function generate-cmake-base() {
           ${ENABLE_STD_MODULES} \
           -DLLVM_LIT_ARGS="-sv --xunit-xml-output test-results.xml --timeout=1500 --time-tests" \
           "${@}"
+    end_output_group
 }
 
 function generate-cmake() {
@@ -164,13 +186,20 @@ function generate-cmake-android() {
 }
 
 function check-runtimes() {
-    echo "+++ Running the libc++ tests"
+    start_output_group "Building libc++ & libc++abi"
+    ${NINJA} -vC "${BUILD_DIR}" cxx cxxabi
+
+    start_output_group "Building libc++ test deps"
+    ${NINJA} -vC "${BUILD_DIR}" cxx-test-deps
+
+
+    start_output_group "Running the libc++ tests"
     ${NINJA} -vC "${BUILD_DIR}" check-cxx
 
-    echo "+++ Running the libc++abi tests"
+    start_output_group "Running the libc++abi tests"
     ${NINJA} -vC "${BUILD_DIR}" check-cxxabi
 
-    echo "+++ Running the libunwind tests"
+    start_output_group "Running the libunwind tests"
     ${NINJA} -vC "${BUILD_DIR}" check-unwind
 
     # TODO: On macOS 13.5, the linker seems to have an issue where it will pick up
@@ -183,23 +212,25 @@ function check-runtimes() {
     #       It should be possible to move this installation step back to the top once
     #       that issue has been resolved, but in the meantime it doesn't really hurt to
     #       have it here.
-    echo "--- Installing libc++, libc++abi and libunwind to a fake location"
+    start_output_group "Installing libc++, libc++abi and libunwind to a fake location"
     ${NINJA} -vC "${BUILD_DIR}" install-cxx install-cxxabi install-unwind
+
+    end_output_group
 }
 
 # TODO: The goal is to test this against all configurations. We should also move
 #       this to the Lit test suite instead of being a separate CMake target.
 function check-abi-list() {
-    echo "+++ Running the libc++ ABI list test"
+    start_output_group "Running the libc++ ABI list test"
     ${NINJA} -vC "${BUILD_DIR}" check-cxx-abilist || (
-        echo "+++ Generating the libc++ ABI list after failed check"
+        echo "::error::Generating the libc++ ABI list after failed check"
         ${NINJA} -vC "${BUILD_DIR}" generate-cxx-abilist
         false
     )
 }
 
 function check-cxx-benchmarks() {
-    echo "--- Running the benchmarks"
+    start_output_group "Running the benchmarks"
     ${NINJA} -vC "${BUILD_DIR}" check-cxx-benchmarks
 }
 
@@ -341,7 +372,7 @@ generic-ubsan)
 bootstrapping-build)
     clean
 
-    echo "--- Generating CMake"
+    start_output_group "Generating CMake"
     ${CMAKE} \
           -S "${MONOREPO_ROOT}/llvm" \
           -B "${BUILD_DIR}" \
@@ -357,13 +388,15 @@ bootstrapping-build)
           -DLLVM_ENABLE_ASSERTIONS=ON \
           -DLLVM_LIT_ARGS="-sv --xunit-xml-output test-results.xml --timeout=1500 --time-tests"
 
-    echo "+++ Running the libc++ and libc++abi tests"
+    start_output_group "Running the libc++ and libc++abi tests"
     ${NINJA} -vC "${BUILD_DIR}" check-runtimes
 
-    echo "--- Installing libc++ and libc++abi to a fake location"
+    start_output_group "Installing libc++ and libc++abi to a fake location"
     ${NINJA} -vC "${BUILD_DIR}" install-runtimes
 
     ccache -s
+
+    end_output_group
 ;;
 generic-static)
     clean
@@ -500,11 +533,12 @@ apple-system-backdeployment-hardened-*)
     clean
 
     if [[ "${OSX_ROOTS}" == "" ]]; then
-        echo "--- Downloading previous macOS dylibs"
+        start_output_group "Downloading previous macOS dylibs"
         PREVIOUS_DYLIBS_URL="https://dl.dropboxusercontent.com/s/gmcfxwgl9f9n6pu/libcxx-roots.tar.gz"
         OSX_ROOTS="${BUILD_DIR}/macos-roots"
         mkdir -p "${OSX_ROOTS}"
         curl "${PREVIOUS_DYLIBS_URL}" | tar -xz --strip-components=1 -C "${OSX_ROOTS}"
+        end_output_group
     fi
 
     DEPLOYMENT_TARGET="${BUILDER#apple-system-backdeployment-hardened-}"
@@ -538,11 +572,12 @@ apple-system-backdeployment-*)
     clean
 
     if [[ "${OSX_ROOTS}" == "" ]]; then
-        echo "--- Downloading previous macOS dylibs"
+        start_output_group "Downloading previous macOS dylibs"
         PREVIOUS_DYLIBS_URL="https://dl.dropboxusercontent.com/s/gmcfxwgl9f9n6pu/libcxx-roots.tar.gz"
         OSX_ROOTS="${BUILD_DIR}/macos-roots"
         mkdir -p "${OSX_ROOTS}"
         curl "${PREVIOUS_DYLIBS_URL}" | tar -xz --strip-components=1 -C "${OSX_ROOTS}"
+        end_output_group
     fi
 
     DEPLOYMENT_TARGET="${BUILDER#apple-system-backdeployment-}"
@@ -621,7 +656,7 @@ armv7m-picolibc)
         --install-dir "${INSTALL_DIR}" \
         --target armv7m-none-eabi
 
-    echo "--- Generating CMake"
+    start_output_group "Generating CMake"
     flags="--sysroot=${INSTALL_DIR}"
     ${CMAKE} \
         -S "${MONOREPO_ROOT}/compiler-rt" \

This should make log output easier to find.
@ldionne
Copy link
Member

ldionne commented Dec 18, 2023

Can you explain what this does (perhaps in the commit message)? I imagine this improves the CI output? That would be nice!

@ldionne ldionne self-assigned this Jan 10, 2024
@ldionne
Copy link
Member

ldionne commented Jan 10, 2024

I looked at the CI output and this seems really desirable. It looks like we could also avoid using set -x in a few places to increase readability a lot. Do you have interest in pursuing this patch or should someone else pick it up?

@philnik777
Copy link
Contributor

@ldionne @EricWF does either of you plan to pick this up again? If not, let's close the PR for now (or make it a draft).

@ldionne ldionne changed the title attempt to add output groups to github actions for libc++ [libc++] Add output groups to run-buildbot Oct 9, 2024
@ldionne
Copy link
Member

ldionne commented Oct 9, 2024

Crap, I don't have permission to push to this branch to pick it up. I'll close this and reopen a PR.

@ldionne ldionne closed this Oct 9, 2024
ldionne pushed a commit to ldionne/llvm-project that referenced this pull request Oct 9, 2024
This improves the CI output by providing collapsable sections for
sub-parts of our build.

This was originally opened as llvm#75233.
ldionne added a commit that referenced this pull request Oct 11, 2024
This improves the CI output by providing collapsable sections for
sub-parts of our build.

This was originally opened as #75233.

Co-authored-by: eric <[email protected]>
DanielCChen pushed a commit to DanielCChen/llvm-project that referenced this pull request Oct 16, 2024
This improves the CI output by providing collapsable sections for
sub-parts of our build.

This was originally opened as llvm#75233.

Co-authored-by: eric <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants