Skip to content

Commit 277036f

Browse files
committed
Merge remote-tracking branch 'upstream/master'
Merge v31
2 parents d4c09db + 3f09a47 commit 277036f

1,898 files changed

Lines changed: 77768 additions & 39416 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/ISSUE_TEMPLATE/bug.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ body:
7878
id: os
7979
attributes:
8080
label: Operating system and version
81-
placeholder: e.g. "MacOS Ventura 13.2" or "Ubuntu 22.04 LTS"
81+
placeholder: e.g. "MacOS 26.0" or "Ubuntu 26.04 LTS"
8282
validations:
8383
required: true
8484
- type: textarea
@@ -90,4 +90,3 @@ body:
9090
e.g. OS/CPU and disk type, network connectivity
9191
validations:
9292
required: false
93-
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: 'Clear unnecessary files'
2+
description: 'Clear out unnecessary files to make space on the VM'
3+
runs:
4+
using: 'composite'
5+
steps:
6+
- name: Clear unnecessary files
7+
shell: bash
8+
env:
9+
DEBIAN_FRONTEND: noninteractive
10+
run: |
11+
set +o errexit
12+
sudo bash -c '(ionice -c 3 nice -n 19 rm -rf /usr/share/dotnet/ /usr/local/graalvm/ /usr/local/.ghcup/ /usr/local/share/powershell /usr/local/share/chromium /usr/local/lib/android /usr/local/lib/node_modules)&'

.github/actions/configure-docker/action.yml

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,34 @@ inputs:
44
cache-provider:
55
description: 'gha or cirrus cache provider'
66
required: true
7-
options:
8-
- gh
9-
- cirrus
107
runs:
118
using: 'composite'
129
steps:
10+
- name: Check inputs
11+
shell: python
12+
run: |
13+
# We expect only gha or cirrus as inputs to cache-provider
14+
if "${{ inputs.cache-provider }}" not in ("gha", "cirrus"):
15+
print("::warning title=Unknown input to configure docker action::Provided value was ${{ inputs.cache-provider }}")
16+
1317
- name: Set up Docker Buildx
14-
uses: docker/setup-buildx-action@v3
18+
uses: docker/setup-buildx-action@v4
1519
with:
1620
# Use host network to allow access to cirrus gha cache running on the host
1721
driver-opts: |
1822
network=host
1923
2024
# This is required to allow buildkit to access the actions cache
2125
- name: Expose actions cache variables
22-
uses: actions/github-script@v6
26+
uses: actions/github-script@v8
2327
with:
2428
script: |
25-
core.exportVariable('ACTIONS_CACHE_URL', process.env['ACTIONS_CACHE_URL'])
26-
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env['ACTIONS_RUNTIME_TOKEN'])
29+
Object.keys(process.env).forEach(function (key) {
30+
if (key.startsWith('ACTIONS_')) {
31+
core.info(`Exporting ${key}`);
32+
core.exportVariable(key, process.env[key]);
33+
}
34+
});
2735
2836
- name: Construct docker build cache args
2937
shell: bash
@@ -44,8 +52,8 @@ runs:
4452
# Always optimistically --cache‑from in case a cache blob exists
4553
args=(--cache-from "type=gha${url_args:+,${url_args}},scope=${CONTAINER_NAME}")
4654
47-
# If this is a push to the default branch, also add --cache‑to to save the cache
48-
if [[ ${{ github.event_name }} == "push" && ${{ github.ref_name }} == ${{ github.event.repository.default_branch }} ]]; then
55+
# Only add --cache-to when using the Cirrus cache provider and pushing to the default branch.
56+
if [[ ${{ inputs.cache-provider }} == 'cirrus' && ${{ github.event_name }} == "push" && ${{ github.ref_name }} == ${{ github.event.repository.default_branch }} ]]; then
4957
args+=(--cache-to "type=gha${url_args:+,${url_args}},mode=max,ignore-error=true,scope=${CONTAINER_NAME}")
5058
fi
5159

