Some checks failed
Tests & Quality Checks / Test on Python 3.11 (push) Has been cancelled
Tests & Quality Checks / Test on Python 3.12 (push) Has been cancelled
Tests & Quality Checks / Test on Python 3.11-1 (push) Has been cancelled
Tests & Quality Checks / Test on Python 3.12-1 (push) Has been cancelled
Tests & Quality Checks / Test on Python 3.10 (push) Has been cancelled
Tests & Quality Checks / Test on Python 3.11-2 (push) Has been cancelled
Tests & Quality Checks / Test on Python 3.12-2 (push) Has been cancelled
Tests & Quality Checks / Build Artifacts (push) Has been cancelled
Tests & Quality Checks / Build Artifacts-1 (push) Has been cancelled
- Added support for multiple brands in release scripts, allowing for branded artifacts. - Introduced brand configuration management with JSON files for each brand. - Created a new `brand_config.py` script to handle brand-specific logic and asset resolution. - Updated `create_release.ps1` and `create_release.sh` scripts to utilize brand configurations and generate release manifests. - Added unit tests for brand configuration loading and release manifest generation. - Introduced `agravity` brand with its specific configuration in `agravity.json`.
77 lines
2.5 KiB
Python
77 lines
2.5 KiB
Python
"""Tests for brand-aware build configuration helpers."""
|
|
|
|
import json
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
BUILD_SCRIPTS_DIR = Path(__file__).resolve().parents[2] / "build" / "scripts"
|
|
if str(BUILD_SCRIPTS_DIR) not in sys.path:
|
|
sys.path.insert(0, str(BUILD_SCRIPTS_DIR))
|
|
|
|
from brand_config import generate_release_manifest, load_brand_config
|
|
|
|
|
|
def test_load_agravity_brand_config():
|
|
"""Test loading the Agravity brand manifest."""
|
|
brand = load_brand_config("agravity")
|
|
|
|
assert brand.brand_id == "agravity"
|
|
assert brand.display_name == "Agravity Bridge"
|
|
assert brand.asset_prefix == "AgravityBridge"
|
|
assert brand.exe_name == "AgravityBridge"
|
|
assert brand.windows_installer_name("0.8.4") == "AgravityBridge-0.8.4-win-x64.msi"
|
|
|
|
|
|
def test_generate_release_manifest_for_agravity(tmp_path):
|
|
"""Test generating a shared release manifest from local artifacts."""
|
|
project_root = tmp_path
|
|
(project_root / "build" / "brands").mkdir(parents=True)
|
|
(project_root / "build" / "dist" / "windows" / "agravity").mkdir(parents=True)
|
|
(project_root / "build" / "dist" / "macos" / "agravity").mkdir(parents=True)
|
|
|
|
source_manifest = Path(__file__).resolve().parents[2] / "build" / "brands" / "agravity.json"
|
|
(project_root / "build" / "brands" / "agravity.json").write_text(
|
|
source_manifest.read_text(encoding="utf-8"),
|
|
encoding="utf-8",
|
|
)
|
|
|
|
win_installer = (
|
|
project_root
|
|
/ "build"
|
|
/ "dist"
|
|
/ "windows"
|
|
/ "agravity"
|
|
/ "AgravityBridge-0.8.4-win-x64.msi"
|
|
)
|
|
win_installer.write_bytes(b"msi")
|
|
(win_installer.parent / f"{win_installer.name}.sha256").write_text("abc", encoding="utf-8")
|
|
|
|
mac_installer = (
|
|
project_root
|
|
/ "build"
|
|
/ "dist"
|
|
/ "macos"
|
|
/ "agravity"
|
|
/ "AgravityBridge-0.8.4-macos-universal.dmg"
|
|
)
|
|
mac_installer.write_bytes(b"dmg")
|
|
(mac_installer.parent / f"{mac_installer.name}.sha256").write_text("def", encoding="utf-8")
|
|
|
|
output_path = project_root / "build" / "dist" / "release-manifest.json"
|
|
generate_release_manifest(
|
|
"0.8.4",
|
|
["agravity"],
|
|
output_path=output_path,
|
|
root=project_root,
|
|
)
|
|
|
|
manifest = json.loads(output_path.read_text(encoding="utf-8"))
|
|
assert manifest["version"] == "0.8.4"
|
|
assert (
|
|
manifest["brands"]["agravity"]["windows-x64"]["installer"]
|
|
== "AgravityBridge-0.8.4-win-x64.msi"
|
|
)
|
|
assert (
|
|
manifest["brands"]["agravity"]["macos-universal"]["installer"]
|
|
== "AgravityBridge-0.8.4-macos-universal.dmg"
|
|
)
|