Add the repo-side pieces for milestone 5: MIT licensing, real maintainer and forge metadata, a public support doc, 1.0.0 release notes, release-prep tooling, and CI uploads for the full candidate artifact set. Keep source-tree version surfaces honest by reading the local project version in the CLI and About dialog, and cover the new release-prep plus version-fallback behavior with focused tests. Document where raw validation evidence belongs, add the GA validation rollup, and archive the latest readiness review. Milestone 5 remains open until the forge release page is published and the milestone 2 and 3 matrices are filled with linked manual evidence. Validation: PYTHONPATH=src python3 -m unittest discover -s tests -p 'test_*.py'; PYTHONPATH=src python3 -m unittest tests.test_release_prep tests.test_portable_bundle tests.test_aman_cli tests.test_config_ui; python3 -m py_compile src/*.py tests/*.py; PYTHONPATH=src python3 -m aman version
88 lines
3.3 KiB
Python
88 lines
3.3 KiB
Python
import os
|
|
import subprocess
|
|
import tempfile
|
|
import unittest
|
|
from pathlib import Path
|
|
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
|
|
|
|
def _project_version() -> str:
|
|
for line in (ROOT / "pyproject.toml").read_text(encoding="utf-8").splitlines():
|
|
if line.startswith('version = "'):
|
|
return line.split('"')[1]
|
|
raise RuntimeError("project version not found")
|
|
|
|
|
|
def _write_file(path: Path, content: str) -> None:
|
|
path.parent.mkdir(parents=True, exist_ok=True)
|
|
path.write_text(content, encoding="utf-8")
|
|
|
|
|
|
class ReleasePrepScriptTests(unittest.TestCase):
|
|
def test_prepare_release_writes_sha256sums_for_expected_artifacts(self):
|
|
with tempfile.TemporaryDirectory() as tmp:
|
|
tmp_path = Path(tmp)
|
|
dist_dir = tmp_path / "dist"
|
|
arch_dir = dist_dir / "arch"
|
|
version = _project_version()
|
|
|
|
_write_file(dist_dir / f"aman-{version}-py3-none-any.whl", "wheel\n")
|
|
_write_file(dist_dir / f"aman-x11-linux-{version}.tar.gz", "portable\n")
|
|
_write_file(dist_dir / f"aman-x11-linux-{version}.tar.gz.sha256", "checksum\n")
|
|
_write_file(dist_dir / f"aman_{version}_amd64.deb", "deb\n")
|
|
_write_file(arch_dir / "PKGBUILD", "pkgbuild\n")
|
|
_write_file(arch_dir / f"aman-{version}.tar.gz", "arch-src\n")
|
|
|
|
env = os.environ.copy()
|
|
env["DIST_DIR"] = str(dist_dir)
|
|
|
|
subprocess.run(
|
|
["bash", "./scripts/prepare_release.sh"],
|
|
cwd=ROOT,
|
|
env=env,
|
|
text=True,
|
|
capture_output=True,
|
|
check=True,
|
|
)
|
|
|
|
sha256sums = (dist_dir / "SHA256SUMS").read_text(encoding="utf-8")
|
|
self.assertIn(f"./aman-{version}-py3-none-any.whl", sha256sums)
|
|
self.assertIn(f"./aman-x11-linux-{version}.tar.gz", sha256sums)
|
|
self.assertIn(f"./aman-x11-linux-{version}.tar.gz.sha256", sha256sums)
|
|
self.assertIn(f"./aman_{version}_amd64.deb", sha256sums)
|
|
self.assertIn(f"./arch/PKGBUILD", sha256sums)
|
|
self.assertIn(f"./arch/aman-{version}.tar.gz", sha256sums)
|
|
|
|
def test_prepare_release_fails_when_expected_artifact_is_missing(self):
|
|
with tempfile.TemporaryDirectory() as tmp:
|
|
tmp_path = Path(tmp)
|
|
dist_dir = tmp_path / "dist"
|
|
arch_dir = dist_dir / "arch"
|
|
version = _project_version()
|
|
|
|
_write_file(dist_dir / f"aman-{version}-py3-none-any.whl", "wheel\n")
|
|
_write_file(dist_dir / f"aman-x11-linux-{version}.tar.gz", "portable\n")
|
|
_write_file(dist_dir / f"aman-x11-linux-{version}.tar.gz.sha256", "checksum\n")
|
|
_write_file(arch_dir / "PKGBUILD", "pkgbuild\n")
|
|
_write_file(arch_dir / f"aman-{version}.tar.gz", "arch-src\n")
|
|
|
|
env = os.environ.copy()
|
|
env["DIST_DIR"] = str(dist_dir)
|
|
|
|
result = subprocess.run(
|
|
["bash", "./scripts/prepare_release.sh"],
|
|
cwd=ROOT,
|
|
env=env,
|
|
text=True,
|
|
capture_output=True,
|
|
check=False,
|
|
)
|
|
|
|
self.assertNotEqual(result.returncode, 0)
|
|
self.assertIn("missing required release artifact", result.stderr)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|