.github/actions/restore-caches/action.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ runs:
55
steps:
66
- name: Restore Ccache cache
77
id: ccache-cache
8-
uses: cirruslabs/cache/restore@v4
8+
uses: cirruslabs/cache/restore@v5
99
with:
1010
path: ${{ env.CCACHE_DIR }}
1111
key: ccache-${{ env.CONTAINER_NAME }}-${{ github.run_id }}
@@ -14,7 +14,7 @@ runs:
1414
1515
- name: Restore depends sources cache
1616
id: depends-sources
17-
uses: cirruslabs/cache/restore@v4
17+
uses: cirruslabs/cache/restore@v5
1818
with:
1919
path: ${{ env.SOURCES_PATH }}
2020
key: depends-sources-${{ env.CONTAINER_NAME }}-${{ env.DEPENDS_HASH }}
@@ -23,7 +23,7 @@ runs:
2323
2424
- name: Restore built depends cache
2525
id: depends-built
26-
uses: cirruslabs/cache/restore@v4
26+
uses: cirruslabs/cache/restore@v5
2727
with:
2828
path: ${{ env.BASE_CACHE }}
2929
key: depends-built-${{ env.CONTAINER_NAME }}-${{ env.DEPENDS_HASH }}
@@ -32,7 +32,7 @@ runs:
3232
3333
- name: Restore previous releases cache
3434
id: previous-releases
35-
uses: cirruslabs/cache/restore@v4
35+
uses: cirruslabs/cache/restore@v5
3636
with:
3737
path: ${{ env.PREVIOUS_RELEASES_DIR }}
3838
key: previous-releases-${{ env.CONTAINER_NAME }}-${{ env.PREVIOUS_RELEASES_HASH }}

.github/actions/save-caches/action.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,28 +11,28 @@ runs:
1111
echo "previous releases direct cache hit to primary key: ${{ env.previous-releases-cache-hit }}"
1212
1313
- name: Save Ccache cache
14-
uses: cirruslabs/cache/save@v4
14+
uses: cirruslabs/cache/save@v5
1515
if: ${{ (github.event_name == 'push') && (github.ref_name == github.event.repository.default_branch) }}
1616
with:
1717
path: ${{ env.CCACHE_DIR }}
1818
key: ccache-${{ env.CONTAINER_NAME }}-${{ github.run_id }}
1919

2020
- name: Save depends sources cache
21-
uses: cirruslabs/cache/save@v4
21+
uses: cirruslabs/cache/save@v5
2222
if: ${{ (github.event_name == 'push') && (github.ref_name == github.event.repository.default_branch) && (env.depends-sources-cache-hit != 'true') }}
2323
with:
2424
path: ${{ env.SOURCES_PATH }}
2525
key: depends-sources-${{ env.CONTAINER_NAME }}-${{ env.DEPENDS_HASH }}
2626

2727
- name: Save built depends cache
28-
uses: cirruslabs/cache/save@v4
28+
uses: cirruslabs/cache/save@v5
2929
if: ${{ (github.event_name == 'push') && (github.ref_name == github.event.repository.default_branch) && (env.depends-built-cache-hit != 'true' )}}
3030
with:
3131
path: ${{ env.BASE_CACHE }}
3232
key: depends-built-${{ env.CONTAINER_NAME }}-${{ env.DEPENDS_HASH }}
3333

3434
- name: Save previous releases cache
35-
uses: cirruslabs/cache/save@v4
35+
uses: cirruslabs/cache/save@v5
3636
if: ${{ (github.event_name == 'push') && (github.ref_name == github.event.repository.default_branch) && (env.previous-releases-cache-hit != 'true' )}}
3737
with:
3838
path: ${{ env.PREVIOUS_RELEASES_DIR }}

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

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,24 @@
1010

1111
def run(cmd, **kwargs):
1212
print("+ " + shlex.join(cmd), flush=True)
13+
kwargs.setdefault("check", True)
1314
try:
14-
return subprocess.run(cmd, check=True, **kwargs)
15+
return subprocess.run(cmd, **kwargs)
1516
except Exception as e:
16-
sys.exit(e)
17+
sys.exit(str(e))
1718

1819

1920
def main():
2021
print("Running tests on commit ...")
2122
run(["git", "log", "-1"])
2223

