Skip to content

Commit dd568b1

Browse files
committed
Add .env.local file
1 parent 1b02cce commit dd568b1

File tree

2 files changed

+331
-328
lines changed

2 files changed

+331
-328
lines changed
Lines changed: 105 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -1,107 +1,112 @@
11
name: Evals Quick Test
22

33
on:
4-
pull_request:
5-
branches: [main, develop]
6-
paths:
7-
- 'packages/evals/**'
8-
- '.github/workflows/evals*.yml'
9-
workflow_dispatch:
4+
pull_request:
5+
branches: [main, develop]
6+
paths:
7+
- "packages/evals/**"
8+
- ".github/workflows/evals*.yml"
9+
workflow_dispatch:
1010

1111
env:
12-
DOCKER_BUILDKIT: 1
13-
COMPOSE_DOCKER_CLI_BUILD: 1
12+
DOCKER_BUILDKIT: 1
13+
COMPOSE_DOCKER_CLI_BUILD: 1
1414

1515
jobs:
16-
test-docker-compose:
17-
name: Test Docker Compose Networking
18-
runs-on: ubuntu-latest
19-
timeout-minutes: 15
20-
21-
steps:
22-
- name: Checkout repository
23-
uses: actions/checkout@v4
24-
25-
- name: Set up Docker Buildx
26-
uses: docker/setup-buildx-action@v3
27-
28-
- name: Create test environment
29-
run: |
30-
cd packages/evals
31-
32-
# Create minimal test environment
33-
cat > .env.test << EOF
34-
NODE_ENV=test
35-
DATABASE_URL=postgresql://postgres:password@db:5432/evals_test
36-
REDIS_URL=redis://redis:6379
37-
HOST_EXECUTION_METHOD=docker
38-
EOF
39-
40-
- name: Build images
41-
run: |
42-
cd packages/evals
43-
docker compose build web runner
44-
45-
- name: Start server services
46-
run: |
47-
cd packages/evals
48-
docker compose --profile server up -d
49-
50-
- name: Test service connectivity
51-
run: |
52-
cd packages/evals
53-
54-
# Wait for services
55-
echo "Waiting for PostgreSQL..."
56-
timeout 60 bash -c 'until docker compose exec -T db pg_isready -U postgres; do sleep 2; done'
57-
58-
echo "Waiting for Redis..."
59-
timeout 60 bash -c 'until docker compose exec -T redis redis-cli ping | grep -q PONG; do sleep 2; done'
60-
61-
# Test inter-container networking
62-
echo "Testing database connection from web container..."
63-
docker compose exec -T web sh -c 'nc -z db 5432 && echo "✓ Database connection successful"'
64-
65-
echo "Testing Redis connection from web container..."
66-
docker compose exec -T web sh -c 'nc -z redis 6379 && echo "✓ Redis connection successful"'
67-
68-
# Test that web service can start (basic health check)
69-
echo "Testing web service startup..."
70-
timeout 30 bash -c 'until curl -f http://localhost:3000 2>/dev/null || curl -f http://localhost:3000/health 2>/dev/null; do sleep 2; done' || echo "Web service may not have health endpoint, continuing..."
71-
72-
- name: Test runner container networking
73-
run: |
74-
cd packages/evals
75-
76-
echo "Testing runner container can connect to services..."
77-
docker compose run --rm runner sh -c 'nc -z db 5432 && echo "✓ Runner -> Database connection successful"'
78-
docker compose run --rm runner sh -c 'nc -z redis 6379 && echo "✓ Runner -> Redis connection successful"'
79-
docker compose run --rm runner sh -c 'nc -z web 3000 && echo "✓ Runner -> Web service connection successful"'
80-
81-
- name: Verify Docker socket access
82-
run: |
83-
cd packages/evals
84-
85-
echo "Testing Docker socket access in runner..."
86-
docker compose run --rm runner docker --version
87-
docker compose run --rm runner docker ps
88-
89-
- name: Show service status
90-
if: always()
91-
run: |
92-
cd packages/evals
93-
echo "=== Service Status ==="
94-
docker compose ps
95-
96-
echo "=== Network Information ==="
97-
docker network ls | grep evals || echo "No evals network found"
98-
99-
echo "=== Container Information ==="
100-
docker compose exec -T db sh -c 'echo "Database container hostname: $(hostname)"'
101-
docker compose exec -T redis sh -c 'echo "Redis container hostname: $(hostname)"'
102-
103-
- name: Cleanup
104-
if: always()
105-
run: |
106-
cd packages/evals
107-
docker compose down -v --remove-orphans
16+
test-docker-compose:
17+
name: Test Docker Compose Networking
18+
runs-on: ubuntu-latest
19+
timeout-minutes: 15
20+
21+
steps:
22+
- name: Checkout repository
23+
uses: actions/checkout@v4
24+
25+
- name: Set up Docker Buildx
26+
uses: docker/setup-buildx-action@v3
27+
28+
- name: Create test environment
29+
run: |
30+
cd packages/evals
31+
32+
# Create .env.local (required for Docker build)
33+
cat > .env.local << EOF
34+
OPENROUTER_API_KEY=${{ secrets.OPENROUTER_API_KEY || 'test-key-for-build' }}
35+
EOF
36+
37+
# Create development environment
38+
cat > .env.development << EOF
39+
NODE_ENV=development
40+
DATABASE_URL=postgresql://postgres:password@db:5432/evals_development
41+
REDIS_URL=redis://redis:6379
42+
HOST_EXECUTION_METHOD=docker
43+
EOF
44+
45+
- name: Build images
46+
run: |
47+
cd packages/evals
48+
docker compose build web runner
49+
50+
- name: Start server services
51+
run: |
52+
cd packages/evals
53+
docker compose --profile server up -d
54+
55+
- name: Test service connectivity
56+
run: |
57+
cd packages/evals
58+
59+
# Wait for services
60+
echo "Waiting for PostgreSQL..."
61+
timeout 60 bash -c 'until docker compose exec -T db pg_isready -U postgres; do sleep 2; done'
62+
63+
echo "Waiting for Redis..."
64+
timeout 60 bash -c 'until docker compose exec -T redis redis-cli ping | grep -q PONG; do sleep 2; done'
65+
66+
# Test inter-container networking
67+
echo "Testing database connection from web container..."
68+
docker compose exec -T web sh -c 'nc -z db 5432 && echo "✓ Database connection successful"'
69+
70+
echo "Testing Redis connection from web container..."
71+
docker compose exec -T web sh -c 'nc -z redis 6379 && echo "✓ Redis connection successful"'
72+
73+
# Test that web service can start (basic health check)
74+
echo "Testing web service startup..."
75+
timeout 30 bash -c 'until curl -f http://localhost:3000 2>/dev/null || curl -f http://localhost:3000/health 2>/dev/null; do sleep 2; done' || echo "Web service may not have health endpoint, continuing..."
76+
77+
- name: Test runner container networking
78+
run: |
79+
cd packages/evals
80+
81+
echo "Testing runner container can connect to services..."
82+
docker compose run --rm runner sh -c 'nc -z db 5432 && echo "✓ Runner -> Database connection successful"'
83+
docker compose run --rm runner sh -c 'nc -z redis 6379 && echo "✓ Runner -> Redis connection successful"'
84+
docker compose run --rm runner sh -c 'nc -z web 3000 && echo "✓ Runner -> Web service connection successful"'
85+
86+
- name: Verify Docker socket access
87+
run: |
88+
cd packages/evals
89+
90+
echo "Testing Docker socket access in runner..."
91+
docker compose run --rm runner docker --version
92+
docker compose run --rm runner docker ps
93+
94+
- name: Show service status
95+
if: always()
96+
run: |
97+
cd packages/evals
98+
echo "=== Service Status ==="
99+
docker compose ps
100+
101+
echo "=== Network Information ==="
102+
docker network ls | grep evals || echo "No evals network found"
103+
104+
echo "=== Container Information ==="
105+
docker compose exec -T db sh -c 'echo "Database container hostname: $(hostname)"'
106+
docker compose exec -T redis sh -c 'echo "Redis container hostname: $(hostname)"'
107+
108+
- name: Cleanup
109+
if: always()
110+
run: |
111+
cd packages/evals
112+
docker compose down -v --remove-orphans

0 commit comments

Comments
 (0)