mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-08-27 22:41:12 +02:00
Merge bitcoin/bitcoin#32680: ci: Rewrite test-each-commit as py script
fa9cfdf3be
ci: [doc] fix url redirect (MarcoFalke)fac60b9c48
ci: Rewrite test-each-commit as py script (MarcoFalke) Pull request description: This was requested in https://github.com/bitcoin/bitcoin/pull/32573#issuecomment-2897546693, as it is currently not possible to catch this type of error in a Bash linter (https://github.com/bitcoin/bitcoin/pull/32573#pullrequestreview-2857077463). Also, reviewers are not familiar with it and didn't catch the above bug either. (Thus, it is discouraged in the dev notes: https://github.com/bitcoin/bitcoin/blob/master/doc/developer-notes.md#scripts) So just use a simple python script. ACKs for top commit: achow101: ACKfa9cfdf3be
janb84: ACKfa9cfdf3be
ryanofsky: Code review ACKfa9cfdf3be
Tree-SHA512: d884795a1db6c0b762a514acfab200e8dead05fc60d2147d988198d0cdb468a24081bb143d505c51fa34207c52685d227496988503e5828a75e667dda7efef63
This commit is contained in:
60
.github/ci-test-each-commit-exec.py
vendored
Executable file
60
.github/ci-test-each-commit-exec.py
vendored
Executable file
@@ -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()
|
21
.github/ci-test-each-commit-exec.sh
vendored
21
.github/ci-test-each-commit-exec.sh
vendored
@@ -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
|
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
@@ -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:
|
||||
@@ -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 }}
|
||||
|
Reference in New Issue
Block a user