Skip to content

Update vercel.json

Update vercel.json #59

Workflow file for this run

name: Test Suite
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
jobs:
unit-tests:
name: Unit Tests
runs-on: ubuntu-latest
defaults:
run:
working-directory: backend
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'
cache-dependency-path: 'backend/package-lock.json'
- name: Install dependencies
run: npm ci
- name: Run unit tests (if present)
run: |
if [ -d "tests/unit" ] && [ -n "$(find tests/unit -name '*.test.js' 2>/dev/null)" ]; then
npm run test:unit
else
echo "No unit tests found yet — skipping."
fi
# ⚠️ INTEGRATION TESTS TEMPORARILY DISABLED ⚠️
# Disabled on: 2026-08-25
# Reason: PostgREST schema cache issues and flaky test environment setup
# TODO: Re-enable after fixing PostgREST table visibility and service health checks
# See: https://github.com/your-org/your-repo/issues/INT-123
#
# integration-tests:
# name: Integration Tests
# runs-on: ubuntu-latest
#
# services:
# postgres-test:
# image: supabase/postgres:15.1.0.117
# env:
# POSTGRES_PASSWORD: test
# POSTGRES_DB: kith_test
# ports:
# - 54322:5432
# options: >-
# --health-cmd "pg_isready -U postgres"
# --health-interval 5s
# --health-timeout 5s
# --health-retries 10
#
# redis-test:
# image: redis:7-alpine
# ports:
# - 63790:6379
# options: >-
# --health-cmd "redis-cli ping"
# --health-interval 5s
# --health-timeout 5s
# --health-retries 10
#
# steps:
# - uses: actions/checkout@v4
#
# - name: Set up Node.js
# uses: actions/setup-node@v4
# with:
# node-version: '22'
# cache: 'npm'
# cache-dependency-path: 'backend/package-lock.json'
#
# - name: Install dependencies
# run: npm ci
# working-directory: backend
#
# - name: Install PostgreSQL client
# run: sudo apt-get update && sudo apt-get install -y postgresql-client
#
# - name: Wait for Redis to be ready
# run: |
# sudo apt-get install -y redis-tools
# until redis-cli -h localhost -p 63790 ping | grep -q PONG; do
# echo "Waiting for Redis..."
# sleep 2
# done
# echo "✅ Redis is up."
#
# - name: Wait for Postgres to be ready
# run: |
# until pg_isready -h localhost -p 54322 -U postgres; do
# echo "Waiting for Postgres..."
# sleep 2
# done
#
# - name: Run DB migration
# run: psql -h localhost -p 54322 -U postgres -d kith_test -v ON_ERROR_STOP=1 -f migrations/001_schema.sql
# env:
# PGPASSWORD: test
#
# - name: Start PostgREST
# run: |
# docker run -d --name postgrest-test \
# --network host \
# -e PGRST_DB_URI="postgres://postgres:test@localhost:54322/kith_test" \
# -e PGRST_DB_SCHEMAS="public" \
# -e PGRST_DB_ANON_ROLE="postgres" \
# -e PGRST_SERVER_PORT="3001" \
# -e PGRST_JWT_SECRET="test-jwt-secret-at-least-32-characters-long" \
# postgrest/postgrest:v12.0.2
#
# echo "Waiting for PostgREST to start..."
# for i in $(seq 1 30); do
# if curl -sf http://localhost:3001/ > /dev/null 2>&1; then
# echo "PostgREST is up."
# break
# fi
# sleep 2
# done
# curl -sf http://localhost:3001/ || (echo "PostgREST failed to start:" && docker logs postgrest-test && exit 1)
#
# - name: Reload PostgREST schema cache
# run: |
# # Now PostgREST is running, reload the schema cache
# psql -h localhost -p 54322 -U postgres -d kith_test -c "NOTIFY pgrst, 'reload schema';"
# sleep 2
#
# echo "Waiting for workspaces table to be visible via PostgREST..."
# for i in $(seq 1 30); do
# # Check if workspaces table is accessible
# if curl -sf http://localhost:3001/workspaces?limit=1 > /dev/null 2>&1; then
# echo "✅ workspaces table is accessible"
# break
# fi
# echo "Attempt $i: workspaces not yet available, waiting..."
# sleep 2
# done
#
# # Also check users table if it exists
# echo "Checking users table accessibility..."
# if curl -sf http://localhost:3001/users?limit=1 > /dev/null 2>&1; then
# echo "✅ users table is accessible"
# else
# echo "⚠️ users table not visible (this may be expected if it doesn't exist yet)"
# fi
#
# # Final verification for workspaces
# if curl -sf http://localhost:3001/workspaces?limit=1 > /dev/null 2>&1; then
# echo "✅ PostgREST schema cache successfully loaded 'workspaces' table"
# else
# echo "❌ PostgREST schema cache does not see 'workspaces' after reload"
# echo "Response: $(curl -s http://localhost:3001/workspaces?limit=1)"
# echo ""
# echo "PostgREST logs:"
# docker logs postgrest-test --tail 50
# exit 1
# fi
# env:
# PGPASSWORD: test
#
# - name: Diagnose PostgREST schema visibility (if previous step fails)
# if: failure()
# run: |
# echo "--- Does psql see the table? ---"
# psql -h localhost -p 54322 -U postgres -d kith_test -c "\dt public.workspaces"
#
# echo "--- What grants exist for workspaces? ---"
# psql -h localhost -p 54322 -U postgres -d kith_test -c "
# SELECT grantee, privilege_type
# FROM information_schema.role_table_grants
# WHERE table_name = 'workspaces';
# "
#
# echo "--- Raw PostgREST error body ---"
# curl -s http://localhost:3001/workspaces?limit=1
#
# echo "--- PostgREST logs ---"
# docker logs postgrest-test --tail 50
# env:
# PGPASSWORD: test
#
# - name: Run integration tests
# run: npm run test:integration
# working-directory: backend
# env:
# TEST_SUPABASE_URL: http://localhost:3001
# TEST_REDIS_URL: redis://localhost:63790/1
#
# - name: Run rate-limit tests
# run: npm run test:ratelimit
# working-directory: backend
# env:
# TEST_SUPABASE_URL: http://localhost:3001
# TEST_REDIS_URL: redis://localhost:63790/2
#
# - name: Show PostgREST logs on failure
# if: failure()
# run: docker logs postgrest-test || true