v30.3-roots.1 · Commit 8: [PATCH 08/68] ci: restore Roots assurance on Core 30.3 interfaces
ci/test/test_windows_gui_workflows.py
Before: /dev/null · After: ci/test/test_windows_gui_workflows.py
File metadata
new file mode 100755 index 0000000000000000000000000000000000000000..b49ee06635f325255322a08d8ac8adc65e7eac03
Download original patch · Release notes
Diff rows 1–67 of 67. Line numbers refer to the original before/after files.
+ Added− RemovedUnmarked lines are context.
Scroll the code area horizontally to read long lines. The two line-number columns refer to before and after.
ci/test/test_windows_gui_workflows.py
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# Copyright (c) 2026-present The Bitcoin Roots developers
|
|
3
|
+
# Distributed under the MIT software license, see the accompanying
|
|
4
|
+
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
5
|
+
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
import re
|
|
8
|
+
import unittest
|
|
9
|
+
import xml.etree.ElementTree as ET
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
ROOT = Path(__file__).resolve().parents[2]
|
|
13
|
+
CI_WORKFLOW = ROOT / ".github/workflows/ci.yml"
|
|
14
|
+
RELEASE_WORKFLOW = ROOT / ".github/workflows/release.yml"
|
|
15
|
+
ROOTS_LOGO = ROOT / "src/qt/res/src/bitcoinroots-logo.svg"
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def job(workflow, name):
|
|
19
|
+
text = workflow.read_text(encoding="utf-8")
|
|
20
|
+
match = re.search(rf"(?ms)^ {re.escape(name)}:\n(.*?)(?=^ [a-z0-9_-]+:\n|\Z)", text)
|
|
21
|
+
if match is None:
|
|
22
|
+
raise AssertionError(f"Job {name!r} does not exist in {workflow}")
|
|
23
|
+
return match.group(1)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class WindowsGuiWorkflowTest(unittest.TestCase):
|
|
27
|
+
def test_roots_logo_preserves_icon_rendering_dimensions(self):
|
|
28
|
+
logo = ET.parse(ROOTS_LOGO).getroot()
|
|
29
|
+
self.assertEqual(logo.attrib["width"], "1in")
|
|
30
|
+
self.assertEqual(logo.attrib["height"], "1in")
|
|
31
|
+
|
|
32
|
+
_, _, viewbox_width, viewbox_height = logo.attrib["viewBox"].split()
|
|
33
|
+
self.assertEqual(viewbox_width, viewbox_height)
|
|
34
|
+
|
|
35
|
+
def assert_static_gui_assets(self, windows_job):
|
|
36
|
+
self.assertNotIn("setup-windows-gui-tools", windows_job)
|
|
37
|
+
self.assertNotIn("-DRSVG_CONVERT=", windows_job)
|
|
38
|
+
self.assertNotIn("-DIMAGEMAGICK_CONVERT=", windows_job)
|
|
39
|
+
for filename in ["bitcoin.ico", "bitcoin.icns", "bitcoin.png", "bitcoinroots-splash.png"]:
|
|
40
|
+
self.assertTrue((ROOT / "src/qt/res/icons" / filename).is_file(), filename)
|
|
41
|
+
gui_cmake = (ROOT / "src/qt/CMakeLists.txt").read_text(encoding="utf-8")
|
|
42
|
+
self.assertNotIn("find_program(RSVG_CONVERT", gui_cmake)
|
|
43
|
+
|
|
44
|
+
def test_pr_smoke_builds_and_tests_windows_gui(self):
|
|
45
|
+
windows_smoke = job(CI_WORKFLOW, "windows-smoke")
|
|
46
|
+
self.assert_static_gui_assets(windows_smoke)
|
|
47
|
+
self.assertIn("-DBUILD_GUI=ON", windows_smoke)
|
|
48
|
+
self.assertNotIn("-DBUILD_GUI=OFF", windows_smoke)
|
|
49
|
+
self.assertIn("-DBUILD_TESTS=ON", windows_smoke)
|
|
50
|
+
self.assertIn("ctest --test-dir build -C Release --output-on-failure", windows_smoke)
|
|
51
|
+
|
|
52
|
+
def test_release_builds_and_packages_windows_gui(self):
|
|
53
|
+
windows_release = job(RELEASE_WORKFLOW, "windows-release")
|
|
54
|
+
self.assert_static_gui_assets(windows_release)
|
|
55
|
+
self.assertIn("-DBUILD_GUI=ON", windows_release)
|
|
56
|
+
self.assertNotIn("-DBUILD_GUI=OFF", windows_release)
|
|
57
|
+
self.assertIn("-DWERROR=ON", windows_release)
|
|
58
|
+
self.assertIn("python ci/release/archive.py root-name", windows_release)
|
|
59
|
+
self.assertIn("Compress-Archive -Path $installDir", windows_release)
|
|
60
|
+
self.assertNotIn('Compress-Archive -Path (Join-Path $installDir "*")', windows_release)
|
|
61
|
+
self.assertIn("python ci/release/archive.py validate", windows_release)
|
|
62
|
+
self.assertIn('Join-Path $installDir "bin\\bitcoin-qt.exe"', windows_release)
|
|
63
|
+
self.assertIn("Test-Path -PathType Leaf", windows_release)
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
if __name__ == "__main__":
|
|
67
|
+
unittest.main()
|