Skip to content

Merge branch 'main' of https://github.com/Dhiyaahaq33/agritwin #1

Merge branch 'main' of https://github.com/Dhiyaahaq33/agritwin

Merge branch 'main' of https://github.com/Dhiyaahaq33/agritwin #1

Workflow file for this run

name: AgriTwin CI/CD
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
test-backend:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install dependencies
run: pip install -r backend/requirements.txt
- name: Syntax check
run: python -m py_compile backend/main.py
- name: Module checks
run: |
python -m py_compile weather/open_meteo.py
python -m py_compile db/supabase_client.py
python -m py_compile market/price_feed.py
python -m py_compile iot/mqtt_broker.py
python -m py_compile alerts/alert_engine.py
test-frontend:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20"
- name: Install
working-directory: frontend
run: npm install
- name: Build
working-directory: frontend
run: npm run build
deploy-backend:
needs: [test-backend]
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Deploy to Railway
uses: bervProject/railway-deploy@main
with:
railway_token: ${{ secrets.RAILWAY_TOKEN }}
service: agritwin-backend
deploy-frontend:
needs: [test-frontend]
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Deploy to Vercel
uses: amondnet/vercel-action@v25
with:
vercel-token: ${{ secrets.VERCEL_TOKEN }}
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }}
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }}
working-directory: frontend
vercel-args: "--prod"