From 2425c868a31177e6c3e8861dc631d8df97d64b4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20Br=C3=BCbach?= Date: Mon, 5 Oct 2026 14:25:47 +0200 Subject: [PATCH] [CI] Resolve the coverage source root before the build dir cd The previous commit computed SRC_ROOT after `cd "$BUILD_DIR"`, under a comment claiming it ran before. `$0` is relative to the directory the script was invoked from, so from inside the build dir `dirname "$0"` no longer resolves and the subshell's `cd` fails. Under `set -e` that is fatal rather than an empty variable, which took down every leg in the matrix, coverage or not, including the ones this change does not otherwise touch. Move it above the cd and guard it on MAKE_COVERAGE, since the coverage report is the only consumer. Resolving it unconditionally meant a coverage-only detail was paid for by every build in the fleet, and gave every one of them a way to fail. --- .ci/compile.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/.ci/compile.sh b/.ci/compile.sh index 75a173429..90c158c6f 100755 --- a/.ci/compile.sh +++ b/.ci/compile.sh @@ -142,11 +142,16 @@ if [[ ! $BUILD_DIR ]]; then BUILD_DIR="build" fi mkdir -p "$BUILD_DIR" -cd "$BUILD_DIR" -# Captured before the cd because $0 is relative to the directory the script was invoked from, -# and after the cd it no longer resolves to anything. The coverage report needs the source root. -SRC_ROOT="$(cd "$(dirname "$0")/.." && pwd)" +if [[ $MAKE_COVERAGE ]]; then + # Resolved while the working directory is still the source root. $0 is relative to the + # directory the script was invoked from, so after the cd below it no longer resolves, and + # under `set -e` the failed subshell would abort the build rather than just yielding an empty + # variable. Only the coverage report needs this, so only coverage pays for it. + SRC_ROOT="$(cd "$(dirname "$0")/.." && pwd)" +fi + +cd "$BUILD_DIR" # Set minimum CMake Version export CMAKE_POLICY_VERSION_MINIMUM=3.10