ci: [refactor] Move config.ini rewrite to ci-windows-cross.py
What changed, and why it matters
This commit is a straightforward internal cleanup of Bitcoin Core's Windows CI workflow. It moves the rewriting of test/config.ini from a PowerShell inline step in the GitHub Actions YAML file into a Python helper script. There is no change to what gets written, no user-facing behavior change, and no security relevance.
No security action needed. This is a normal CI refactor.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff refactors the CI step that adjusts paths in test/config.ini. Previously, a PowerShell one-liner in .github/workflows/ci.yml replaced SRCDIR, BUILDDIR, and RPCAUTH values with the GitHub workspace path. Now, an equivalent Python function prepare_tests() in .github/ci-windows-cross.py performs the same rewrite. The logic is functionally identical: it reads test/config.ini, replaces lines starting with SRCDIR=, BUILDDIR=, and RPCAUTH= with absolute workspace paths, writes the file back, and prints the content. The YAML now invokes this helper via py -3 .github/ci-windows-cross.py prepare_tests.
Changed components
.github/ci-windows-cross.py.github/workflows/ci.ymlInspect captured patch +24 / −4
diff --git a/.github/ci-windows-cross.py b/.github/ci-windows-cross.py
index 4327d10c..bacaffa0 100755
--- a/.github/ci-windows-cross.py
+++ b/.github/ci-windows-cross.py
@@ -52,11 +52,32 @@ def check_manifests():
run(["mt.exe", "-nologo", f"-inputresource:{entry}", "-validate_manifest"])
+def prepare_tests():
+ workspace = Path.cwd()
+ config_path = workspace / "test" / "config.ini"
+ rpcauth_path = workspace / "share" / "rpcauth" / "rpcauth.py"
+ replacements = {
+ "SRCDIR=": f"SRCDIR={workspace}",
+ "BUILDDIR=": f"BUILDDIR={workspace}",
+ "RPCAUTH=": f"RPCAUTH={rpcauth_path}",
+ }
+ lines = config_path.read_text().splitlines()
+ for index, line in enumerate(lines):
+ for prefix, new_value in replacements.items():
+ if line.startswith(prefix):
+ lines[index] = new_value
+ break
+ content = "\n".join(lines) + "\n"
+ config_path.write_text(content)
+ print(content)
+
+
def main():
parser = argparse.ArgumentParser(description="Utility to run Windows CI steps.")
steps = [
"print_version",
"check_manifests",
+ "prepare_tests",
]
parser.add_argument("step", choices=steps, help="CI step to perform.")
args = parser.parse_args()
@@ -65,6 +86,8 @@ def main():
print_version()
elif args.step == "check_manifests":
check_manifests()
+ elif args.step == "prepare_tests":
+ prepare_tests()
if __name__ == "__main__":
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 9efdb3c3..dff90ff8 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -426,10 +426,7 @@ jobs:
./src/univalue/unitester.exe
- name: Adjust paths in test/config.ini
- shell: pwsh
- run: |
- (Get-Content "test/config.ini") -replace '(?<=^SRCDIR=).*', '${{ github.workspace }}' -replace '(?<=^BUILDDIR=).*', '${{ github.workspace }}' -replace '(?<=^RPCAUTH=).*', '${{ github.workspace }}/share/rpcauth/rpcauth.py' | Set-Content "test/config.ini"
- Get-Content "test/config.ini"
+ run: py -3 .github/ci-windows-cross.py prepare_tests
- name: Set previous release directory
run: |
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.