fix: Complete CI/CD testing infrastructure setup
**Environment Variables:** - Fixed docker-compose.ci.yml to use correct environment variable names: - SURREALDB_JWT_SECRET (not SURREAL_JWT_SECRET) - GOOGLE_GENERATIVE_AI_API_KEY (not GOOGLE_API_KEY) - Updated Gitea Actions workflow to match correct variable names **Docker Configuration:** - Removed SurrealDB health check (minimal scratch image lacks utilities) - Added 10-second sleep before Next.js starts to wait for SurrealDB - Updated magnitude service to run as root user for npm global installs - Added xvfb-run to magnitude command for headless browser testing - Updated Playwright Docker image from v1.49.1 to v1.56.1 in both files - Added named volume for node_modules to persist installations **Test Configuration:** - Updated magnitude.config.ts to use Claude Sonnet 4.5 (20250929) - Added headless: true to playwright.config.ts **Testing:** - CI test script (./scripts/test-ci-locally.sh) now works correctly - All services start properly: SurrealDB → Next.js → Magnitude - Playwright launches successfully in headless mode with xvfb-run Note: Users need to ensure .env contains: - ATPROTO_CLIENT_ID - ATPROTO_REDIRECT_URI - SURREALDB_JWT_SECRET - GOOGLE_GENERATIVE_AI_API_KEY - ANTHROPIC_API_KEY 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -24,11 +24,11 @@ jobs:
|
|||||||
SURREALDB_PASS=root
|
SURREALDB_PASS=root
|
||||||
SURREALDB_NS=ponderants
|
SURREALDB_NS=ponderants
|
||||||
SURREALDB_DB=main
|
SURREALDB_DB=main
|
||||||
|
SURREALDB_JWT_SECRET=${{ secrets.SURREALDB_JWT_SECRET }}
|
||||||
ATPROTO_CLIENT_ID=${{ secrets.ATPROTO_CLIENT_ID }}
|
ATPROTO_CLIENT_ID=${{ secrets.ATPROTO_CLIENT_ID }}
|
||||||
ATPROTO_REDIRECT_URI=${{ secrets.ATPROTO_REDIRECT_URI }}
|
ATPROTO_REDIRECT_URI=${{ secrets.ATPROTO_REDIRECT_URI }}
|
||||||
GOOGLE_API_KEY=${{ secrets.GOOGLE_API_KEY }}
|
GOOGLE_GENERATIVE_AI_API_KEY=${{ secrets.GOOGLE_GENERATIVE_AI_API_KEY }}
|
||||||
DEEPGRAM_API_KEY=${{ secrets.DEEPGRAM_API_KEY }}
|
DEEPGRAM_API_KEY=${{ secrets.DEEPGRAM_API_KEY }}
|
||||||
SURREAL_JWT_SECRET=${{ secrets.SURREAL_JWT_SECRET }}
|
|
||||||
TEST_BLUESKY_HANDLE=${{ secrets.TEST_BLUESKY_HANDLE }}
|
TEST_BLUESKY_HANDLE=${{ secrets.TEST_BLUESKY_HANDLE }}
|
||||||
TEST_BLUESKY_PASSWORD=${{ secrets.TEST_BLUESKY_PASSWORD }}
|
TEST_BLUESKY_PASSWORD=${{ secrets.TEST_BLUESKY_PASSWORD }}
|
||||||
ANTHROPIC_API_KEY=${{ secrets.ANTHROPIC_API_KEY }}
|
ANTHROPIC_API_KEY=${{ secrets.ANTHROPIC_API_KEY }}
|
||||||
|
|||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -4,6 +4,7 @@
|
|||||||
/node_modules
|
/node_modules
|
||||||
/.pnp
|
/.pnp
|
||||||
.pnp.js
|
.pnp.js
|
||||||
|
.pnpm-store/
|
||||||
|
|
||||||
# testing
|
# testing
|
||||||
/coverage
|
/coverage
|
||||||
|
|||||||
@@ -15,12 +15,6 @@ services:
|
|||||||
- --pass
|
- --pass
|
||||||
- ${SURREALDB_PASS:-root}
|
- ${SURREALDB_PASS:-root}
|
||||||
- memory
|
- memory
|
||||||
healthcheck:
|
|
||||||
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
|
|
||||||
interval: 5s
|
|
||||||
timeout: 3s
|
|
||||||
retries: 10
|
|
||||||
start_period: 5s
|
|
||||||
environment:
|
environment:
|
||||||
- SURREAL_LOG=trace
|
- SURREAL_LOG=trace
|
||||||
|
|
||||||
@@ -39,11 +33,11 @@ services:
|
|||||||
- SURREALDB_PASS=${SURREALDB_PASS:-root}
|
- SURREALDB_PASS=${SURREALDB_PASS:-root}
|
||||||
- SURREALDB_NS=${SURREALDB_NS:-ponderants}
|
- SURREALDB_NS=${SURREALDB_NS:-ponderants}
|
||||||
- SURREALDB_DB=${SURREALDB_DB:-main}
|
- SURREALDB_DB=${SURREALDB_DB:-main}
|
||||||
|
- SURREALDB_JWT_SECRET=${SURREALDB_JWT_SECRET}
|
||||||
- ATPROTO_CLIENT_ID=${ATPROTO_CLIENT_ID}
|
- ATPROTO_CLIENT_ID=${ATPROTO_CLIENT_ID}
|
||||||
- ATPROTO_REDIRECT_URI=${ATPROTO_REDIRECT_URI}
|
- ATPROTO_REDIRECT_URI=${ATPROTO_REDIRECT_URI}
|
||||||
- GOOGLE_API_KEY=${GOOGLE_API_KEY}
|
- GOOGLE_GENERATIVE_AI_API_KEY=${GOOGLE_GENERATIVE_AI_API_KEY}
|
||||||
- DEEPGRAM_API_KEY=${DEEPGRAM_API_KEY}
|
- DEEPGRAM_API_KEY=${DEEPGRAM_API_KEY}
|
||||||
- SURREAL_JWT_SECRET=${SURREAL_JWT_SECRET}
|
|
||||||
- TEST_BLUESKY_HANDLE=${TEST_BLUESKY_HANDLE}
|
- TEST_BLUESKY_HANDLE=${TEST_BLUESKY_HANDLE}
|
||||||
- TEST_BLUESKY_PASSWORD=${TEST_BLUESKY_PASSWORD}
|
- TEST_BLUESKY_PASSWORD=${TEST_BLUESKY_PASSWORD}
|
||||||
- ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY}
|
- ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY}
|
||||||
@@ -52,39 +46,44 @@ services:
|
|||||||
sh -c "
|
sh -c "
|
||||||
npm install -g pnpm &&
|
npm install -g pnpm &&
|
||||||
pnpm install --frozen-lockfile &&
|
pnpm install --frozen-lockfile &&
|
||||||
|
echo 'Waiting for SurrealDB to be ready...' &&
|
||||||
|
sleep 10 &&
|
||||||
pnpm dev
|
pnpm dev
|
||||||
"
|
"
|
||||||
depends_on:
|
depends_on:
|
||||||
surrealdb:
|
- surrealdb
|
||||||
condition: service_healthy
|
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "wget", "--spider", "-q", "http://localhost:3000"]
|
test: ["CMD", "wget", "--spider", "-q", "http://localhost:3000"]
|
||||||
interval: 5s
|
interval: 5s
|
||||||
timeout: 3s
|
timeout: 3s
|
||||||
retries: 20
|
retries: 20
|
||||||
start_period: 30s
|
start_period: 40s
|
||||||
|
|
||||||
magnitude:
|
magnitude:
|
||||||
image: mcr.microsoft.com/playwright:v1.49.1-noble
|
image: mcr.microsoft.com/playwright:v1.56.1-noble
|
||||||
working_dir: /home/pwuser/app
|
working_dir: /app
|
||||||
user: pwuser
|
user: root
|
||||||
network_mode: "service:nextjs"
|
network_mode: "service:nextjs"
|
||||||
volumes:
|
volumes:
|
||||||
- .:/home/pwuser/app
|
- .:/app
|
||||||
- /home/pwuser/app/node_modules
|
- node_modules:/app/node_modules
|
||||||
environment:
|
environment:
|
||||||
- TEST_BLUESKY_HANDLE=${TEST_BLUESKY_HANDLE}
|
- TEST_BLUESKY_HANDLE=${TEST_BLUESKY_HANDLE}
|
||||||
- TEST_BLUESKY_PASSWORD=${TEST_BLUESKY_PASSWORD}
|
- TEST_BLUESKY_PASSWORD=${TEST_BLUESKY_PASSWORD}
|
||||||
- ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY}
|
- ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY}
|
||||||
|
- HOME=/root
|
||||||
command: >
|
command: >
|
||||||
sh -c "
|
sh -c "
|
||||||
npm install -g pnpm &&
|
npm install -g pnpm &&
|
||||||
pnpm install --frozen-lockfile &&
|
pnpm install --frozen-lockfile &&
|
||||||
npx wait-on http://localhost:3000 --timeout 120000 &&
|
npx wait-on http://localhost:3000 --timeout 120000 &&
|
||||||
npx magnitude
|
xvfb-run --auto-servernum --server-args='-screen 0 1280x960x24' npx magnitude
|
||||||
"
|
"
|
||||||
depends_on:
|
depends_on:
|
||||||
nextjs:
|
nextjs:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
profiles:
|
profiles:
|
||||||
- test
|
- test
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
node_modules:
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ services:
|
|||||||
- surrealdb
|
- surrealdb
|
||||||
|
|
||||||
playwright:
|
playwright:
|
||||||
image: mcr.microsoft.com/playwright:v1.49.1-noble
|
image: mcr.microsoft.com/playwright:v1.56.1-noble
|
||||||
working_dir: /home/pwuser/app
|
working_dir: /home/pwuser/app
|
||||||
user: pwuser
|
user: pwuser
|
||||||
network_mode: host
|
network_mode: host
|
||||||
|
|||||||
@@ -7,5 +7,5 @@ export default {
|
|||||||
// Run tests in headless mode to avoid window focus issues
|
// Run tests in headless mode to avoid window focus issues
|
||||||
headless: true,
|
headless: true,
|
||||||
// Use Claude Sonnet 4.5 for best performance
|
// Use Claude Sonnet 4.5 for best performance
|
||||||
model: 'anthropic:claude-sonnet-4-5-20250514',
|
model: 'anthropic:claude-sonnet-4-5-20250929',
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ export default defineConfig({
|
|||||||
baseURL: process.env.PLAYWRIGHT_BASE_URL || 'http://localhost:3000',
|
baseURL: process.env.PLAYWRIGHT_BASE_URL || 'http://localhost:3000',
|
||||||
trace: 'on-first-retry',
|
trace: 'on-first-retry',
|
||||||
screenshot: 'only-on-failure',
|
screenshot: 'only-on-failure',
|
||||||
|
headless: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
projects: [
|
projects: [
|
||||||
|
|||||||
Reference in New Issue
Block a user