#!/usr/bin/env python3 """Reproduce release checks, with explicit required fixture/runtime inputs.""" import argparse import json import os from pathlib import Path import subprocess import sys ROOT = Path(__file__).resolve().parents[1] def main(): parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('--native-ui', required=True, type=Path) parser.add_argument('--audio-fixtures', required=True, type=Path) parser.add_argument('--pwsh', required=True, type=Path) parser.add_argument('--output', required=True, type=Path) args = parser.parse_args() args.output.mkdir(parents=True, exist_ok=True) env = dict(os.environ, RUEN_NATIVE_UI=str(args.native_ui.resolve()), RUEN_PWSH=str(args.pwsh.resolve()), PYTHONDONTWRITEBYTECODE='1') addon = str(ROOT / 'RuenUI') + '/' checks = [ ('profiles', ['luajit', 'tests/check-profiles.lua', addon]), ('layout-policy', ['luajit', 'tests/check-layout-policy.lua', addon]), ('layout-recovery', ['luajit', 'tests/check-layout-recovery.lua', addon]), ('pets', ['luajit', 'tests/check-pet-actions.lua', addon]), ('layout', ['luajit', 'tests/check-layout.lua', addon, 'unused', str(args.output.resolve() / 'matrix.txt')]), ('meter', ['luajit', 'tests/check-meter.lua', addon]), ('timers-optimizer', ['luajit', 'tests/check-timers-optimizer.lua', addon]), ('benchmark', ['luajit', 'tests/check-benchmark.lua', addon]), ('audio', ['luajit', 'tests/check-gun-audio.lua', str(args.audio_fixtures.resolve())]), ('installers', [sys.executable, '-m', 'unittest', 'discover', '-s', 'tests', '-v']), ] results = {'platform': sys.platform, 'nativeWindowsTested': False, 'liveGameTested': False, 'checks': []} for name, command in checks: with (args.output / (name + '.log')).open('w') as log: result = subprocess.run(command, cwd=ROOT, env=env, stdout=log, stderr=subprocess.STDOUT) results['checks'].append({'name': name, 'exitCode': result.returncode}) (args.output / 'results.json').write_text(json.dumps(results, indent=2) + '\n') print(name, 'PASS' if result.returncode == 0 else 'FAIL', flush=True) if result.returncode: print((args.output / (name + '.log')).read_text()[-4000:]) return result.returncode return 0 if __name__ == '__main__': raise SystemExit(main())