File size: 1,882 Bytes
1340dfb | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | """Run release-candidate acceptance checks; keep earlier phase reports untouched."""
import subprocess
import sys
from research.build import json_bytes
from scripts.generate_dataset import sanitize_log_output
from .audit import ROOT, RELEASE, main as write_audit
def main():
commands = [
['-m', 'pytest', '-q'],
['-m', 'scripts.generate_dataset', '--check'],
['-m', 'scripts.validate_dataset'],
['-m', 'research.build', '--check'],
['-m', 'research.harden', '--check'],
['-m', 'research.expansion.release', '--check'],
['-m', 'research.release_candidate.historical'],
['-m', 'research.release_candidate.exclusions'],
['-m', 'research.release_candidate.check_loading', '--write'],
]
results = []
for command in commands:
try:
run = subprocess.run([sys.executable, *command], cwd=ROOT,
capture_output=True, text=True, timeout=240)
result = dict(exit_code=run.returncode, stdout=sanitize_log_output(run.stdout),
stderr=sanitize_log_output(run.stderr))
except subprocess.TimeoutExpired:
result = dict(exit_code=124, stdout='', stderr='Acceptance command exceeded 240 seconds')
results.append(dict(command='python ' + ' '.join(command), **result))
print(results[-1]['command'], 'PASS' if result['exit_code'] == 0 else 'FAIL', flush=True)
if result['exit_code']:
print(result['stdout'], result['stderr'], flush=True)
(RELEASE / 'validation-results.json').write_bytes(json_bytes(results))
if any(result['exit_code'] for result in results):
raise SystemExit('Acceptance checks failed; no ready recommendation can be issued.')
write_audit()
from .report import main as report
report()
if __name__ == '__main__':
main()
|