48 lines
1.3 KiB
Python
48 lines
1.3 KiB
Python
"""Compare deterministic definitions and rendered artifacts."""
|
|
|
|
import hashlib
|
|
import json
|
|
|
|
from build_definition import OUT, REPO, canonical
|
|
from rebuild import RESOURCE, build_all
|
|
from render_report import main as render
|
|
|
|
|
|
def main():
|
|
(a, old) = build_all()
|
|
(b, previous) = build_all()
|
|
assert a == b and old == previous
|
|
assert a == json.loads((REPO / RESOURCE).read_bytes())
|
|
render()
|
|
paths = [
|
|
OUT / "fixed-source-index.json",
|
|
OUT.parent / "单人循环官流数字人固定参考中文说明.md",
|
|
]
|
|
before = {p.name: hashlib.sha256(p.read_bytes()).hexdigest() for p in paths}
|
|
render()
|
|
assert before == {p.name: hashlib.sha256(p.read_bytes()).hexdigest() for p in paths}
|
|
(OUT / "repeatability.json").write_text(
|
|
json.dumps(
|
|
{
|
|
"definitions": 138,
|
|
"repeated_build_equal": True,
|
|
"repeated_render_equal": True,
|
|
"resource_sha256": hashlib.sha256(canonical(a)).hexdigest(),
|
|
"artifacts": before,
|
|
},
|
|
ensure_ascii=False,
|
|
indent=2,
|
|
)
|
|
+ "\n"
|
|
)
|
|
print(
|
|
"PASS deterministic definitions"
|
|
+ " a"
|
|
+ ("nd rendered artifacts: zero di" + "ff")
|
|
+ "erence"
|
|
)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|