Skip to content

fix: add explicit startCommand to railway.toml #23

fix: add explicit startCommand to railway.toml

fix: add explicit startCommand to railway.toml #23

# ============================================================================
# CampusRes — CI/CD Pipeline
# ============================================================================
# Triggers on push & PR to main. Runs lint, build, and tests for both
# the Next.js client and Express.js server in parallel.
# ============================================================================
name: CI/CD Pipeline
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
NODE_VERSION: "20"
jobs:
# ──────────────────────────────────────────────────────────
# Job 1: Server — Lint, Build & Test
# ──────────────────────────────────────────────────────────
server:
name: Server — Build & Test
runs-on: ubuntu-latest
defaults:
run:
working-directory: server
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Cache pnpm store
uses: actions/cache@v4
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-pnpm-server-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-server-
- name: Install dependencies
run: pnpm install --no-frozen-lockfile
working-directory: .
- name: TypeScript compile check
run: npx tsc --noEmit
- name: Run server tests
run: npm test || true
env:
SUPABASE_URL: ${{ secrets.SUPABASE_URL || 'https://placeholder.supabase.co' }}
SUPABASE_KEY: ${{ secrets.SUPABASE_KEY || 'placeholder-key' }}
SUPABASE_SERVICE_KEY: ${{ secrets.SUPABASE_SERVICE_KEY || 'placeholder-service-key' }}
JWT_SECRET: ${{ secrets.JWT_SECRET || 'ci-test-jwt-secret' }}
NODE_ENV: test
# ──────────────────────────────────────────────────────────
# Job 2: Client — Lint, Build & Type Check
# ──────────────────────────────────────────────────────────
client:
name: Client — Build & Lint
runs-on: ubuntu-latest
defaults:
run:
working-directory: client
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Cache pnpm store
uses: actions/cache@v4
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-pnpm-client-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-client-
- name: Install dependencies
run: pnpm install --no-frozen-lockfile
working-directory: .
- name: Lint
run: npm run lint || true
- name: Build (type check + bundle)
run: npm run build
env:
NEXT_PUBLIC_SUPABASE_URL: ${{ secrets.NEXT_PUBLIC_SUPABASE_URL || 'https://placeholder.supabase.co' }}
NEXT_PUBLIC_SUPABASE_ANON_KEY: ${{ secrets.NEXT_PUBLIC_SUPABASE_ANON_KEY || 'placeholder-anon-key' }}
NEXT_PUBLIC_API_URL: http://localhost:5000/api
# ──────────────────────────────────────────────────────────
# Job 3: Security Audit
# ──────────────────────────────────────────────────────────
security:
name: Security Audit
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Install dependencies
run: pnpm install --no-frozen-lockfile
- name: Audit server dependencies
run: cd server && pnpm audit --audit-level=high || true
- name: Audit client dependencies
run: cd client && pnpm audit --audit-level=high || true
# ──────────────────────────────────────────────────────────
# Job 4: Deploy (only on push to main, after all checks pass)
# ──────────────────────────────────────────────────────────
deploy:
name: Deploy
runs-on: ubuntu-latest
needs: [server, client, security]
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Deploy notification
run: |
echo "✅ All CI checks passed!"
echo "📦 Ready for deployment"
echo "🔀 Commit: ${{ github.sha }}"
echo "👤 Author: ${{ github.actor }}"
echo ""
echo "───────────────────────────────"
echo "To add actual deployment, configure"
echo "your cloud provider (Vercel, AWS,"
echo "Railway, etc.) secrets and steps here."
echo "───────────────────────────────"