Skip to content

Commit

Permalink
ci: split out multiprocess linting to a separate step on Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
kwvg committed Feb 28, 2025
1 parent 0f17388 commit 55a0d0d
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 18 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/build-src.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,14 @@ jobs:
ccache -c
shell: bash

- name: Run linters
if: inputs.build-target == 'linux64_multiprocess'
run: |
export BUILD_TARGET="${{ inputs.build-target }}"
source ./ci/dash/matrix.sh
./ci/dash/lint-tidy.sh
shell: bash

- name: Run unit tests
run: |
BASE_OUTDIR="/output"
Expand Down
25 changes: 7 additions & 18 deletions ci/dash/build_src.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ set -e

source ./ci/dash/matrix.sh

unset CC; unset CXX
unset DISPLAY
unset CC CXX DISPLAY;

if [ "$PULL_REQUEST" != "false" ]; then test/lint/commit-script-check.sh $COMMIT_RANGE; fi

Expand Down Expand Up @@ -51,6 +50,8 @@ make distdir VERSION=$BUILD_TARGET
cd dashcore-$BUILD_TARGET
bash -c "./configure $BITCOIN_CONFIG_ALL $BITCOIN_CONFIG" || ( cat config.log && false)

# This step influences compilation and therefore will always be a part of the
# compile step
if [ "${RUN_TIDY}" = "true" ]; then
MAYBE_BEAR="bear --config src/.bear-tidy-config"
MAYBE_TOKEN="--"
Expand All @@ -65,22 +66,10 @@ if [ -n "$USE_VALGRIND" ]; then
${BASE_ROOT_DIR}/ci/test/wrap-valgrind.sh
fi

if [ "${RUN_TIDY}" = "true" ]; then
set -eo pipefail
cd src
( run-clang-tidy -quiet "${MAKEJOBS}" ) | grep -C5 "error"
cd ..
iwyu_tool.py \
"src/compat" \
"src/init" \
"src/rpc/fees.cpp" \
"src/rpc/signmessage.cpp" \
-p . "${MAKEJOBS}" \
-- -Xiwyu --cxx17ns -Xiwyu --mapping_file="${BASE_ROOT_DIR}/contrib/devtools/iwyu/bitcoin.core.imp" \
2>&1 | tee "/tmp/iwyu_ci.out"
cd src
fix_includes.py --nosafe_headers < /tmp/iwyu_ci.out
git --no-pager diff
# GitHub Actions can segment a job into steps, linting is a separate step
# so Actions runners will perform this step separately.
if [ "${RUN_TIDY}" = "true" ] && [ "${GITHUB_ACTIONS}" != "true" ]; then
${BASE_ROOT_DIR}/ci/dash/lint-tidy.sh
fi

if [ "$RUN_SECURITY_TESTS" = "true" ]; then
Expand Down
29 changes: 29 additions & 0 deletions ci/dash/lint-tidy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env bash
# Copyright (c) 2025 The Dash Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.

export LC_ALL=C.UTF-8

set -eo pipefail

# Warning: This script does not generate the compilation database these linters rely
# only on nor do they set the requisite build parameters. Make sure you do
# that *before* running this script.

cd "${BASE_ROOT_DIR}/build-ci/dashcore-${BUILD_TARGET}/src"
( run-clang-tidy -quiet "${MAKEJOBS}" ) | grep -C5 "error"

cd "${BASE_ROOT_DIR}/build-ci/dashcore-${BUILD_TARGET}"
iwyu_tool.py \
"src/compat" \
"src/init" \
"src/rpc/fees.cpp" \
"src/rpc/signmessage.cpp" \
-p . "${MAKEJOBS}" \
-- -Xiwyu --cxx17ns -Xiwyu --mapping_file="${BASE_ROOT_DIR}/contrib/devtools/iwyu/bitcoin.core.imp" \
2>&1 | tee "/tmp/iwyu_ci.out"

cd "${BASE_ROOT_DIR}/build-ci/dashcore-${BUILD_TARGET}/src"
fix_includes.py --nosafe_headers < /tmp/iwyu_ci.out
git --no-pager diff

0 comments on commit 55a0d0d

Please sign in to comment.