feat: badge versione build in GUI + build.sh con auto-bump
- VERSION (1.0.0) + build.sh: bump patch/minor/major e deploy via docker compose - Dockerfile: ARG/ENV APP_VERSION + BUILD_TIME (iniettati come build-arg) - version.build_info(): env in Docker, fallback file VERSION + '(local)' in dev - GET /api/version; badge #appVersionPill nell'header (tooltip = build time) - test_version.py: env vs fallback Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
a88a064aa8
commit
cf726b479e
8 files changed
+126
-1
No files matched your search
@@ -0,0 +1,25 @@
|
||||
"""Unit test per build_info(): env (Docker) vs fallback VERSION file (local)."""
|
||||
from __future__ import annotations
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from presa_mano.version import build_info
|
||||
|
||||
_VERSION_FILE = Path(__file__).resolve().parents[1] / "VERSION"
|
||||
|
||||
|
||||
def test_build_info_prefers_env(monkeypatch):
|
||||
monkeypatch.setenv("APP_VERSION", "1.2.3")
|
||||
monkeypatch.setenv("BUILD_TIME", "2026-06-03 14:22 UTC")
|
||||
info = build_info()
|
||||
assert info == {"version": "1.2.3", "build_time": "2026-06-03 14:22 UTC"}
|
||||
|
||||
|
||||
def test_build_info_falls_back_to_version_file(monkeypatch):
|
||||
monkeypatch.delenv("APP_VERSION", raising=False)
|
||||
monkeypatch.delenv("BUILD_TIME", raising=False)
|
||||
info = build_info()
|
||||
file_ver = _VERSION_FILE.read_text(encoding="utf-8").strip()
|
||||
assert file_ver in info["version"]
|
||||
assert info["version"].endswith("(local)")
|
||||
assert info["build_time"] == "(local)"
|
||||
Reference in new issue
Block a user