Build TUI, web, desktop UI and runnable agent products from explicit prepared inputs. Keep dependency preparation separate from distribution packaging, with PM and native builds sharing uv environment construction. Docker copies compiled frontend products instead of build dependencies. Nix retains uv2nix environments and consumes shared assembly through store references. Native desktop and Termux use the same launcher and frontend contracts. Preserve the independent PM runtime and source imports from arbitrary working directories. Keep failed frontend builds from replacing the previous product, reject source/output overlap, and bound dependency-process output draining. Include hermes_wisdom in the Nix wheel: real CLI smoke tests exposed its missing package declaration on the base revision too. Verified focused Python and JavaScript suites, Docker build/runtime checks, Nix desktop and CLI/ACP checks, standalone TUI and packaged Electron PTY, and real full-Chromium interaction. Native signed installers, Android device installation and the full repository suite remain CI verification.
52 lines
2.0 KiB
Python
52 lines
2.0 KiB
Python
"""The image's non-root runtime uses its staged tools and generated assets."""
|
|
from __future__ import annotations
|
|
|
|
import subprocess
|
|
|
|
|
|
def test_python_uses_pm_interpreter_as_runtime_user(built_image: str) -> None:
|
|
probe = """
|
|
from pathlib import Path
|
|
import sys
|
|
from pm.lock import Facts
|
|
from pm.registry import get_package
|
|
from pm.store import current_target
|
|
|
|
store = Path('/opt/hermes/tools')
|
|
assert not list(store.glob('fetch-*')), 'completed download archives must not ship'
|
|
fact = Facts(store / 'facts.json').get('python')
|
|
expected = get_package('python').binary(store / fact['entry'], current_target())
|
|
assert Path(sys._base_executable).resolve() == expected.resolve()
|
|
import hermes_yaml as yaml
|
|
print('PM interpreter and application dependencies load as hermes')
|
|
"""
|
|
result = subprocess.run(
|
|
["docker", "run", "--rm", "--network", "none", "--user", "hermes",
|
|
"--entrypoint", "/opt/hermes/.venv/bin/python", built_image, "-c", probe],
|
|
capture_output=True, text=True, timeout=60,
|
|
)
|
|
assert result.returncode == 0, result.stdout + result.stderr
|
|
|
|
|
|
def test_dashboard_ships_generated_icon_without_build_environment(built_image: str) -> None:
|
|
probe = """
|
|
from pathlib import Path
|
|
import importlib.util
|
|
from PIL import Image
|
|
|
|
with Image.open('/opt/hermes/hermes_cli/web_dist/favicon.ico') as image:
|
|
image.load()
|
|
assert image.width > 0 and image.height > 0
|
|
assert importlib.util.find_spec('resvg_py') is None
|
|
assert not Path('/opt/hermes/.cache/icon-build').exists()
|
|
assert not Path('/opt/hermes/node_modules/vite').exists()
|
|
assert not Path('/opt/hermes/node_modules/esbuild').exists()
|
|
assert Path('/opt/hermes/node_modules/typescript/bin/tsc').is_file()
|
|
"""
|
|
result = subprocess.run(
|
|
["docker", "run", "--rm", "--network", "none", "--user", "hermes",
|
|
"--entrypoint", "/opt/hermes/.venv/bin/python", built_image, "-c", probe],
|
|
capture_output=True, text=True, timeout=60,
|
|
)
|
|
assert result.returncode == 0, result.stdout + result.stderr
|