2324
num_procs = int(run(["nproc"], stdout=subprocess.PIPE).stdout)
25+
build_dir = "ci_build"
2426

2527
run([
2628
"cmake",
2729
"-B",
28-
"build",
30+
build_dir,
2931
"-Werror=dev",
3032
# Use clang++, because it is a bit faster and uses less memory than g++
3133
"-DCMAKE_C_COMPILER=clang",
@@ -36,29 +38,31 @@ def main():
3638
"-DAPPEND_CXXFLAGS='-O3 -g2'",
3739
"-DAPPEND_CFLAGS='-O3 -g2'",
3840
"-DCMAKE_BUILD_TYPE=Debug",
39-
"-DWERROR=ON",
40-
"-DWITH_ZMQ=ON",
41-
"-DBUILD_GUI=ON",
42-
"-DBUILD_BENCH=ON",
43-
"-DBUILD_FUZZ_BINARY=ON",
44-
"-DWITH_USDT=ON",
41+
"-DCMAKE_COMPILE_WARNING_AS_ERROR=ON",
42+
"--preset=dev-mode",
43+
# Tolerate unused member functions in intermediate commits in a pull request
4544
"-DCMAKE_CXX_FLAGS=-Wno-error=unused-member-function",
4645
])
47-
run(["cmake", "--build", "build", "-j", str(num_procs)])
46+
47+
if run(["cmake", "--build", build_dir, "-j", str(num_procs)], check=False).returncode != 0:
48+
print("Build failure. Verbose build follows.")
49+
run(["cmake", "--build", build_dir, "-j1", "--verbose"])
50+
4851
run([
4952
"ctest",
5053
"--output-on-failure",
5154
"--stop-on-failure",
5255
"--test-dir",
53-
"build",
56+
build_dir,
5457
"-j",
5558
str(num_procs),
5659
])
5760
run([
5861
sys.executable,
59-
"./build/test/functional/test_runner.py",
62+
f"./{build_dir}/test/functional/test_runner.py",
6063
"-j",
6164
str(num_procs * 2),
65+
"--failfast",
6266
"--combinedlogslen=99999999",
6367
])
6468

