Merge branch 'master' into apt

This commit is contained in:
Alexander Grund
2025-01-23 18:53:06 +01:00
committed by GitHub
6 changed files with 113 additions and 37 deletions

View File

@@ -33,6 +33,12 @@ branches:
- /fix\/.*/
- /pr\/.*/
skip_commits:
files:
- LICENSE
- meta/*
- README.md
matrix:
fast_finish: false
# Adding MAYFAIL to any matrix job allows it to fail but the build stays green:

View File

@@ -18,6 +18,10 @@ on:
- feature/**
- fix/**
- pr/**
paths-ignore:
- LICENSE
- meta/**
- README.md
concurrency:
group: ${{format('{0}:{1}', github.repository, github.ref)}}
@@ -147,6 +151,9 @@ jobs:
if [[ "${{ matrix.ccache }}" == "no" ]]; then
echo "B2_USE_CCACHE=0" >> $GITHUB_ENV
fi
if [[ "${{ matrix.sanitize }}" == "yes" ]]; then
echo "LSAN_OPTIONS=suppressions=${GITHUB_WORKSPACE}/test/suppressions.txt" >> $GITHUB_ENV
fi
git config --global pack.threads 0
if [[ "${{matrix.container}}" == "ubuntu:1"* ]]; then
# Node 20 doesn't work with Ubuntu 16/18 glibc: https://github.com/actions/checkout/issues/1590
@@ -326,7 +333,7 @@ jobs:
- name: Upload coverage
if: matrix.coverage
uses: codecov/codecov-action@v4
uses: codecov/codecov-action@v5
with:
disable_search: true
file: __out/cobertura.xml

View File

@@ -18,6 +18,20 @@ export UBSAN_OPTIONS=print_stacktrace=1,report_error_type=1,${UBSAN_OPTIONS}
cd "$BOOST_ROOT"
# Save previous config if present. Append to that after finish
b2_config="$BOOST_ROOT/bin.v2/config.log"
if [[ -f "$b2_config" ]]; then
prev_config=$(mktemp)
mv "$b2_config" "$prev_config"
function prepend_config {
[[ -f "$b2_config" ]] || return
echo "=========================== END PREVIOUS CONFIG ======================" >> "$prev_config"
cat "$b2_config" >> "$prev_config"
mv "$prev_config" "$b2_config"
}
trap prepend_config EXIT
fi
${B2_WRAPPER} ./b2 ${B2_TARGETS} "${B2_ARGS[@]}" "$@"
if [ "$B2_USE_CCACHE" == "1" ] && command -v ccache &> /dev/null; then

View File

@@ -2,7 +2,7 @@
#
# Copyright 2017 - 2019 James E. King III
# Copyright 2019 Mateusz Loskot <mateusz at loskot dot net>
# Copyright 2020 Alexander Grund
# Copyright 2020-2024 Alexander Grund
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
@@ -28,8 +28,35 @@ set -ex
CI_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd)"
. "$CI_DIR"/enforce.sh
function print_on_gha {
{ set +x; } &> /dev/null
[[ "${GITHUB_ACTIONS:-false}" != "true" ]] || echo "$@"
set -x
}
# Setup ccache
if [ "$B2_USE_CCACHE" == "1" ]; then
if ! "$CI_DIR"/setup_ccache.sh 2>&1; then
{ set +x; } &> /dev/null
echo
printf '=%.0s' {1..120}
echo
echo "Failed to install & setup ccache!"
echo "Will NOT use CCache for building."
printf '=%.0s' {1..120}
echo
echo
B2_USE_CCACHE=0
print_on_gha "::error title=CCache::CCache disabled due to an error!"
set -x
fi
fi
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,7 +98,9 @@ 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::"
print_on_gha "::group::Setup B2"
# Deduce B2_TOOLSET if unset from B2_COMPILER
if [ -z "$B2_TOOLSET" ] && [ -n "$B2_COMPILER" ]; then
if [[ "$B2_COMPILER" =~ clang ]]; then
@@ -120,11 +149,6 @@ if [[ "$B2_TOOLSET" == clang* ]]; then
fi
fi
# Setup ccache
if [ "$B2_USE_CCACHE" == "1" ]; then
"$CI_DIR"/setup_ccache.sh
fi
# Set up user-config to actually use B2_COMPILER if set
if [ -n "$B2_COMPILER" ]; then
# Get C++ compiler
@@ -140,7 +164,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
@@ -171,8 +195,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.
@@ -193,4 +219,5 @@ if [[ "$B2_DONT_BOOTSTRAP" != "1" ]]; then
fi
trap - ERR
${B2_WRAPPER} ./b2 -d0 headers
print_on_gha "::endgroup::"
fi

View File

@@ -36,26 +36,30 @@ fi
# Persist the environment for all future steps
# Set by common_install.sh
echo "SELF=$SELF" >> $GITHUB_ENV
echo "BOOST_ROOT=$BOOST_ROOT" >> $GITHUB_ENV
echo "B2_TOOLSET=$B2_TOOLSET" >> $GITHUB_ENV
echo "B2_COMPILER=$B2_COMPILER" >> $GITHUB_ENV
# Usually set by the env-key of the "Setup Boost" step
[ -z "$B2_CXXSTD" ] || echo "B2_CXXSTD=$B2_CXXSTD" >> $GITHUB_ENV
[ -z "$B2_JOBS" ] || echo "B2_JOBS=$B2_JOBS" >> $GITHUB_ENV
[ -z "$B2_CXXFLAGS" ] || echo "B2_CXXFLAGS=$B2_CXXFLAGS" >> $GITHUB_ENV
[ -z "$B2_DEFINES" ] || echo "B2_DEFINES=$B2_DEFINES" >> $GITHUB_ENV
[ -z "$B2_INCLUDE" ] || echo "B2_INCLUDE=$B2_INCLUDE" >> $GITHUB_ENV
[ -z "$B2_LINKFLAGS" ] || echo "B2_LINKFLAGS=$B2_LINKFLAGS" >> $GITHUB_ENV
[ -z "$B2_TESTFLAGS" ] || echo "B2_TESTFLAGS=$B2_TESTFLAGS" >> $GITHUB_ENV
[ -z "$B2_ADDRESS_MODEL" ] || echo "B2_ADDRESS_MODEL=$B2_ADDRESS_MODEL" >> $GITHUB_ENV
[ -z "$B2_LINK" ] || echo "B2_LINK=$B2_LINK" >> $GITHUB_ENV
[ -z "$B2_VISIBILITY" ] || echo "B2_VISIBILITY=$B2_VISIBILITY" >> $GITHUB_ENV
[ -z "$B2_STDLIB" ] || echo "B2_STDLIB=$B2_STDLIB" >> $GITHUB_ENV
[ -z "$B2_THREADING" ] || echo "B2_THREADING=$B2_THREADING" >> $GITHUB_ENV
[ -z "$B2_VARIANT" ] || echo "B2_VARIANT=$B2_VARIANT" >> $GITHUB_ENV
[ -z "$B2_ASAN" ] || echo "B2_ASAN=$B2_ASAN" >> $GITHUB_ENV
[ -z "$B2_TSAN" ] || echo "B2_TSAN=$B2_TSAN" >> $GITHUB_ENV
[ -z "$B2_UBSAN" ] || echo "B2_UBSAN=$B2_UBSAN" >> $GITHUB_ENV
[ -z "$B2_FLAGS" ] || echo "B2_FLAGS=$B2_FLAGS" >> $GITHUB_ENV
[ -z "$B2_TARGETS" ] || echo "B2_TARGETS=$B2_TARGETS" >> $GITHUB_ENV
{
echo "SELF=$SELF"
echo "BOOST_ROOT=$BOOST_ROOT"
echo "B2_TOOLSET=$B2_TOOLSET"
echo "B2_COMPILER=$B2_COMPILER"
# Usually set by the env-key of the "Setup Boost" step
[ -z "$B2_CXXSTD" ] || echo "B2_CXXSTD=$B2_CXXSTD"
[ -z "$B2_JOBS" ] || echo "B2_JOBS=$B2_JOBS"
[ -z "$B2_CXXFLAGS" ] || echo "B2_CXXFLAGS=$B2_CXXFLAGS"
[ -z "$B2_DEFINES" ] || echo "B2_DEFINES=$B2_DEFINES"
[ -z "$B2_INCLUDE" ] || echo "B2_INCLUDE=$B2_INCLUDE"
[ -z "$B2_LINKFLAGS" ] || echo "B2_LINKFLAGS=$B2_LINKFLAGS"
[ -z "$B2_TESTFLAGS" ] || echo "B2_TESTFLAGS=$B2_TESTFLAGS"
[ -z "$B2_ADDRESS_MODEL" ] || echo "B2_ADDRESS_MODEL=$B2_ADDRESS_MODEL"
[ -z "$B2_LINK" ] || echo "B2_LINK=$B2_LINK"
[ -z "$B2_VISIBILITY" ] || echo "B2_VISIBILITY=$B2_VISIBILITY"
[ -z "$B2_STDLIB" ] || echo "B2_STDLIB=$B2_STDLIB"
[ -z "$B2_THREADING" ] || echo "B2_THREADING=$B2_THREADING"
[ -z "$B2_VARIANT" ] || echo "B2_VARIANT=$B2_VARIANT"
[ -z "$B2_ASAN" ] || echo "B2_ASAN=$B2_ASAN"
[ -z "$B2_TSAN" ] || echo "B2_TSAN=$B2_TSAN"
[ -z "$B2_UBSAN" ] || echo "B2_UBSAN=$B2_UBSAN"
[ -z "$B2_FLAGS" ] || echo "B2_FLAGS=$B2_FLAGS"
[ -z "$B2_TARGETS" ] || echo "B2_TARGETS=$B2_TARGETS"
# Filter out (only) the conditions from set -x
# Write the stdout to the GitHub env file
} 2> >(grep -vF ' -z ' >&2) >> $GITHUB_ENV

View File

@@ -7,24 +7,42 @@
#
# Installs and sets up ccache
set -ex
{ set +x; } &> /dev/null
set -eu
function print_on_gha {
[[ "${GITHUB_ACTIONS:-false}" != "true" ]] || echo "$@"
}
if ! command -v ccache &> /dev/null; then
print_on_gha "::group::Installing CCache"
if [ -f "/etc/debian_version" ]; then
sudo apt-get -o Acquire::Retries="${NET_RETRY_COUNT:-3}" -y -q --no-install-suggests --no-install-recommends install ccache
elif command -v brew &> /dev/null; then
brew update > /dev/null
if ! brew install ccache; then
if ! brew install ccache 2>&1; then
echo "Installing CCache via Homebrew failed."
echo "Cleaning up Python binaries and trying again"
# Workaround issue with unexpected symlinks: https://github.com/actions/runner-images/issues/6817
for f in 2to3 idle3 pydoc3 python3 python3-config; do
rm /usr/local/bin/$f || true
done
# Try again
brew install ccache
brew install ccache 2>&1
fi
fi
print_on_gha "::endgroup::"
fi
ccache --set-config=cache_dir="${B2_CCACHE_DIR:-~/.ccache}"
ccache --set-config=max_size="${B2_CCACHE_SIZE:-500M}"
print_on_gha "::group::Configuring CCache"
ccache --version
# This also sets the default values
echo "Using cache directory of size ${B2_CCACHE_SIZE:=500M} at '${B2_CCACHE_DIR:=$HOME/.ccache}'"
ccache --set-config=cache_dir="$B2_CCACHE_DIR"
ccache --set-config=max_size="$B2_CCACHE_SIZE"
ccache -z
echo "CCache config: $(ccache -p)"
print_on_gha "::endgroup::"