63 lines
3.9 KiB
Python
63 lines
3.9 KiB
Python
from pathlib import Path
|
|
import hashlib,json,shutil,zipfile
|
|
root=Path(__file__).resolve().parent.parent
|
|
src=root/'Demon_v0.19';win=root/'Demon_v0.19_Windows';qa=root/'qa_v19'
|
|
markers={
|
|
'release-economy.log':'ALL ECONOMY TESTS PASSED',
|
|
'release-tests.log':'ALL WORKSHOP TESTS PASSED',
|
|
'release-ui.log':'PASS: actual mouse input',
|
|
'release-sentences.log':'ALL SENTENCE TESTS PASSED',
|
|
'release-hud.log':'ALL HUD TESTS PASSED',
|
|
'release-gait.log':'ALL GAIT TESTS PASSED',
|
|
'release-posture.log':'ALL POSTURE TESTS PASSED',
|
|
'release-visuals.log':'ALL VISUAL TESTS PASSED',
|
|
'release-audio.log':'PASS: real Ogg playback wraps',
|
|
'release-exit.log':'QUIT: main-menu exit action',
|
|
'release-capture.log':'ECONOMY_CAPTURE_BUILD:',
|
|
'release-probe.log':'BUILD_PROBE:',
|
|
'balance-simulation.log':'"policy":"invest"',
|
|
}
|
|
for name,marker in markers.items():
|
|
log=(qa/name).read_text(encoding='utf-8-sig')
|
|
assert marker in log,name
|
|
assert not any(s in log for s in ['ERROR:','Assertion failed','QA check failed']),name
|
|
probe=json.loads(next(s.split('BUILD_PROBE: ',1)[1] for s in (qa/'release-probe.log').read_text(encoding='utf-8-sig').splitlines() if 'BUILD_PROBE: ' in s))
|
|
assert probe['version']=='0.19' and probe['id']!='0.19-editor'
|
|
assert 'ECONOMY_CAPTURE_BUILD: '+probe['id'] in (qa/'release-capture.log').read_text(encoding='utf-8-sig')
|
|
assert probe['id'] in (qa/'build.log').read_text(encoding='utf-8-sig')
|
|
def sha(p):return hashlib.sha256(p.read_bytes()).hexdigest()
|
|
for name in ['README_RU.md','BALANCE.md','VISUAL_REFERENCES.md','AUDIO_CREDITS.md','MODEL_CREDITS.md','MODEL_LICENSE_CC0.txt','GODOT_LICENSE.txt']:
|
|
shutil.copy2(src/name,win/name)
|
|
for name in ['KellySlab-OFL.txt','RuslanDisplay-OFL.txt']:shutil.copy2(src/'art/fonts'/name,win/name)
|
|
(win/'QA').mkdir(exist_ok=True)
|
|
for name in [*markers,'balance_simulation.json']:shutil.copy2(qa/name,win/'QA'/name)
|
|
(src/'captures/v019').mkdir(parents=True,exist_ok=True)
|
|
shots=list((win/'captures/v019').glob('*.png'))
|
|
assert len(shots)==5
|
|
for shot in shots:shutil.copy2(shot,src/'captures/v019'/shot.name)
|
|
manifest={
|
|
'version':'0.19','build_id':probe['id'],'engine':'Godot 4.3.stable.official.77dcf97d8',
|
|
'binary_sha256':sha(win/'Demon.exe'),
|
|
'economy':{'spawn_interval_seconds':5,'queue_capacity':7,'level_cap':10,'tool_currency':'gold','helper_currency':'souls','heroine_currency':'level_points','penalty_grace_seconds':12,'penalty_interval_seconds':5,'protected_gold':60,'protected_souls':6,'penalty_removes_xp_or_upgrades':False},
|
|
'validation':{k:'passed' for k in markers},'economy_assertions':240,
|
|
'balance_model':{'policies':5,'seconds_per_policy':1200,'travel_approximation':True},
|
|
'source_sha256':{p.relative_to(src).as_posix():sha(p) for p in sorted(src.rglob('*')) if p.is_file() and '.godot' not in p.parts and p.suffix in ['.gd','.godot','.tscn','.tres','.gdshader','.cfg']},
|
|
}
|
|
(win/'BUILD_MANIFEST.json').write_text(json.dumps(manifest,ensure_ascii=False,indent=2),encoding='utf-8')
|
|
for folder,label in [(win,'Windows'),(src,'Source')]:
|
|
destination=root/f'Demon_v0.19_{label}.zip'
|
|
with zipfile.ZipFile(destination,'w',zipfile.ZIP_DEFLATED,compresslevel=6) as archive:
|
|
for path in sorted(folder.rglob('*')):
|
|
if not path.is_file() or '.godot' in path.parts:continue
|
|
rel=path.relative_to(folder)
|
|
if path.suffix=='.log' and path.parent!=win/'QA':continue
|
|
if rel.parts[0]=='captures' and ('v019' not in rel.parts or path.suffix!='.png'):continue
|
|
archive.write(path,Path(folder.name)/rel)
|
|
if label=='Source':
|
|
for name in ['build_v19.ps1','verify_v19.ps1','package_v19.py','fetch_windows_template.py']:archive.write(root/'tools'/name,Path('tools')/name)
|
|
with zipfile.ZipFile(destination) as archive:
|
|
assert archive.testzip() is None
|
|
if label=='Windows':assert hashlib.sha256(archive.read('Demon_v0.19_Windows/Demon.exe')).hexdigest()==manifest['binary_sha256']
|
|
print('VERIFIED',destination.name,destination.stat().st_size,'SHA256',sha(destination),flush=True)
|
|
print('BUILD_ID',probe['id'],flush=True)
|