Skip to content

feat: add /metrics Prometheus endpoint (#807) (#813) #637

feat: add /metrics Prometheus endpoint (#807) (#813)

feat: add /metrics Prometheus endpoint (#807) (#813) #637

Workflow file for this run

name: CI/CD Pipeline
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run ESLint
run: npm run lint
test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:15
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: test
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Generate Prisma Client
run: npm run db:generate
env:
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/test
- name: Wait for Postgres to be ready
run: |
for i in {1..30}; do
pg_isready -h localhost -p 5432 -U postgres && break
echo "Waiting for Postgres... ($i)"
sleep 2
done
- name: Sync Prisma schema to test database
run: npx prisma db push --skip-generate --accept-data-loss
env:
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/test
- name: Run tests
run: npm test
env:
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/test
JWT_SECRET: test-secret-key
JWT_REFRESH_SECRET: test-refresh-secret-key
build:
runs-on: ubuntu-latest
needs: [lint, test]
steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build application
run: npm run build
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
deploy-staging:
runs-on: ubuntu-latest
needs: [build]
if: github.ref == 'refs/heads/develop'
steps:
- uses: actions/checkout@v3
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: dist
- name: Deploy to staging
run: |
echo "Deploying to staging environment..."
# Add your deployment commands here
# Example: scp -r dist/* user@staging-server:/path/to/app
deploy-production:
runs-on: ubuntu-latest
needs: [build]
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v3
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: dist
- name: Deploy to production
run: |
echo "Deploying to production environment..."
# Add your deployment commands here
# Example: scp -r dist/* user@production-server:/path/to/app