Skip to content

Commit fac60b9

Browse files
author
MarcoFalke
committed
ci: Rewrite test-each-commit as py script
1 parent ae02413 commit fac60b9

File tree

3 files changed

+61
-22
lines changed

3 files changed

+61
-22
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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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)