File size: 1,342 Bytes
1dff7ff
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/usr/bin/env python3
"""Simple asset checker for CI: ensures benchmark.md and image assets exist.
Exits with non-zero if checks fail.
"""
from pathlib import Path
import sys

errors = []

benchmark = Path("src/benchmark.md")
if not benchmark.exists():
    errors.append("Missing src/benchmark.md")

images_dir = Path("src/Images")
if not images_dir.exists() or not any(images_dir.iterdir()):
    errors.append("Missing or empty src/Images directory")
else:
    # Optional: check that images referenced in streamlit_app.py exist
    # We'll parse simple occurs of src/Images/<name> in the file
    app_file = Path("src/streamlit_app.py")
    try:
        text = app_file.read_text()
        referenced = set()
        for part in text.split():
            if "src/Images/" in part:
                # strip punctuation
                candidate = part.strip("\"'(),")
                if candidate.startswith("src/Images/"):
                    referenced.add(candidate)
        for ref in referenced:
            p = Path(ref)
            if not p.exists():
                errors.append(f"Referenced image missing: {ref}")
    except Exception as e:
        errors.append(f"Could not read src/streamlit_app.py: {e}")

if errors:
    print("ASSET CHECK FAILED:\n" + "\n".join(errors))
    sys.exit(2)

print("Asset check passed")
sys.exit(0)