ci: Add IWYU job
The change in `src/crypto/hex_base.cpp` is because GCC 14 is not affected by an IWYU bug. See: https://github.com/include-what-you-use/include-what-you-use/issues/1763.
This commit is contained in:
6 files changed
+48
-8
No files matched your search
@@ -41,10 +41,10 @@ echo "=== BEGIN env ==="
|
||||
env
|
||||
echo "=== END env ==="
|
||||
|
||||
# Don't apply patches in the tidy job, because it relies on the `git diff`
|
||||
# command to detect IWYU errors. It is safe to skip this patch in the tidy job
|
||||
# Don't apply patches in the iwyu job, because it relies on the `git diff`
|
||||
# command to detect IWYU errors. It is safe to skip this patch in the iwyu job
|
||||
# because it doesn't run a UB detector.
|
||||
if [ "$RUN_TIDY" != "true" ]; then
|
||||
if [[ "${RUN_IWYU}" != true ]]; then
|
||||
# compact->outputs[i].file_size is uninitialized memory, so reading it is UB.
|
||||
# The statistic bytes_written is only used for logging, which is disabled in
|
||||
# CI, so as a temporary minimal fix to work around UB and CI failures, leave
|
||||
@@ -120,7 +120,7 @@ BASE_BUILD_DIR=${BASE_BUILD_DIR:-$BASE_SCRATCH_DIR/build-$HOST}
|
||||
|
||||
BITCOIN_CONFIG_ALL="$BITCOIN_CONFIG_ALL -DCMAKE_INSTALL_PREFIX=$BASE_OUTDIR -Werror=dev"
|
||||
|
||||
if [[ "${RUN_TIDY}" == "true" ]]; then
|
||||
if [[ "${RUN_IWYU}" == true || "${RUN_TIDY}" == true ]]; then
|
||||
BITCOIN_CONFIG_ALL="$BITCOIN_CONFIG_ALL -DCMAKE_EXPORT_COMPILE_COMMANDS=ON"
|
||||
fi
|
||||
|
||||
@@ -132,11 +132,15 @@ cmake -S "$BASE_ROOT_DIR" -B "$BASE_BUILD_DIR" "${CMAKE_ARGS[@]}" || (
|
||||
false
|
||||
)
|
||||
|
||||
if [[ "${GOAL}" != all && "${GOAL}" != codegen ]]; then
|
||||
GOAL="all ${GOAL}"
|
||||
fi
|
||||
|
||||
# shellcheck disable=SC2086
|
||||
cmake --build "${BASE_BUILD_DIR}" "$MAKEJOBS" --target all $GOAL || (
|
||||
cmake --build "${BASE_BUILD_DIR}" "$MAKEJOBS" --target $GOAL || (
|
||||
echo "Build failure. Verbose build follows."
|
||||
# shellcheck disable=SC2086
|
||||
cmake --build "${BASE_BUILD_DIR}" -j1 --target all $GOAL --verbose
|
||||
cmake --build "${BASE_BUILD_DIR}" -j1 --target $GOAL --verbose
|
||||
false
|
||||
)
|
||||
|
||||
@@ -204,7 +208,9 @@ if [ "${RUN_TIDY}" = "true" ]; then
|
||||
echo "^^^ ⚠️ Failure generated from clang-tidy"
|
||||
false
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ "${RUN_IWYU}" == true ]]; then
|
||||
# TODO: Consider enforcing IWYU across the entire codebase.
|
||||
FILES_WITH_ENFORCED_IWYU="/src/(crypto|index)/.*\\.cpp"
|
||||
jq --arg patterns "$FILES_WITH_ENFORCED_IWYU" 'map(select(.file | test($patterns)))' "${BASE_BUILD_DIR}/compile_commands.json" > "${BASE_BUILD_DIR}/compile_commands_iwyu_errors.json"
|
||||
|
||||
Reference in new issue
Block a user