mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-08 05:39:38 +02:00
Merge bitcoin/bitcoin#34583: ci: [refactor] Drop last use of pwsh
fa36adeb71ci: [refactor] Drop last use of pwsh (MarcoFalke)fae31b1e2fci: [refactor] Move github_import_vs_env to python script (MarcoFalke) Pull request description: The use of pwsh was a bit confusing and inconsistent around the exit code. See also https://github.com/bitcoin/bitcoin/pull/32672 I think it is fine to drop it and purely use Bash/Python. This also moves a bit of code from the github yaml to the python script. ACKs for top commit: m3dwards: Looks good! re-ACKfa36adeb71hodlinator: re-ACKfa36adeb71Tree-SHA512: 78edffc60c58c476b0acca5224150169d154b0b818114844a04295af9ba19b7cdf1fb2afb738f6cafd6172f0f477d546018ebf95061eb5bd8bbb35e065a129d4
This commit is contained in:
25
.github/ci-windows-cross.py
vendored
25
.github/ci-windows-cross.py
vendored
@@ -134,13 +134,13 @@ def run_unit_tests():
|
|||||||
|
|
||||||
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 = list(map(lambda f: f.__name__, [
|
||||||
"print_version",
|
print_version,
|
||||||
"check_manifests",
|
check_manifests,
|
||||||
"prepare_tests",
|
prepare_tests,
|
||||||
"run_unit_tests",
|
run_unit_tests,
|
||||||
"run_functional_tests",
|
run_functional_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()
|
||||||
|
|
||||||
@@ -149,16 +149,7 @@ def main():
|
|||||||
str(Path.cwd() / "previous_releases"),
|
str(Path.cwd() / "previous_releases"),
|
||||||
)
|
)
|
||||||
|
|
||||||
if args.step == "print_version":
|
exec(f'{args.step}()')
|
||||||
print_version()
|
|
||||||
elif args.step == "check_manifests":
|
|
||||||
check_manifests()
|
|
||||||
elif args.step == "prepare_tests":
|
|
||||||
prepare_tests()
|
|
||||||
elif args.step == "run_unit_tests":
|
|
||||||
run_unit_tests()
|
|
||||||
elif args.step == "run_functional_tests":
|
|
||||||
run_functional_tests()
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
51
.github/ci-windows.py
vendored
51
.github/ci-windows.py
vendored
@@ -38,6 +38,29 @@ GENERATE_OPTIONS = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def github_import_vs_env(_ci_type):
|
||||||
|
vswhere_path = Path(os.environ["ProgramFiles(x86)"]) / "Microsoft Visual Studio" / "Installer" / "vswhere.exe"
|
||||||
|
installation_path = run(
|
||||||
|
[str(vswhere_path), "-latest", "-property", "installationPath"],
|
||||||
|
capture_output=True,
|
||||||
|
text=True,
|
||||||
|
).stdout.strip()
|
||||||
|
vsdevcmd = Path(installation_path) / "Common7" / "Tools" / "vsdevcmd.bat"
|
||||||
|
comspec = os.environ["COMSPEC"]
|
||||||
|
output = run(
|
||||||
|
f'"{comspec}" /s /c ""{vsdevcmd}" -arch=x64 -no_logo && set"',
|
||||||
|
capture_output=True,
|
||||||
|
text=True,
|
||||||
|
).stdout
|
||||||
|
github_env = os.environ["GITHUB_ENV"]
|
||||||
|
with open(github_env, "a") as env_file:
|
||||||
|
for line in output.splitlines():
|
||||||
|
if "=" not in line:
|
||||||
|
continue
|
||||||
|
name, value = line.split("=", 1)
|
||||||
|
env_file.write(f"{name}={value}\n")
|
||||||
|
|
||||||
|
|
||||||
def generate(ci_type):
|
def generate(ci_type):
|
||||||
command = [
|
command = [
|
||||||
"cmake",
|
"cmake",
|
||||||
@@ -50,7 +73,7 @@ def generate(ci_type):
|
|||||||
run(command)
|
run(command)
|
||||||
|
|
||||||
|
|
||||||
def build():
|
def build(_ci_type):
|
||||||
command = [
|
command = [
|
||||||
"cmake",
|
"cmake",
|
||||||
"--build",
|
"--build",
|
||||||
@@ -180,26 +203,18 @@ def run_tests(ci_type):
|
|||||||
def main():
|
def main():
|
||||||
parser = argparse.ArgumentParser(description="Utility to run Windows CI steps.")
|
parser = argparse.ArgumentParser(description="Utility to run Windows CI steps.")
|
||||||
parser.add_argument("ci_type", choices=GENERATE_OPTIONS, help="CI type to run.")
|
parser.add_argument("ci_type", choices=GENERATE_OPTIONS, help="CI type to run.")
|
||||||
steps = [
|
steps = list(map(lambda f: f.__name__, [
|
||||||
"generate",
|
github_import_vs_env,
|
||||||
"build",
|
generate,
|
||||||
"check_manifests",
|
build,
|
||||||
"prepare_tests",
|
check_manifests,
|
||||||
"run_tests",
|
prepare_tests,
|
||||||
]
|
run_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()
|
||||||
|
|
||||||
if args.step == "generate":
|
exec(f'{args.step}("{args.ci_type}")')
|
||||||
generate(args.ci_type)
|
|
||||||
elif args.step == "build":
|
|
||||||
build()
|
|
||||||
elif args.step == "check_manifests":
|
|
||||||
check_manifests(args.ci_type)
|
|
||||||
elif args.step == "prepare_tests":
|
|
||||||
prepare_tests(args.ci_type)
|
|
||||||
elif args.step == "run_tests":
|
|
||||||
run_tests(args.ci_type)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
27
.github/workflows/ci.yml
vendored
27
.github/workflows/ci.yml
vendored
@@ -238,26 +238,19 @@ jobs:
|
|||||||
|
|
||||||
- *CHECKOUT
|
- *CHECKOUT
|
||||||
|
|
||||||
- &SET_UP_VS
|
- &IMPORT_VS_ENV
|
||||||
name: Set up VS Developer Prompt
|
name: Import Visual Studio env vars
|
||||||
shell: pwsh -Command "$PSVersionTable; $PSNativeCommandUseErrorActionPreference = $true; $ErrorActionPreference = 'Stop'; & '{0}'"
|
run: py -3 .github/ci-windows.py "standard" github_import_vs_env
|
||||||
run: |
|
|
||||||
$vswherePath = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
|
|
||||||
$installationPath = & $vswherePath -latest -property installationPath
|
|
||||||
& "${env:COMSPEC}" /s /c "`"$installationPath\Common7\Tools\vsdevcmd.bat`" -arch=x64 -no_logo && set" | foreach-object {
|
|
||||||
$name, $value = $_ -split '=', 2
|
|
||||||
echo "$name=$value" >> $env:GITHUB_ENV
|
|
||||||
}
|
|
||||||
|
|
||||||
- name: Get tool information
|
- name: Get tool information
|
||||||
shell: pwsh
|
|
||||||
run: |
|
run: |
|
||||||
cmake -version | Tee-Object -FilePath "cmake_version"
|
set -o errexit -o pipefail -o xtrace -o nounset
|
||||||
Write-Output "---"
|
|
||||||
msbuild -version | Tee-Object -FilePath "msbuild_version"
|
cmake -version | tee cmake_version
|
||||||
$env:VCToolsVersion | Tee-Object -FilePath "toolset_version"
|
echo '---'
|
||||||
|
msbuild.exe -version | tee msbuild_version
|
||||||
|
echo "${VCToolsVersion-}" | tee toolset_version
|
||||||
py -3 --version
|
py -3 --version
|
||||||
Write-Host "PowerShell version $($PSVersionTable.PSVersion.ToString())"
|
|
||||||
bash --version
|
bash --version
|
||||||
|
|
||||||
- name: Using vcpkg with MSBuild
|
- name: Using vcpkg with MSBuild
|
||||||
@@ -430,7 +423,7 @@ jobs:
|
|||||||
- name: Run bitcoind.exe
|
- name: Run bitcoind.exe
|
||||||
run: py -3 .github/ci-windows-cross.py print_version
|
run: py -3 .github/ci-windows-cross.py print_version
|
||||||
|
|
||||||
- *SET_UP_VS
|
- *IMPORT_VS_ENV
|
||||||
|
|
||||||
- name: Check executable manifests
|
- name: Check executable manifests
|
||||||
run: py -3 .github/ci-windows-cross.py check_manifests
|
run: py -3 .github/ci-windows-cross.py check_manifests
|
||||||
|
|||||||
Reference in New Issue
Block a user