From e5cab258e14841bb2f5ebd328754332c8dd65d4d Mon Sep 17 00:00:00 2001 From: Alexander Grund Date: Fri, 27 Dec 2024 12:31:07 +0100 Subject: [PATCH] Make GitHub actions output of setup step more readable Use groups to wrap parts of the steps --- ci/common_install.sh | 27 ++++++++++++++++++++++++--- ci/setup_ccache.sh | 10 +++++++++- 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/ci/common_install.sh b/ci/common_install.sh index 4c1ffda0..b645331e 100644 --- a/ci/common_install.sh +++ b/ci/common_install.sh @@ -28,8 +28,20 @@ set -ex CI_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd)" -. "$CI_DIR"/enforce.sh +function print_on_gha { + { set +x; } &> /dev/null + if [[ "${GITHUB_ACTIONS:-false}" == "true" ]]; then + echo "$@" + fi + set -x + fi +} 2> /dev/null + +print_on_gha "::group::Setup B2 variables" +. "$CI_DIR"/enforce.sh 2>&1 +print_on_gha "::endgroup::" +print_on_gha "::group::Checkout and setup Boost build tree" pythonexecutable=$(get_python_executable) if [ -z "$SELF" ]; then @@ -71,6 +83,7 @@ if [[ -n "$GIT_FETCH_JOBS" ]]; then fi $pythonexecutable tools/boostdep/depinst/depinst.py --include benchmark --include example --include examples --include tools "${DEPINST_ARGS[@]}" $DEPINST $SELF +print_on_gha "::endgroup::" # Deduce B2_TOOLSET if unset from B2_COMPILER if [ -z "$B2_TOOLSET" ] && [ -n "$B2_COMPILER" ]; then @@ -121,9 +134,10 @@ if [[ "$B2_TOOLSET" == clang* ]]; then fi # Setup ccache +print_on_gha "::group::Setup CCache" if [ "$B2_USE_CCACHE" == "1" ]; then if ! "$CI_DIR"/setup_ccache.sh 2>&1; then - set +x + { set +x; } &> /dev/null echo printf '=%.0s' {1..120} echo @@ -133,10 +147,14 @@ if [ "$B2_USE_CCACHE" == "1" ]; then echo echo B2_USE_CCACHE=0 + print_on_gha "::error title=CCache::CCache disabled due to an error!" set -x fi + print_on_gha "::error title=CCache::CCache22 disabled due to an error!" fi +print_on_gha "::endgroup::" +print_on_gha "::group::Setup B2" # Set up user-config to actually use B2_COMPILER if set if [ -n "$B2_COMPILER" ]; then # Get C++ compiler @@ -152,7 +170,7 @@ if [ -n "$B2_COMPILER" ]; then exit 1 fi - set +x + { set +x; } &> /dev/null echo "Compiler location: $(command -v $CXX)" if [[ "$CXX" == *"clang++"* ]] && [ -z "$GCC_TOOLCHAIN_ROOT" ]; then # Show also information on selected GCC lib @@ -183,8 +201,10 @@ function show_bootstrap_log { cat bootstrap.log } +print_on_gha "::endgroup::" if [[ "$B2_DONT_BOOTSTRAP" != "1" ]]; then + print_on_gha "::group::Bootstrap B2" trap show_bootstrap_log ERR # Check if b2 already exists. This would (only) happen in a caching scenario. The purpose of caching is to save time by not recompiling everything. # The user may clear cache or delete b2 beforehand if they wish to rebuild. @@ -205,4 +225,5 @@ if [[ "$B2_DONT_BOOTSTRAP" != "1" ]]; then fi trap - ERR ${B2_WRAPPER} ./b2 -d0 headers + print_on_gha "::endgroup::" fi diff --git a/ci/setup_ccache.sh b/ci/setup_ccache.sh index 0a1694e0..fbbd890b 100755 --- a/ci/setup_ccache.sh +++ b/ci/setup_ccache.sh @@ -7,10 +7,17 @@ # # Installs and sets up ccache +{ set +x; } &> /dev/null set -eu -set +x + +function print_on_gha { + if [[ "${GITHUB_ACTIONS:-false}" == "true" ]]; then + echo "$@" + fi +} 2> /dev/null if ! command -v ccache &> /dev/null; then + print_on_gha "::group::Installing CCache" if [ -f "/etc/debian_version" ]; then sudo apt-get install ${NET_RETRY_COUNT:+ -o Acquire::Retries=$NET_RETRY_COUNT} -y ccache elif command -v brew &> /dev/null; then @@ -26,6 +33,7 @@ if ! command -v ccache &> /dev/null; then brew install ccache 2>&1 fi fi + print_on_gha "::endgroup::" fi # Sanity check that CCache is installed, executable and works at all