fix(release): reject unpackageable tagged artifacts

This commit is contained in:
2026-07-21 12:58:15 +02:00
parent a18c7ea040
commit 78b601a2e5
3 changed files with 122 additions and 4 deletions

View File

@@ -2,6 +2,7 @@ from __future__ import annotations
import json
from pathlib import Path
import subprocess
import sys
import tempfile
import unittest
@@ -179,6 +180,46 @@ class VersionAlignmentTests(unittest.TestCase):
self.assertEqual("1.2.3", issues[0].expected)
self.assertEqual("1.2.4", issues[0].actual)
def test_release_refs_must_point_at_installable_versioned_artifacts(self) -> None:
with tempfile.TemporaryDirectory() as tmp:
workspace = Path(tmp)
meta = workspace / "govoplan"
core = workspace / "govoplan-core"
module = workspace / "govoplan-example"
meta.mkdir()
(core / "webui").mkdir(parents=True)
module.mkdir()
(meta / "requirements-release.txt").write_text(
"govoplan-example @ git+ssh://git@example.test/acme/govoplan-example.git@v1.2.3\n"
)
(core / "webui" / "package.release.json").write_text(
json.dumps(
{
"dependencies": {
"@govoplan/example-webui": (
"git+ssh://git@example.test/acme/govoplan-example.git#v1.2.3"
)
}
}
)
)
subprocess.run(["git", "init", "-q", str(module)], check=True)
subprocess.run(["git", "-C", str(module), "config", "user.email", "test@example.test"], check=True)
subprocess.run(["git", "-C", str(module), "config", "user.name", "Test"], check=True)
(module / "README.md").write_text("uninstallable release\n")
subprocess.run(["git", "-C", str(module), "add", "README.md"], check=True)
subprocess.run(["git", "-C", str(module), "commit", "-qm", "release"], check=True)
subprocess.run(["git", "-C", str(module), "tag", "v1.2.3"], check=True)
issues = release_composition_issues(meta, core_root=core)
self.assertEqual(2, len(issues))
self.assertEqual(
{"v1.2.3:pyproject.toml", "v1.2.3:webui/package.json"},
{issue.source for issue in issues},
)
self.assertTrue(all("must contain" in issue.message for issue in issues))
if __name__ == "__main__":
unittest.main()