From fac9c7bd6635d59617949564b1c8075b8537a16b Mon Sep 17 00:00:00 2001 From: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> Date: Tue, 10 Feb 2026 11:51:31 +0100 Subject: [PATCH] ci: [refactor] Move config.ini rewrite to ci-windows-cross.py --- .github/ci-windows-cross.py | 23 +++++++++++++++++++++++ .github/workflows/ci.yml | 5 +---- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/.github/ci-windows-cross.py b/.github/ci-windows-cross.py index 4327d10ca60..bacaffa03cf 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 9efdb3c31c0..dff90ff856a 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: |