fix(build): sync VERSION file with semantic-release tags and add build time

- Update generate_build_metadata.sh to sync VERSION from latest git tag
- Change BUILD_DATE format from date-only to ISO 8601 with time (YYYY-MM-DDTHH:MM:SSZ)
- Fix VERSION file from 0.5.0 to 0.9.1 (matching latest git tag v0.9.1)
- Change version fallback from hardcoded '0.5.0-dev' to 'unknown' in config.py
- Update release.yml to commit all build metadata files (not just VERSION)
- Update BuildMetadata.md documentation to reflect automated versioning
- Add tests for build_date with time format and version unknown fallback

Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-02-11 14:42:37 +00:00
parent fac4758116
commit 037b4aa94e
7 changed files with 113 additions and 55 deletions
+35
View File
@@ -117,6 +117,22 @@ class TestBuildMetadataConfiguration:
auth_enabled=False
)
assert config.build_date == "2026-01-15"
def test_build_date_with_time_from_environment(self, monkeypatch):
"""Test that build_date supports ISO 8601 format with time."""
monkeypatch.setenv("BUILD_DATE", "2026-01-15T10:30:00Z")
config = Settings(
database_url="sqlite:///test.db",
redis_url="redis://localhost:6379",
openai_api_key="test",
azure_ai_key="test",
azure_region="test",
azure_endpoint="https://test.example.com",
gotenberg_url="http://localhost:3000",
workdir="/tmp",
auth_enabled=False
)
assert config.build_date == "2026-01-15T10:30:00Z"
def test_git_sha_from_environment(self, monkeypatch):
"""Test that git_sha is read from GIT_COMMIT_SHA environment variable."""
@@ -153,6 +169,25 @@ class TestBuildMetadataConfiguration:
)
# When no file or env var exists, should return "unknown"
assert config.git_sha == "unknown"
def test_version_default_when_no_file_or_env(self, monkeypatch, tmp_path):
"""Test that version defaults to 'unknown' when no VERSION file or env var exists."""
import app.config
monkeypatch.setattr(app.config.os.path, 'dirname', lambda x: str(tmp_path))
config = Settings(
database_url="sqlite:///test.db",
redis_url="redis://localhost:6379",
openai_api_key="test",
azure_ai_key="test",
azure_region="test",
azure_endpoint="https://test.example.com",
gotenberg_url="http://localhost:3000",
workdir="/tmp",
auth_enabled=False
)
# When no file or env var exists, should return "unknown"
assert config.version == "unknown"
def test_runtime_info_property(self):
"""Test that runtime_info returns build information."""