ci: [refactor] Move config.ini rewrite to ci-windows-cross.py
This commit is contained in:
2 files changed
+24
-4
No files matched your search
@@ -52,11 +52,32 @@ def check_manifests():
|
|||||||
run(["mt.exe", "-nologo", f"-inputresource:{entry}", "-validate_manifest"])
|
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():
|
def main():
|
||||||
parser = argparse.ArgumentParser(description="Utility to run Windows CI steps.")
|
parser = argparse.ArgumentParser(description="Utility to run Windows CI steps.")
|
||||||
steps = [
|
steps = [
|
||||||
"print_version",
|
"print_version",
|
||||||
"check_manifests",
|
"check_manifests",
|
||||||
|
"prepare_tests",
|
||||||
]
|
]
|
||||||
parser.add_argument("step", choices=steps, help="CI step to perform.")
|
parser.add_argument("step", choices=steps, help="CI step to perform.")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
@@ -65,6 +86,8 @@ def main():
|
|||||||
print_version()
|
print_version()
|
||||||
elif args.step == "check_manifests":
|
elif args.step == "check_manifests":
|
||||||
check_manifests()
|
check_manifests()
|
||||||
|
elif args.step == "prepare_tests":
|
||||||
|
prepare_tests()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
@@ -426,10 +426,7 @@ jobs:
|
|||||||
./src/univalue/unitester.exe
|
./src/univalue/unitester.exe
|
||||||
|
|
||||||
- name: Adjust paths in test/config.ini
|
- name: Adjust paths in test/config.ini
|
||||||
shell: pwsh
|
run: py -3 .github/ci-windows-cross.py prepare_tests
|
||||||
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"
|
|
||||||
|
|
||||||
- name: Set previous release directory
|
- name: Set previous release directory
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
Reference in new issue
Block a user