Feature/cd cd #1
Workflow file for this run
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: ✅ CI - Backend Build & Healthcheck | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| jobs: | |
| backend-ci: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: 📥 Checkout code | |
| uses: actions/checkout@v3 | |
| - name: 🧱 Setup Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: 20 | |
| - name: 📦 Install dependencies | |
| run: npm install | |
| - name: 🔍 Lint check | |
| run: npm run lint | |
| - name: 🧪 Run tests | |
| run: npm run test | |
| - name: 🏗️ Build project | |
| run: npm run build | |
| - name: 🐳 Docker build (UAT) | |
| run: docker build -f Dockerfile.uat -t dispatchai-backend:ci . | |
| - name: 🚀 Run container | |
| run: docker run -d -p 4000:4000 --name dispatchai-test dispatchai-backend:ci | |
| - name: 🔎 Health check | |
| run: | | |
| for i in {1..10}; do | |
| sleep 3 | |
| curl -f http://localhost:4000/health && break | |
| done | |
| - name: 🧹 Clean up | |
| run: docker rm -f dispatchai-test |