diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..99adcad --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,35 @@ +name: CI + Auto Deploy to Render + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + ci: + runs-on: ubuntu-latest + + steps: + - name: Checkout repo + uses: actions/checkout@v4 + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: 20 + + - name: Install dependencies + run: npm install + + - name: Run tests + run: npm test + + - name: Deploy to Render + if: github.ref == 'refs/heads/main' + run: | + curl -X POST "$RENDER_DEPLOY_HOOK_URL" + env: + RENDER_DEPLOY_HOOK_URL: ${{ secrets.RENDER_DEPLOY_HOOK_URL }} diff --git a/.gitignore b/.gitignore index 565458e..9e9bdfd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ # Dependencies node_modules/ +.serverless/ __pycache__/ *.pyc *.pyo diff --git a/backend/core/app.py b/backend/core/app.py index aed6595..64c9979 100644 --- a/backend/core/app.py +++ b/backend/core/app.py @@ -1,10 +1,10 @@ from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware - def create_app() -> FastAPI: app = FastAPI(title="Fluent API", description="Data Analysis and Function Generation API", version="1.0.0") + # Allow all origins so the deployed frontend (Vercel) can reach the API app.add_middleware( CORSMiddleware, allow_origins=["http://localhost:3000", "https://flluent.vercel.app"], diff --git a/frontend/public/config.json b/frontend/public/config.json index 148a829..b61e960 100644 --- a/frontend/public/config.json +++ b/frontend/public/config.json @@ -1,5 +1,5 @@ -{ - "backend": { - "baseUrl": "https://gce61ejzvh.execute-api.ap-south-1.amazonaws.com" - } -} +{ + "backend": { + "baseUrl": "https://fluent-bc62.onrender.com" + } +}