ci: Add check_manifests to ci-windows.py
This is mostly a refactor, except for placing the bitcoind.manifest into a different folder.
This commit is contained in:
2 files changed
+44
-18
No files matched your search
@@ -8,6 +8,7 @@ import os
|
|||||||
import shlex
|
import shlex
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
|
||||||
def run(cmd, **kwargs):
|
def run(cmd, **kwargs):
|
||||||
@@ -69,6 +70,45 @@ def build():
|
|||||||
run(command + ["-j1", "--verbose"])
|
run(command + ["-j1", "--verbose"])
|
||||||
|
|
||||||
|
|
||||||
|
def check_manifests(ci_type):
|
||||||
|
if ci_type != "standard":
|
||||||
|
print(f"Skipping manifest validation for '{ci_type}' ci type.")
|
||||||
|
return
|
||||||
|
|
||||||
|
release_dir = Path.cwd() / "build" / "bin" / "Release"
|
||||||
|
manifest_path = release_dir / "bitcoind.manifest"
|
||||||
|
cmd_bitcoind_manifest = [
|
||||||
|
"mt.exe",
|
||||||
|
"-nologo",
|
||||||
|
f"-inputresource:{release_dir / 'bitcoind.exe'}",
|
||||||
|
f"-out:{manifest_path}",
|
||||||
|
]
|
||||||
|
run(cmd_bitcoind_manifest)
|
||||||
|
print(manifest_path.read_text())
|
||||||
|
|
||||||
|
skips = { # Skip as they currently do not have manifests
|
||||||
|
"fuzz.exe",
|
||||||
|
"bench_bitcoin.exe",
|
||||||
|
"test_bitcoin-qt.exe",
|
||||||
|
"test_kernel.exe",
|
||||||
|
"bitcoin-chainstate.exe",
|
||||||
|
}
|
||||||
|
for entry in release_dir.iterdir():
|
||||||
|
if entry.suffix.lower() != ".exe":
|
||||||
|
continue
|
||||||
|
if entry.name in skips:
|
||||||
|
print(f"Skipping {entry.name} (no manifest present)")
|
||||||
|
continue
|
||||||
|
print(f"Checking {entry.name}")
|
||||||
|
cmd_check_manifest = [
|
||||||
|
"mt.exe",
|
||||||
|
"-nologo",
|
||||||
|
f"-inputresource:{entry}",
|
||||||
|
"-validate_manifest",
|
||||||
|
]
|
||||||
|
run(cmd_check_manifest)
|
||||||
|
|
||||||
|
|
||||||
def prepare_tests(ci_type):
|
def prepare_tests(ci_type):
|
||||||
if ci_type == "standard":
|
if ci_type == "standard":
|
||||||
run([sys.executable, "-m", "pip", "install", "pyzmq"])
|
run([sys.executable, "-m", "pip", "install", "pyzmq"])
|
||||||
@@ -150,6 +190,7 @@ def main():
|
|||||||
steps = [
|
steps = [
|
||||||
"generate",
|
"generate",
|
||||||
"build",
|
"build",
|
||||||
|
"check_manifests",
|
||||||
"prepare_tests",
|
"prepare_tests",
|
||||||
"run_tests",
|
"run_tests",
|
||||||
]
|
]
|
||||||
@@ -160,6 +201,8 @@ def main():
|
|||||||
generate(args.ci_type)
|
generate(args.ci_type)
|
||||||
elif args.step == "build":
|
elif args.step == "build":
|
||||||
build()
|
build()
|
||||||
|
elif args.step == "check_manifests":
|
||||||
|
check_manifests(args.ci_type)
|
||||||
elif args.step == "prepare_tests":
|
elif args.step == "prepare_tests":
|
||||||
prepare_tests(args.ci_type)
|
prepare_tests(args.ci_type)
|
||||||
elif args.step == "run_tests":
|
elif args.step == "run_tests":
|
||||||
|
|||||||
@@ -284,25 +284,8 @@ jobs:
|
|||||||
py -3 .github/ci-windows.py ${{ matrix.job-type }} build
|
py -3 .github/ci-windows.py ${{ matrix.job-type }} build
|
||||||
|
|
||||||
- name: Check executable manifests
|
- name: Check executable manifests
|
||||||
if: matrix.job-type == 'standard'
|
|
||||||
working-directory: build
|
|
||||||
shell: pwsh -Command "$PSVersionTable; $PSNativeCommandUseErrorActionPreference = $true; $ErrorActionPreference = 'Stop'; & '{0}'"
|
|
||||||
run: |
|
run: |
|
||||||
mt.exe -nologo -inputresource:bin\Release\bitcoind.exe -out:bitcoind.manifest
|
py -3 .github/ci-windows.py ${{ matrix.job-type }} check_manifests
|
||||||
Get-Content bitcoind.manifest
|
|
||||||
|
|
||||||
Get-ChildItem -Filter "bin\Release\*.exe" | ForEach-Object {
|
|
||||||
$exeName = $_.Name
|
|
||||||
|
|
||||||
# Skip as they currently do not have manifests
|
|
||||||
if ($exeName -eq "fuzz.exe" -or $exeName -eq "bench_bitcoin.exe" -or $exeName -eq "test_bitcoin-qt.exe" -or $exeName -eq "test_kernel.exe" -or $exeName -eq "bitcoin-chainstate.exe") {
|
|
||||||
Write-Host "Skipping $exeName (no manifest present)"
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
Write-Host "Checking $exeName"
|
|
||||||
& mt.exe -nologo -inputresource:$_.FullName -validate_manifest
|
|
||||||
}
|
|
||||||
|
|
||||||
- name: Prepare tests
|
- name: Prepare tests
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
Reference in new issue
Block a user