feat: Add CI testing infrastructure with act_runner support

- Created scripts/test-ci-locally.sh to test Gitea Actions workflows locally using act_runner
- Created docker-compose.ci.yml for containerized CI test environment
- Updated .gitea/workflows/magnitude.yml to use docker-compose for CI
- Added scripts/README.md documenting the CI testing approach
- Created reusable test helpers in tests/playwright/

This allows developers to run the exact same workflow that CI runs, locally,
making it much easier to debug CI failures without push cycles.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-10 14:07:16 +00:00
parent 0ea3296885
commit a8da8753f1
5 changed files with 258 additions and 47 deletions

90
docker-compose.ci.yml Normal file
View File

@@ -0,0 +1,90 @@
# Simplified docker-compose for CI/CD environments
# Only includes services needed for testing (excludes surrealmcp)
services:
surrealdb:
image: surrealdb/surrealdb:latest
ports:
- "8000:8000"
command:
- start
- --log
- trace
- --user
- ${SURREALDB_USER:-root}
- --pass
- ${SURREALDB_PASS:-root}
- memory
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
interval: 5s
timeout: 3s
retries: 10
start_period: 5s
environment:
- SURREAL_LOG=trace
nextjs:
image: node:20-alpine
working_dir: /app
ports:
- "3000:3000"
volumes:
- .:/app
- /app/node_modules
- /app/.next
environment:
- SURREALDB_URL=ws://surrealdb:8000/rpc
- SURREALDB_USER=${SURREALDB_USER:-root}
- SURREALDB_PASS=${SURREALDB_PASS:-root}
- SURREALDB_NS=${SURREALDB_NS:-ponderants}
- SURREALDB_DB=${SURREALDB_DB:-main}
- ATPROTO_CLIENT_ID=${ATPROTO_CLIENT_ID}
- ATPROTO_REDIRECT_URI=${ATPROTO_REDIRECT_URI}
- GOOGLE_API_KEY=${GOOGLE_API_KEY}
- DEEPGRAM_API_KEY=${DEEPGRAM_API_KEY}
- SURREAL_JWT_SECRET=${SURREAL_JWT_SECRET}
- TEST_BLUESKY_HANDLE=${TEST_BLUESKY_HANDLE}
- TEST_BLUESKY_PASSWORD=${TEST_BLUESKY_PASSWORD}
- ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY}
- NODE_ENV=development
command: >
sh -c "
npm install -g pnpm &&
pnpm install --frozen-lockfile &&
pnpm dev
"
depends_on:
surrealdb:
condition: service_healthy
healthcheck:
test: ["CMD", "wget", "--spider", "-q", "http://localhost:3000"]
interval: 5s
timeout: 3s
retries: 20
start_period: 30s
magnitude:
image: mcr.microsoft.com/playwright:v1.49.1-noble
working_dir: /home/pwuser/app
user: pwuser
network_mode: "service:nextjs"
volumes:
- .:/home/pwuser/app
- /home/pwuser/app/node_modules
environment:
- TEST_BLUESKY_HANDLE=${TEST_BLUESKY_HANDLE}
- TEST_BLUESKY_PASSWORD=${TEST_BLUESKY_PASSWORD}
- ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY}
command: >
sh -c "
npm install -g pnpm &&
pnpm install --frozen-lockfile &&
npx wait-on http://localhost:3000 --timeout 120000 &&
npx magnitude
"
depends_on:
nextjs:
condition: service_healthy
profiles:
- test