@@ -3,29 +3,56 @@ name: Build & Validate Question Bundles
33on :
44 push :
55 branches : [main]
6- paths : ['questions/**', 'utils/**', 'schemas/**']
6+ paths :
7+ - ' questions/**'
8+ - ' utils/**'
9+ - ' schemas/**'
710 pull_request :
8- paths : ['questions/**', 'utils/**', 'schemas/**']
11+ paths :
12+ - ' questions/**'
13+ - ' utils/**'
14+ - ' schemas/**'
915
1016jobs :
1117 format-validate :
1218 runs-on : ubuntu-latest
13-
1419 steps :
15- - uses : actions/checkout@v4
20+ - uses : actions/checkout@v4
21+
22+ - name : Set up Python
23+ uses : actions/setup-python@v5
24+ with :
25+ python-version : ' 3.12'
26+ cache : ' pip'
27+
28+ - name : Install deps
29+ run : |
30+ python -m pip install --upgrade pip
31+ python -m pip install "jsonschema>=4.0,<5"
1632
17- - name : Set up Python
18- uses : actions/setup-python@v5
19- with :
20- python-version : ' 3.12'
33+ # ---------- build ----------
34+ - name : Build bundles into /build
35+ run : python utils/build_bundle.py
2136
22- - name : Install deps
23- run : pip install jsonschema
37+ # (Optional) verify something was built
38+ - name : Check build outputs exist
39+ run : |
40+ test -d build || { echo "build/ does not exist"; exit 1; }
41+ ls -l build
42+ # Fail if no JSONs produced
43+ shopt -s nullglob
44+ files=(build/*.json)
45+ ((${#files[@]})) || { echo "No build/*.json files found"; exit 1; }
2446
25- # ---------- build ----------
26- - name : Build bundles into /build
27- run : python utils/build_bundle.py
47+ # ---------- validate ----------
48+ # Prefer NO args so your script defaults to build/*.json safely.
49+ - name : Validate bundles
50+ run : python utils/validate_questions.py
2851
29- # ---------- validate ----------
30- - name : Validate bundles
31- run : python utils/validate_questions.py build/*.json
52+ # ---------- artifact for debugging ----------
53+ - name : Upload build artifacts
54+ if : always()
55+ uses : actions/upload-artifact@v4
56+ with :
57+ name : question-bundles
58+ path : build/*.json
0 commit comments