youssefreda9 commited on
Commit
d3269a8
·
1 Parent(s): 02b9510

CI: Rewrite workflow — lightweight validation without torch/transformers dependency

Browse files
Files changed (1) hide show
  1. .github/workflows/deploy.yml +35 -21
.github/workflows/deploy.yml CHANGED
@@ -7,7 +7,7 @@ on:
7
  branches: [main]
8
 
9
  jobs:
10
- lint-and-validate:
11
  name: Validate Code
12
  runs-on: ubuntu-latest
13
  steps:
@@ -17,33 +17,48 @@ jobs:
17
  uses: actions/setup-python@v5
18
  with:
19
  python-version: '3.12'
20
- cache: 'pip'
21
 
22
- - name: Install dependencies
23
- run: pip install flask flask-cors python-dotenv
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
 
25
- - name: Validate Flask app imports
26
  run: |
27
- cd src && python -c "
28
- import sys; sys.path.insert(0, '.')
29
- from app import app
30
- print('✅ Flask app imports successfully')
31
- # Check critical routes exist
32
- rules = [rule.rule for rule in app.url_map.iter_rules()]
33
- assert '/api/health' in rules, '/api/health route missing'
34
- assert '/api/summarize' in rules, '/api/summarize route missing'
35
- assert '/api/analyze' in rules, '/api/analyze route missing'
36
- print('✅ All critical API routes registered')
37
- "
38
 
39
- - name: Validate Supabase meta tags exist
40
  run: |
41
- grep -q 'supabase-url' src/index.html && echo "✅ Supabase URL meta tag present" || exit 1
42
- grep -q 'supabase-anon-key' src/index.html && echo "✅ Supabase key meta tag present" || exit 1
 
 
 
 
 
 
 
43
 
44
  health-check:
45
  name: Post-Deploy Health Check
46
- needs: lint-and-validate
47
  if: github.ref == 'refs/heads/main' && github.event_name == 'push'
48
  runs-on: ubuntu-latest
49
  steps:
@@ -68,4 +83,3 @@ jobs:
68
  echo "❌ Backend health check failed"
69
  exit 1
70
  fi
71
-
 
7
  branches: [main]
8
 
9
  jobs:
10
+ validate:
11
  name: Validate Code
12
  runs-on: ubuntu-latest
13
  steps:
 
17
  uses: actions/setup-python@v5
18
  with:
19
  python-version: '3.12'
 
20
 
21
+ - name: Check Python syntax (all .py files)
22
+ run: |
23
+ echo "Checking Python syntax..."
24
+ find . -name "*.py" -not -path "./.git/*" -not -path "./archive/*" | while read f; do
25
+ python -m py_compile "$f" 2>&1 && echo " ✅ $f" || { echo " ❌ $f"; exit 1; }
26
+ done
27
+ echo "✅ All Python files have valid syntax"
28
+
29
+ - name: Verify critical files exist
30
+ run: |
31
+ for f in src/app.py src/model_loader.py src/hf_inference.py src/index.html \
32
+ src/nlp/__init__.py src/nlp/spelling/araspell_service.py \
33
+ src/nlp/grammar/grammar_service.py src/nlp/punctuation/punctuation_service.py \
34
+ Dockerfile Procfile requirements.txt; do
35
+ test -f "$f" && echo " ✅ $f" || { echo " ❌ MISSING: $f"; exit 1; }
36
+ done
37
+ echo "✅ All critical files present"
38
 
39
+ - name: Verify API routes defined in app.py
40
  run: |
41
+ for route in "/api/health" "/api/analyze" "/api/summarize" "/api/spelling" \
42
+ "/api/grammar" "/api/punctuation" "/api/quran"; do
43
+ grep -q "$route" src/app.py && echo " ✅ $route" || { echo " ❌ MISSING ROUTE: $route"; exit 1; }
44
+ done
45
+ echo "✅ All API routes defined"
 
 
 
 
 
 
46
 
47
+ - name: Validate Supabase meta tags in index.html
48
  run: |
49
+ grep -q 'supabase-url' src/index.html && echo " supabase-url meta tag" || exit 1
50
+ grep -q 'supabase-anon-key' src/index.html && echo " supabase-anon-key meta tag" || exit 1
51
+ echo "✅ Supabase tags present"
52
+
53
+ - name: Validate Dockerfile
54
+ run: |
55
+ grep -q 'EXPOSE' Dockerfile && echo " ✅ EXPOSE directive" || exit 1
56
+ grep -q 'gunicorn\|CMD' Dockerfile && echo " ✅ Startup command" || exit 1
57
+ echo "✅ Dockerfile valid"
58
 
59
  health-check:
60
  name: Post-Deploy Health Check
61
+ needs: validate
62
  if: github.ref == 'refs/heads/main' && github.event_name == 'push'
63
  runs-on: ubuntu-latest
64
  steps:
 
83
  echo "❌ Backend health check failed"
84
  exit 1
85
  fi