.github/ci-windows-cross.py

Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
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 argparse
7+
import os
8+
import shlex
9+
import subprocess
10+
import sys
11+
from pathlib import Path
12+
13+
sys.path.append(str(Path(__file__).resolve().parent.parent / "test"))
14+
from download_utils import download_script_assets
15+
16+
17+
def run(cmd, **kwargs):
18+
print("+ " + shlex.join(cmd), flush=True)
19+
kwargs.setdefault("check", True)
20+
try:
21+
return subprocess.run(cmd, **kwargs)
22+
except Exception as e:
23+
sys.exit(str(e))
24+
25+
26+
def print_version():
27+
bitcoind = Path.cwd() / "bin" / "bitcoind.exe"
28+
run([str(bitcoind), "-version"])
29+
30+
31+
def check_manifests():
32+
release_dir = Path.cwd() / "bin"
33+
manifest_path = release_dir / "bitcoind.manifest"
34+
35+
cmd_bitcoind_manifest = [
36+
"mt.exe",
37+
"-nologo",
38+
f"-inputresource:{release_dir / 'bitcoind.exe'}",
39+
f"-out:{manifest_path}",
40+
]
41+
run(cmd_bitcoind_manifest)
42+
print(manifest_path.read_text())
43+
44+
skipped = { # Skip as they currently do not have manifests
45+
"fuzz.exe",
46+
"bench_bitcoin.exe",
47+
}
48+
for entry in release_dir.iterdir():
49+
if entry.suffix.lower() != ".exe":
50+
continue
51+
if entry.name in skipped:
52+
print(f"Skipping {entry.name} (no manifest present)")
53+
continue
54+
print(f"Checking {entry.name}")
55+
run(["mt.exe", "-nologo", f"-inputresource:{entry}", "-validate_manifest"])
56+
57+
58+
def prepare_tests():
59+
workspace = Path.cwd()
60+
config_path = workspace / "test" / "config.ini"
61+
rpcauth_path = workspace / "share" / "rpcauth" / "rpcauth.py"
62+
replacements = {
63+
"SRCDIR=": f"SRCDIR={workspace}",
64+
"BUILDDIR=": f"BUILDDIR={workspace}",
65+
"RPCAUTH=": f"RPCAUTH={rpcauth_path}",
66+
}
67+
lines = config_path.read_text().splitlines()
68+
for index, line in enumerate(lines):
69+
for prefix, new_value in replacements.items():
70+
if line.startswith(prefix):
71+
lines[index] = new_value
72+
break
73+
content = "\n".join(lines) + "\n"
74+
config_path.write_text(content)
75+
print(content)
76+
previous_releases_dir = Path(os.environ["PREVIOUS_RELEASES_DIR"])
77+
cmd_download_prev_rel = [
78+
sys.executable,
79+
str(workspace / "test" / "get_previous_releases.py"),
80+
"--target-dir",
81+
str(previous_releases_dir),
82+
]
83+
run(cmd_download_prev_rel)
84+
run([sys.executable, "-m", "pip", "install", "pyzmq"])
85+
86+
dest = workspace / "unit_test_data"
87+
download_script_assets(dest)
88+
89+
90+
def run_functional_tests():
91+
workspace = Path.cwd()
92+
num_procs = str(os.process_cpu_count())
93+
test_runner_cmd = [
94+
sys.executable,
95+
str(workspace / "test" / "functional" / "test_runner.py"),
96+
"--jobs",
97+
num_procs,
98+
"--quiet",
99+
f"--tmpdirprefix={workspace}",
100+
"--combinedlogslen=99999999",
101+
*shlex.split(os.environ.get("TEST_RUNNER_EXTRA", "").strip()),
102+
# feature_unsupported_utxo_db.py fails on Windows because of emojis in the test data directory.
103+
"--exclude",
104+
"feature_unsupported_utxo_db.py",
105+
]
106+
run(test_runner_cmd)
107+
108+
# Run feature_unsupported_utxo_db sequentially in ASCII-only tmp dir,
109+
# because it is excluded above due to lack of UTF-8 support in the
110+
# ancient release.
111+
cmd_feature_unsupported_db = [
112+
sys.executable,
113+
str(workspace / "test" / "functional" / "feature_unsupported_utxo_db.py"),
114+
"--previous-releases",
115+
"--tmpdir",
116+
str(Path(workspace) / "test_feature_unsupported_utxo_db"),
117+
]
118+
run(cmd_feature_unsupported_db)
119+
120+
121+
def run_unit_tests():
122+
workspace = Path.cwd()
123+
os.environ["DIR_UNIT_TEST_DATA"] = str(workspace / "unit_test_data")
124+
# Can't use ctest here like other jobs as we don't have a CMake build tree.
125+
commands = [
126+
["./bin/test_bitcoin-qt.exe"],
127+
# Intentionally run sequentially here, to catch test case failures caused by dirty global state from prior test cases:
128+
["./bin/test_bitcoin.exe", "-l", "test_suite"],
129+
["./src/secp256k1/bin/exhaustive_tests.exe"],
130+
["./src/secp256k1/bin/noverify_tests.exe"],
131+
["./src/secp256k1/bin/tests.exe"],
132+
["./src/univalue/object.exe"],
133+
["./src/univalue/unitester.exe"],
134+
]
135+
for cmd in commands:
136+
run(cmd)
137+
138+
139+
def main():
140+
parser = argparse.ArgumentParser(description="Utility to run Windows CI steps.")
141+
steps = list(map(lambda f: f.__name__, [
142+
print_version,
143+
check_manifests,
144+
prepare_tests,
145+
run_unit_tests,
146+
run_functional_tests,
147+
]))
148+
parser.add_argument("step", choices=steps, help="CI step to perform.")
149+
args = parser.parse_args()
150+
151+
os.environ.setdefault(
152+
"PREVIOUS_RELEASES_DIR",
153+
str(Path.cwd() / "previous_releases"),
154+
)
155+
156+
exec(f'{args.step}()')
157+
158+
159+
if __name__ == "__main__":
160+
main()

0 commit comments

Comments
 (0)