Beijuka commited on
Commit
1dff7ff
·
verified ·
1 Parent(s): b8465ed

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. ci/check_assets.py +42 -0
ci/check_assets.py ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Simple asset checker for CI: ensures benchmark.md and image assets exist.
3
+ Exits with non-zero if checks fail.
4
+ """
5
+ from pathlib import Path
6
+ import sys
7
+
8
+ errors = []
9
+
10
+ benchmark = Path("src/benchmark.md")
11
+ if not benchmark.exists():
12
+ errors.append("Missing src/benchmark.md")
13
+
14
+ images_dir = Path("src/Images")
15
+ if not images_dir.exists() or not any(images_dir.iterdir()):
16
+ errors.append("Missing or empty src/Images directory")
17
+ else:
18
+ # Optional: check that images referenced in streamlit_app.py exist
19
+ # We'll parse simple occurs of src/Images/<name> in the file
20
+ app_file = Path("src/streamlit_app.py")
21
+ try:
22
+ text = app_file.read_text()
23
+ referenced = set()
24
+ for part in text.split():
25
+ if "src/Images/" in part:
26
+ # strip punctuation
27
+ candidate = part.strip("\"'(),")
28
+ if candidate.startswith("src/Images/"):
29
+ referenced.add(candidate)
30
+ for ref in referenced:
31
+ p = Path(ref)
32
+ if not p.exists():
33
+ errors.append(f"Referenced image missing: {ref}")
34
+ except Exception as e:
35
+ errors.append(f"Could not read src/streamlit_app.py: {e}")
36
+
37
+ if errors:
38
+ print("ASSET CHECK FAILED:\n" + "\n".join(errors))
39
+ sys.exit(2)
40
+
41
+ print("Asset check passed")
42
+ sys.exit(0)