Merge bitcoin/bitcoin#34548: ci: Add and use ci-windows-cross.py helper

fa13b13239 ci: [refactor] Use pathlib over os.path (MarcoFalke)
fa2719ab1b ci: [refactor] Move run_unit_tests to ci-windows-cross.py (MarcoFalke)
fa99ba5f14 ci: Set PREVIOUS_RELEASES_DIR env var in ci-windows-cross.py (MarcoFalke)
fa4a1cab6c ci: Move run_functional_tests into ci-windows-cross.py (MarcoFalke)
1111108685 ci: [refactor] Move pyzmq install and get_previous_releases into ci-windows-cross.py (MarcoFalke)
fac9c7bd66 ci: [refactor] Move config.ini rewrite to ci-windows-cross.py (MarcoFalke)
faf7389466 ci: Move check_manifests step to ci-windows-cross.py (MarcoFalke)
fa674d55df ci: [refactor] Move print_version step into ci-windows-cross.py helper (MarcoFalke)

Pull request description:

  Currently the ci yaml has a mix of Bash and Pwsh snippets, which is problematic:

  * The `shellcheck` tool does not review the Bash
  * The ci yaml is not merged with master on re-runs, but the code is, leading to possibly confusing CI errors on re-runs
  * The Pwsh isn't reviewed at all by any tool
  * It is tedious to run the CI commands locally on Windows

  Fix all issues by extracting them into a step-based Python script.

ACKs for top commit:
  janb84:
    re ACK fa13b13239
  hebasto:
    ACK fa13b13239, I have reviewed the code and it looks OK.

Tree-SHA512: 23d21d3bfb07e102fe1cc15ba5749d553d9766ae6c4a7648bd77df0705469bd138c76a9a2fdeb4d91d3f889a425b7caf25878ecb2e68b604faf9665f8df4eb6d
This commit is contained in:
Hennadii Stepanov
2026-02-13 14:31:31 +00:00
3 changed files with 182 additions and 59 deletions

20
.github/ci-windows.py vendored
View File

@@ -106,7 +106,7 @@ def prepare_tests(ci_type):
if ci_type == "standard":
run([sys.executable, "-m", "pip", "install", "pyzmq"])
elif ci_type == "fuzz":
repo_dir = os.path.join(os.getcwd(), "qa-assets")
repo_dir = str(Path.cwd() / "qa-assets")
clone_cmd = [
"git",
"clone",
@@ -120,9 +120,9 @@ def prepare_tests(ci_type):
def run_tests(ci_type):
build_dir = "build"
build_dir = Path.cwd() / "build"
num_procs = str(os.process_cpu_count())
release_bin = os.path.join(os.getcwd(), build_dir, "bin", "Release")
release_bin = build_dir / "bin" / "Release"
if ci_type == "standard":
test_envs = {
@@ -136,12 +136,12 @@ def run_tests(ci_type):
"BITCOINCHAINSTATE": "bitcoin-chainstate.exe",
}
for var, exe in test_envs.items():
os.environ[var] = os.path.join(release_bin, exe)
os.environ[var] = str(release_bin / exe)
ctest_cmd = [
"ctest",
"--test-dir",
build_dir,
str(build_dir),
"--output-on-failure",
"--stop-on-failure",
"-j",
@@ -153,26 +153,26 @@ def run_tests(ci_type):
test_cmd = [
sys.executable,
os.path.join(build_dir, "test", "functional", "test_runner.py"),
str(build_dir / "test" / "functional" / "test_runner.py"),
"--jobs",
num_procs,
"--quiet",
f"--tmpdirprefix={os.getcwd()}",
f"--tmpdirprefix={Path.cwd()}",
"--combinedlogslen=99999999",
*shlex.split(os.environ.get("TEST_RUNNER_EXTRA", "").strip()),
]
run(test_cmd)
elif ci_type == "fuzz":
os.environ["BITCOINFUZZ"] = os.path.join(release_bin, "fuzz.exe")
os.environ["BITCOINFUZZ"] = str(release_bin / "fuzz.exe")
fuzz_cmd = [
sys.executable,
os.path.join(build_dir, "test", "fuzz", "test_runner.py"),
str(build_dir / "test" / "fuzz" / "test_runner.py"),
"--par",
num_procs,
"--loglevel",
"DEBUG",
os.path.join(os.getcwd(), "qa-assets", "fuzz_corpora"),
str(Path.cwd() / "qa-assets" / "fuzz_corpora"),
]
run(fuzz_cmd)