|
| 1 | +name: CI/CD Pipeline |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ main ] |
| 6 | + pull_request: |
| 7 | + branches: [ main ] |
| 8 | + |
| 9 | +jobs: |
| 10 | + # 1. Backend Testing & Security Verification |
| 11 | + backend-test: |
| 12 | + name: Backend Test Suite & Security Checks |
| 13 | + runs-on: ubuntu-latest |
| 14 | + |
| 15 | + services: |
| 16 | + redis: |
| 17 | + image: redis:7-alpine |
| 18 | + ports: |
| 19 | + - 6379:6379 |
| 20 | + options: >- |
| 21 | + --health-cmd "redis-cli ping" |
| 22 | + --health-interval 10s |
| 23 | + --health-timeout 5s |
| 24 | + --health-retries 5 |
| 25 | +
|
| 26 | + steps: |
| 27 | + - name: Checkout Code |
| 28 | + uses: actions/checkout@v4 |
| 29 | + |
| 30 | + - name: Setup Node.js 20 |
| 31 | + uses: actions/setup-node@v4 |
| 32 | + with: |
| 33 | + node-version: 20 |
| 34 | + cache: 'npm' |
| 35 | + cache-dependency-path: backend/package-lock.json |
| 36 | + |
| 37 | + - name: Install Backend Dependencies |
| 38 | + working-directory: ./backend |
| 39 | + run: npm ci |
| 40 | + |
| 41 | + - name: Run Backend Tests |
| 42 | + working-directory: ./backend |
| 43 | + env: |
| 44 | + NODE_ENV: test |
| 45 | + PORT: 8000 |
| 46 | + REDIS_URL: redis://localhost:6379 |
| 47 | + JWT_SECRET: test_jwt_secret_key_12345 |
| 48 | + run: npm test |
| 49 | + |
| 50 | + # 2. Frontend Build & Quality Checks |
| 51 | + frontend-build: |
| 52 | + name: Frontend Build Verification |
| 53 | + runs-on: ubuntu-latest |
| 54 | + |
| 55 | + steps: |
| 56 | + - name: Checkout Code |
| 57 | + uses: actions/checkout@v4 |
| 58 | + |
| 59 | + - name: Setup Node.js 20 |
| 60 | + uses: actions/setup-node@v4 |
| 61 | + with: |
| 62 | + node-version: 20 |
| 63 | + cache: 'npm' |
| 64 | + cache-dependency-path: frontend/package-lock.json |
| 65 | + |
| 66 | + - name: Install Frontend Dependencies |
| 67 | + working-directory: ./frontend |
| 68 | + run: npm ci |
| 69 | + |
| 70 | + - name: Build Frontend Assets |
| 71 | + working-directory: ./frontend |
| 72 | + env: |
| 73 | + VITE_API_URL: http://localhost:8000 |
| 74 | + run: npm run build |
| 75 | + |
| 76 | + # 3. Python AI Proctoring Service Syntax & Integrity Checks |
| 77 | + python-proctoring-check: |
| 78 | + name: Python AI Proctoring Integrity Check |
| 79 | + runs-on: ubuntu-latest |
| 80 | + |
| 81 | + steps: |
| 82 | + - name: Checkout Code |
| 83 | + uses: actions/checkout@v4 |
| 84 | + |
| 85 | + - name: Setup Python 3.11 |
| 86 | + uses: actions/setup-python@v5 |
| 87 | + with: |
| 88 | + python-version: "3.11" |
| 89 | + |
| 90 | + - name: Validate Python Syntax |
| 91 | + working-directory: ./backend/ai_proctoring |
| 92 | + run: | |
| 93 | + python -m py_compile yolo_detector.py |
| 94 | + echo "Python syntax verified successfully" |
| 95 | +
|
| 96 | + # 4. Docker Compose Config Validation |
| 97 | + docker-validation: |
| 98 | + name: Docker Compose Validation |
| 99 | + runs-on: ubuntu-latest |
| 100 | + |
| 101 | + steps: |
| 102 | + - name: Checkout Code |
| 103 | + uses: actions/checkout@v4 |
| 104 | + |
| 105 | + - name: Validate Docker Compose Config |
| 106 | + run: | |
| 107 | + docker compose config |
0 commit comments