Skip to content

Commit 4b8ac9e

Browse files
committed
Merge bitcoin/bitcoin#32680: ci: Rewrite test-each-commit as py script
fa9cfdf ci: [doc] fix url redirect (MarcoFalke) fac60b9 ci: Rewrite test-each-commit as py script (MarcoFalke) Pull request description: This was requested in bitcoin/bitcoin#32573 (comment), as it is currently not possible to catch this type of error in a Bash linter (bitcoin/bitcoin#32573 (review)). 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: ACK fa9cfdf janb84: ACK bitcoin/bitcoin@fa9cfdf ryanofsky: Code review ACK fa9cfdf Tree-SHA512: d884795a1db6c0b762a514acfab200e8dead05fc60d2147d988198d0cdb468a24081bb143d505c51fa34207c52685d227496988503e5828a75e667dda7efef63
2 parents 157bbd0 + fa9cfdf commit 4b8ac9e

File tree

3 files changed

+62
-23
lines changed

3 files changed

+62
-23
lines changed

.github/ci-test-each-commit-exec.py

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#!/usr/bin/env python3
2+
# Copyright (c) The Bitcoin Core developers
3+
# Distributed under the MIT software license, see the accompanying
4+
# file COPYING or https://opensource.org/license/mit/.
5+
6+
import subprocess
7+
import sys
8+
import shlex
9+
10+
11+
def run(cmd, **kwargs):
12+
print("+ " + shlex.join(cmd), flush=True)
13+
try:
14+
return subprocess.run(cmd, check=True, **kwargs)
15+
except Exception as e:
16+
sys.exit(e)
17+
18+
19+
def main():
20+
print("Running test-one-commit on ...")
21+
run(["git", "log", "-1"])
22+
23+
num_procs = int(run(["nproc"], stdout=subprocess.PIPE).stdout)
24+
25+
# Use clang++, because it is a bit faster and uses less memory than g++
26+
run([
27+
"cmake",
28+
"-B",
29+
"build",
30+
"-DCMAKE_C_COMPILER=clang",
31+
"-DCMAKE_CXX_COMPILER=clang++",
32+
"-DWERROR=ON",
33+
"-DWITH_ZMQ=ON",
34+
"-DBUILD_GUI=ON",
35+
"-DBUILD_BENCH=ON",
36+
"-DBUILD_FUZZ_BINARY=ON",
37+
"-DWITH_USDT=ON",
38+
"-DCMAKE_CXX_FLAGS=-Wno-error=unused-member-function",
39+
])
40+
run(["cmake", "--build", "build", "-j", str(num_procs)])
41+
run([
42+
"ctest",
43+
"--output-on-failure",
44+
"--stop-on-failure",
45+
"--test-dir",
46+
"build",
47+
"-j",
48+
str(num_procs),
49+
])
50+
run([
51+
sys.executable,
52+
"./build/test/functional/test_runner.py",
53+
"-j",
54+
str(num_procs * 2),
55+
"--combinedlogslen=99999999",
56+
])
57+
58+
59+
if __name__ == "__main__":
60+
main()

.github/ci-test-each-commit-exec.sh

Lines changed: 0 additions & 21 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Copyright (c) 2023-present The Bitcoin Core developers
22
# Distributed under the MIT software license, see the accompanying
3-
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
3+
# file COPYING or https://opensource.org/license/mit.
44

55
name: CI
66
on:
@@ -81,7 +81,7 @@ jobs:
8181
- name: Compile and run tests
8282
run: |
8383
# Run tests on commits after the last merge commit and before the PR head commit
84-
git rebase --exec "git merge --no-commit origin/${GITHUB_BASE_REF} && ./.github/ci-test-each-commit-exec.sh && git reset --hard" ${{ env.TEST_BASE }}
84+
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 }}
8585
8686
macos-native-arm64:
8787
name: ${{ matrix.job-name }}

0 commit comments

Comments
 (0)