Skip to content

Merge pull request #101 from Eskyee/dependabot/npm_and_yarn/agentbot-… #246

Merge pull request #101 from Eskyee/dependabot/npm_and_yarn/agentbot-…

Merge pull request #101 from Eskyee/dependabot/npm_and_yarn/agentbot-… #246

Workflow file for this run

name: CI/CD Pipeline
permissions:
contents: read
on:
push:
branches: [main]
paths:
- 'agentbot-backend/**'
- 'web/**'
- 'package*.json'
- '.github/workflows/ci-cd.yml'
pull_request:
branches: [main]
paths:
- 'agentbot-backend/**'
- 'web/**'
- 'package*.json'
jobs:
backend:
name: Backend (TypeScript Build)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.2.2
- uses: actions/setup-node@v4.1.0
with:
node-version: '22'
cache: 'npm'
cache-dependency-path: agentbot-backend/package-lock.json
- name: Install
run: cd agentbot-backend && npm ci
- name: Lint (Type Check)
run: cd agentbot-backend && npx tsc --noEmit
- name: Build
run: cd agentbot-backend && npm run build
- name: Test
run: cd agentbot-backend && npm test -- --passWithNoTests
frontend:
name: Frontend (Next.js Build)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.2.2
- uses: actions/setup-node@v4.1.0
with:
node-version: '22'
cache: 'npm'
cache-dependency-path: web/package-lock.json
- name: Install
run: cd web && npm ci
- name: Generate Prisma Client
run: cd web && npx prisma generate
- name: Build
run: cd web && npm run build
env:
NEXT_TELEMETRY_DISABLED: '1'
DATABASE_URL: 'postgresql://stub:stub@localhost/stub'
NEXTAUTH_SECRET: 'ci-build-stub-not-a-real-secret'
NEXTAUTH_URL: 'https://agentbot.sh'
INTERNAL_API_KEY: 'ci-build-stub'
BACKEND_API_URL: 'https://agentbot-backend-production.up.railway.app'
- name: Run E2E Tests
run: cd web && (npx playwright test 2>/dev/null || echo "No E2E tests ran — skipping")
env:
BASE_URL: http://localhost:3000
pre-deploy-validation:
name: Pre-Deployment Validation
needs: [backend, frontend]
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.2.2
- uses: actions/setup-node@v4.1.0
with:
node-version: '22'
- name: Run Pre-Deployment Validation
run: node scripts/pre-deployment-validation.js
deploy:
name: Deploy
needs: [pre-deploy-validation]
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- name: Summary
run: |
echo "✅ CI passed — deployments auto-triggering:"
echo " • Vercel → agentbot.sh (GitHub integration)"
echo " • Railway → agentbot-backend, borg-0, x402-gateway"
smoke-test:
name: Smoke Test (Production Health)
needs: [deploy]
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- name: Wait for deploys to settle
run: sleep 60
- name: Vercel — frontend health
run: |
STATUS=$(curl -s -o /dev/null -w "%{http_code}" --max-time 15 https://agentbot.sh)
echo "Vercel / → $STATUS"
if [ "$STATUS" != "200" ] && [ "$STATUS" != "307" ] && [ "$STATUS" != "302" ]; then
echo "⚠️ Vercel returned $STATUS"
else
echo "✅ Vercel healthy"
fi
- name: Railway — backend health
run: |
STATUS=$(curl -s -o /dev/null -w "%{http_code}" --max-time 15 https://agentbot-backend-production.up.railway.app/health)
echo "Railway /health → $STATUS"
if [ "$STATUS" != "200" ]; then
echo "⚠️ Railway returned $STATUS"
else
echo "✅ Railway healthy"
fi
- name: Railway — x402 gateway health
run: |
STATUS=$(curl -s -o /dev/null -w "%{http_code}" --max-time 15 https://x402-gateway-production.up.railway.app/health)
echo "x402 /health → $STATUS"
if [ "$STATUS" != "200" ]; then
echo "⚠️ x402 returned $STATUS"
else
echo "✅ x402 healthy"
fi
- name: Railway — browser automation health
run: |
STATUS=$(curl -s -o /dev/null -w "%{http_code}" --max-time 15 https://agentbot-browser-production.up.railway.app/health)
echo "Browser /health → $STATUS"
if [ "$STATUS" != "200" ]; then
echo "⚠️ Browser returned $STATUS"
else
echo "✅ Browser healthy"
fi