v29.4-roots.1 · Commit 8: [PATCH 08/13] ci: restore assurance and isolate Core fixtures
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..dee73a7b92585514340a2a0d14eaba2304cb09b8
Download original patch · Release notes
Diff rows 1–77 of 77. 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,77 @@
|
|
|
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
|
+
GUI_TOOLS_ACTION = ROOT / ".github/actions/setup-windows-gui-tools/action.yml"
|
|
16
|
+
ROOTS_LOGO = ROOT / "src/qt/res/src/bitcoinroots-logo.svg"
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def job(workflow, name):
|
|
20
|
+
text = workflow.read_text(encoding="utf-8")
|
|
21
|
+
match = re.search(rf"(?ms)^ {re.escape(name)}:\n(.*?)(?=^ [a-z0-9_-]+:\n|\Z)", text)
|
|
22
|
+
if match is None:
|
|
23
|
+
raise AssertionError(f"Job {name!r} does not exist in {workflow}")
|
|
24
|
+
return match.group(1)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class WindowsGuiWorkflowTest(unittest.TestCase):
|
|
28
|
+
def test_roots_logo_preserves_icon_rendering_dimensions(self):
|
|
29
|
+
logo = ET.parse(ROOTS_LOGO).getroot()
|
|
30
|
+
self.assertEqual(logo.attrib["width"], "1in")
|
|
31
|
+
self.assertEqual(logo.attrib["height"], "1in")
|
|
32
|
+
|
|
33
|
+
_, _, viewbox_width, viewbox_height = logo.attrib["viewBox"].split()
|
|
34
|
+
self.assertEqual(viewbox_width, viewbox_height)
|
|
35
|
+
|
|
36
|
+
def assert_gui_asset_tools(self, windows_job):
|
|
37
|
+
self.assertIn("uses: ./.github/actions/setup-windows-gui-tools", windows_job)
|
|
38
|
+
self.assertLess(
|
|
39
|
+
windows_job.index("uses: ./.github/actions/setup-windows-gui-tools"),
|
|
40
|
+
windows_job.index("cmake -B build"),
|
|
41
|
+
)
|
|
42
|
+
self.assertIn('-DRSVG_CONVERT="$env:RSVG_CONVERT"', windows_job)
|
|
43
|
+
self.assertIn('-DIMAGEMAGICK_CONVERT="$env:IMAGEMAGICK_CONVERT"', windows_job)
|
|
44
|
+
|
|
45
|
+
def test_gui_asset_tools_are_pinned_and_exported(self):
|
|
46
|
+
gui_tools = GUI_TOOLS_ACTION.read_text(encoding="utf-8")
|
|
47
|
+
self.assertIn("choco install rsvg-convert --version=2.40.20", gui_tools)
|
|
48
|
+
self.assertIn("choco install imagemagick --version=7.1.2.2500", gui_tools)
|
|
49
|
+
self.assertIn("Get-Command rsvg-convert.exe", gui_tools)
|
|
50
|
+
self.assertIn("Get-Command magick.exe", gui_tools)
|
|
51
|
+
self.assertIn('"RSVG_CONVERT=$rsvgConvert" >> $env:GITHUB_ENV', gui_tools)
|
|
52
|
+
self.assertIn('"IMAGEMAGICK_CONVERT=$imagemagickConvert" >> $env:GITHUB_ENV', gui_tools)
|
|
53
|
+
|
|
54
|
+
def test_pr_smoke_builds_and_tests_windows_gui(self):
|
|
55
|
+
windows_smoke = job(CI_WORKFLOW, "windows-smoke")
|
|
56
|
+
self.assert_gui_asset_tools(windows_smoke)
|
|
57
|
+
self.assertIn("-DBUILD_GUI=ON", windows_smoke)
|
|
58
|
+
self.assertNotIn("-DBUILD_GUI=OFF", windows_smoke)
|
|
59
|
+
self.assertIn("-DBUILD_TESTS=ON", windows_smoke)
|
|
60
|
+
self.assertIn("ctest --test-dir build -C Release --output-on-failure", windows_smoke)
|
|
61
|
+
|
|
62
|
+
def test_release_builds_and_packages_windows_gui(self):
|
|
63
|
+
windows_release = job(RELEASE_WORKFLOW, "windows-release")
|
|
64
|
+
self.assert_gui_asset_tools(windows_release)
|
|
65
|
+
self.assertIn("-DBUILD_GUI=ON", windows_release)
|
|
66
|
+
self.assertNotIn("-DBUILD_GUI=OFF", windows_release)
|
|
67
|
+
self.assertIn("-DWERROR=ON", windows_release)
|
|
68
|
+
self.assertIn("python ci/release/archive.py root-name", windows_release)
|
|
69
|
+
self.assertIn("Compress-Archive -Path $installDir", windows_release)
|
|
70
|
+
self.assertNotIn('Compress-Archive -Path (Join-Path $installDir "*")', windows_release)
|
|
71
|
+
self.assertIn("python ci/release/archive.py validate", windows_release)
|
|
72
|
+
self.assertIn('Join-Path $installDir "bin\\bitcoin-qt.exe"', windows_release)
|
|
73
|
+
self.assertIn("Test-Path -PathType Leaf", windows_release)
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
if __name__ == "__main__":
|
|
77
|
+
unittest.main()
|