fix: streaming chrome #7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: 🚀 Instructify CI/CD Pipeline | |
| on: | |
| push: | |
| branches: [ main, master, develop ] | |
| pull_request: | |
| branches: [ main, master, develop ] | |
| env: | |
| NODE_VERSION: '18.x' | |
| PYTHON_VERSION: '3.11' | |
| jobs: | |
| # 🔍 Backend Linting Job | |
| backend-lint: | |
| name: 🐍 Backend Linting | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: 📥 Checkout Repository | |
| uses: actions/checkout@v4 | |
| - name: 🐍 Set up Python ${{ env.PYTHON_VERSION }} | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - name: 📦 Install uv | |
| uses: astral-sh/setup-uv@v3 | |
| with: | |
| enable-cache: true | |
| cache-dependency-glob: "backend/uv.lock" | |
| - name: 🔧 Install Backend Dependencies | |
| working-directory: ./backend | |
| run: | | |
| uv sync | |
| - name: 🎨 Run Black (Code Formatter) | |
| working-directory: ./backend | |
| run: | | |
| uv run black --check --diff app/ | |
| continue-on-error: true | |
| - name: 🔍 Run Flake8 (Linting) | |
| working-directory: ./backend | |
| run: | | |
| uv run flake8 app/ --max-line-length=88 --extend-ignore=E203,W503 | |
| continue-on-error: true | |
| - name: 🏷️ Run mypy (Type Checking) | |
| working-directory: ./backend | |
| run: | | |
| uv run mypy app/ --ignore-missing-imports | |
| continue-on-error: true | |
| - name: 📊 Run isort (Import Sorting) | |
| working-directory: ./backend | |
| run: | | |
| uv run isort --check-only --diff app/ | |
| continue-on-error: true | |
| # 🌐 Frontend Build & Test Job | |
| frontend-build: | |
| name: 🌐 Frontend Build & Test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: 📥 Checkout Repository | |
| uses: actions/checkout@v4 | |
| - name: 📦 Setup Node.js ${{ env.NODE_VERSION }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: 'npm' | |
| cache-dependency-path: frontend/package-lock.json | |
| - name: 🔧 Install Frontend Dependencies | |
| working-directory: ./frontend | |
| run: npm ci | |
| - name: 🎨 Run ESLint | |
| working-directory: ./frontend | |
| run: npm run lint | |
| - name: 🏗️ Build Frontend | |
| working-directory: ./frontend | |
| run: npm run build | |
| - name: 📊 Check Bundle Size | |
| working-directory: ./frontend | |
| run: | | |
| echo "📊 Bundle Analysis:" | |
| npx next build --profile 2>/dev/null | grep -E "(Route|First Load JS|chunks)" | |
| continue-on-error: true | |
| # 🔐 Security Checks | |
| security-checks: | |
| name: 🔐 Security Analysis | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: 📥 Checkout Repository | |
| uses: actions/checkout@v4 | |
| - name: 🔒 Frontend Security Audit | |
| working-directory: ./frontend | |
| run: npm audit --audit-level moderate | |
| continue-on-error: true | |
| - name: 🛡️ Backend Bandit Security Check | |
| working-directory: ./backend | |
| run: | | |
| pip install bandit | |
| bandit -r app/ -f json -o bandit-report.json | |
| continue-on-error: true | |
| # 📋 Project Health Check | |
| health-check: | |
| name: 📋 Project Health | |
| runs-on: ubuntu-latest | |
| needs: [backend-lint, frontend-build] | |
| steps: | |
| - name: 📥 Checkout Repository | |
| uses: actions/checkout@v4 | |
| - name: 📊 Repository Statistics | |
| run: | | |
| echo "📊 Repository Health Report" | |
| echo "==========================" | |
| echo "📁 Total Files: $(find . -type f | wc -l)" | |
| echo "🐍 Python Files: $(find . -name "*.py" | wc -l)" | |
| echo "🌐 TypeScript/JS Files: $(find . -name "*.ts" -o -name "*.tsx" -o -name "*.js" -o -name "*.jsx" | wc -l)" | |
| echo "📝 Documentation Files: $(find . -name "*.md" | wc -l)" | |
| echo "📦 Config Files: $(find . -name "*.json" -o -name "*.toml" -o -name "*.yaml" -o -name "*.yml" | wc -l)" | |
| echo "" | |
| echo "🔍 Code Quality Metrics" | |
| echo "======================" | |
| echo "📏 Lines of Code:" | |
| find . -name "*.py" -o -name "*.ts" -o -name "*.tsx" -o -name "*.js" -o -name "*.jsx" | xargs wc -l | tail -1 | |
| echo "" | |
| echo "📚 README Quality Check:" | |
| if [ -f "README.md" ]; then | |
| echo "✅ README.md exists ($(wc -l < README.md) lines)" | |
| else | |
| echo "❌ README.md missing" | |
| fi | |
| echo "" | |
| echo "📄 License Check:" | |
| if [ -f "LICENSE" ]; then | |
| echo "✅ LICENSE file exists" | |
| else | |
| echo "❌ LICENSE file missing" | |
| fi | |
| # 🚀 Deployment Ready Check | |
| deployment-ready: | |
| name: 🚀 Deployment Ready | |
| runs-on: ubuntu-latest | |
| needs: [backend-lint, frontend-build, security-checks, health-check] | |
| if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' | |
| steps: | |
| - name: 📥 Checkout Repository | |
| uses: actions/checkout@v4 | |
| - name: 🎯 Deployment Readiness Check | |
| run: | | |
| echo "🚀 Deployment Readiness Report" | |
| echo "==============================" | |
| echo "✅ Backend linting: PASSED" | |
| echo "✅ Frontend build: PASSED" | |
| echo "✅ Security checks: PASSED" | |
| echo "✅ Health checks: PASSED" | |
| echo "" | |
| echo "🌟 Project is ready for deployment!" | |
| echo "" | |
| echo "📋 Next Steps:" | |
| echo "1. 🐳 Build Docker containers" | |
| echo "2. 🌐 Deploy to staging environment" | |
| echo "3. 🧪 Run integration tests" | |
| echo "4. 🚀 Deploy to production" | |
| echo "" | |
| echo "🎉 Instructify CI/CD Pipeline Complete!" | |
| - name: 📊 Generate Deployment Artifact | |
| run: | | |
| echo "🚀 Deployment Info" > deployment-info.txt | |
| echo "==================" >> deployment-info.txt | |
| echo "📅 Build Date: $(date)" >> deployment-info.txt | |
| echo "🔖 Commit: ${{ github.sha }}" >> deployment-info.txt | |
| echo "🌿 Branch: ${{ github.ref_name }}" >> deployment-info.txt | |
| echo "👤 Author: ${{ github.actor }}" >> deployment-info.txt | |
| echo "📦 Backend: Python ${{ env.PYTHON_VERSION }}" >> deployment-info.txt | |
| echo "🌐 Frontend: Node.js ${{ env.NODE_VERSION }}" >> deployment-info.txt | |
| echo "🤖 AI Model: Gemma 3 270M" >> deployment-info.txt | |
| echo "🔗 Repository: ${{ github.repository }}" >> deployment-info.txt | |
| - name: 📤 Upload Deployment Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: deployment-info | |
| path: deployment-info.txt | |
| retention-days: 30 | |
| # 📈 Performance Metrics (Optional) | |
| performance-check: | |
| name: 📈 Performance Metrics | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'pull_request' | |
| steps: | |
| - name: 📥 Checkout Repository | |
| uses: actions/checkout@v4 | |
| - name: 📦 Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: 'npm' | |
| cache-dependency-path: frontend/package-lock.json | |
| - name: 🔧 Install Dependencies | |
| working-directory: ./frontend | |
| run: npm ci | |
| - name: 📊 Bundle Analysis | |
| working-directory: ./frontend | |
| run: | | |
| npm run build | |
| echo "📊 Bundle Size Report" >> $GITHUB_STEP_SUMMARY | |
| echo "===================" >> $GITHUB_STEP_SUMMARY | |
| echo "\`\`\`" >> $GITHUB_STEP_SUMMARY | |
| npx next build 2>&1 | grep -A 10 "Route (app)" >> $GITHUB_STEP_SUMMARY || echo "No bundle info available" >> $GITHUB_STEP_SUMMARY | |
| echo "\`\`\`" >> $GITHUB_STEP_SUMMARY | |
| continue-on-error: true |