From fac60b9c4839d9525fbde5c0768d917d9bf59a93 Mon Sep 17 00:00:00 2001 From: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> Date: Wed, 4 Jun 2025 20:24:26 +0200 Subject: [PATCH 1/2] ci: Rewrite test-each-commit as py script --- .github/ci-test-each-commit-exec.py | 60 +++++++++++++++++++++++++++++ .github/ci-test-each-commit-exec.sh | 21 ---------- .github/workflows/ci.yml | 2 +- 3 files changed, 61 insertions(+), 22 deletions(-) create mode 100755 .github/ci-test-each-commit-exec.py delete mode 100755 .github/ci-test-each-commit-exec.sh diff --git a/.github/ci-test-each-commit-exec.py b/.github/ci-test-each-commit-exec.py new file mode 100755 index 00000000000..14b84cf1f22 --- /dev/null +++ b/.github/ci-test-each-commit-exec.py @@ -0,0 +1,60 @@ +#!/usr/bin/env python3 +# Copyright (c) The Bitcoin Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or https://opensource.org/license/mit/. + +import subprocess +import sys +import shlex + + +def run(cmd, **kwargs): + print("+ " + shlex.join(cmd), flush=True) + try: + return subprocess.run(cmd, check=True, **kwargs) + except Exception as e: + sys.exit(e) + + +def main(): + print("Running test-one-commit on ...") + run(["git", "log", "-1"]) + + num_procs = int(run(["nproc"], stdout=subprocess.PIPE).stdout) + + # Use clang++, because it is a bit faster and uses less memory than g++ + run([ + "cmake", + "-B", + "build", + "-DCMAKE_C_COMPILER=clang", + "-DCMAKE_CXX_COMPILER=clang++", + "-DWERROR=ON", + "-DWITH_ZMQ=ON", + "-DBUILD_GUI=ON", + "-DBUILD_BENCH=ON", + "-DBUILD_FUZZ_BINARY=ON", + "-DWITH_USDT=ON", + "-DCMAKE_CXX_FLAGS=-Wno-error=unused-member-function", + ]) + run(["cmake", "--build", "build", "-j", str(num_procs)]) + run([ + "ctest", + "--output-on-failure", + "--stop-on-failure", + "--test-dir", + "build", + "-j", + str(num_procs), + ]) + run([ + sys.executable, + "./build/test/functional/test_runner.py", + "-j", + str(num_procs * 2), + "--combinedlogslen=99999999", + ]) + + +if __name__ == "__main__": + main() diff --git a/.github/ci-test-each-commit-exec.sh b/.github/ci-test-each-commit-exec.sh deleted file mode 100755 index 7704866c44e..00000000000 --- a/.github/ci-test-each-commit-exec.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env bash -# -# Copyright (c) The Bitcoin 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 -o errexit -o pipefail -o xtrace - - -echo "Running test-one-commit on $( git log -1 )" - -# Use clang++, because it is a bit faster and uses less memory than g++ -CC=clang CXX=clang++ cmake -B build -DWERROR=ON -DWITH_ZMQ=ON -DBUILD_GUI=ON -DBUILD_BENCH=ON -DBUILD_FUZZ_BINARY=ON -DWITH_USDT=ON -DCMAKE_CXX_FLAGS='-Wno-error=unused-member-function' - -cmake --build build -j "$( nproc )" - -ctest --output-on-failure --stop-on-failure --test-dir build -j "$( nproc )" - -./build/test/functional/test_runner.py -j $(( $(nproc) * 2 )) --combinedlogslen=99999999 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 14421fba500..ec0a6633eef 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -81,7 +81,7 @@ jobs: - name: Compile and run tests run: | # Run tests on commits after the last merge commit and before the PR head commit - git rebase --exec "git merge --no-commit origin/${GITHUB_BASE_REF} && ./.github/ci-test-each-commit-exec.sh && git reset --hard" ${{ env.TEST_BASE }} + git rebase --exec "git merge --no-commit origin/${GITHUB_BASE_REF} && python3 ./.github/ci-test-each-commit-exec.py && git reset --hard" ${{ env.TEST_BASE }} macos-native-arm64: name: ${{ matrix.job-name }} From fa9cfdf3be754b01e6ce73a0cc2f998b81e12970 Mon Sep 17 00:00:00 2001 From: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> Date: Thu, 5 Jun 2025 10:18:23 +0200 Subject: [PATCH 2/2] ci: [doc] fix url redirect This solves an URL redirect. (The commit is also used to trigger the test-each-commit CI) --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ec0a6633eef..69c119d7371 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,6 @@ # Copyright (c) 2023-present The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying -# file COPYING or http://www.opensource.org/licenses/mit-license.php. +# file COPYING or https://opensource.org/license/mit. name: CI on: