Cross-export Windows release package on Linux
All checks were successful
Core validation / Linux core gate (push) Successful in 1m40s
Linux release build / Linux x64 artifact (push) Successful in 1m37s
Linux release build / Publish tagged Gitea release (push) Has been skipped

This commit is contained in:
gamer147
2026-08-03 21:59:52 -04:00
parent 60ac6fc64f
commit 02e9891baa
19 changed files with 690 additions and 32 deletions

View File

@@ -53,27 +53,52 @@ class RangeReaderTests(unittest.TestCase):
"templates": {
"url": "https://invalid.example/templates.tpz",
"size": len(archive_bytes),
"members": [{
"archive_path": "templates/linux_release.x86_64",
"install_name": "linux_release.x86_64",
"sha256": hashlib.sha256(release).hexdigest(),
"size": len(release),
"mode": "0755",
}],
"members": [
{
"archive_path": "templates/linux_release.x86_64",
"install_name": "linux_release.x86_64",
"sha256": hashlib.sha256(release).hexdigest(),
"size": len(release),
"mode": "0755",
},
{
"archive_path": "templates/windows_release_x86_64.exe",
"install_name": "windows_release_x86_64.exe",
"sha256": hashlib.sha256(unused).hexdigest(),
"size": len(unused),
"mode": "0755",
},
],
}
}), encoding="utf-8")
destination = root / "templates"
with patch.object(install_godot_templates, "open_http_range_reader", return_value=reader()) as opened:
installed = install_godot_templates.install_members(manifest, destination)
installed = install_godot_templates.install_members(
manifest, destination, ("linux_release.x86_64",)
)
opened.assert_called_once()
self.assertEqual(release, installed[0].read_bytes())
self.assertFalse((destination / "windows_release_x86_64.exe").exists())
with patch.object(install_godot_templates, "open_http_range_reader") as opened:
reused = install_godot_templates.install_members(manifest, destination)
reused = install_godot_templates.install_members(
manifest, destination, ("linux_release.x86_64",)
)
opened.assert_not_called()
self.assertEqual(installed, reused)
def test_rejects_unknown_selected_member(self) -> None:
with tempfile.TemporaryDirectory() as temporary:
root = Path(temporary)
manifest = root / "manifest.json"
manifest.write_text(json.dumps({
"templates": {"members": [], "url": "unused", "size": 1}
}), encoding="utf-8")
with self.assertRaisesRegex(ValueError, "not found in the manifest"):
install_godot_templates.install_members(
manifest, root / "templates", ("missing-template",)
)
if __name__ == "__main__":
unittest.main()