-
Notifications
You must be signed in to change notification settings - Fork 90
Expand file tree
/
Copy pathdocker-compose.test.yml
More file actions
83 lines (79 loc) · 2.03 KB
/
docker-compose.test.yml
File metadata and controls
83 lines (79 loc) · 2.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
version: '3.8'
services:
# PostgreSQL database for testing
postgres:
image: postgres:16-alpine
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
POSTGRES_DB: miru_web_test
ports:
- "5433:5432"
volumes:
- postgres_test_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
timeout: 5s
retries: 5
# Test runner - uses the test stage
test:
build:
context: .
dockerfile: Dockerfile
target: test
cache_from:
- ghcr.io/saeloun/miru-web:base
- ghcr.io/saeloun/miru-web:test-latest
depends_on:
postgres:
condition: service_healthy
environment:
DATABASE_URL: postgresql://postgres:password@postgres:5432/miru_web_test
RAILS_ENV: test
CI: "true"
PARALLEL_WORKERS: 4
volumes:
- .:/app:cached
- bundle_cache:/usr/local/bundle
- node_modules:/app/node_modules
command: |
bash -c "
bundle exec rails db:test:prepare &&
bundle exec rails db:migrate &&
bundle exec rspec --format progress
"
# Playwright test runner
playwright:
build:
context: .
dockerfile: Dockerfile
target: test
cache_from:
- ghcr.io/saeloun/miru-web:base
- ghcr.io/saeloun/miru-web:test-latest
depends_on:
postgres:
condition: service_healthy
environment:
DATABASE_URL: postgresql://postgres:password@postgres:5432/miru_web_test
RAILS_ENV: test
CI: "true"
PLAYWRIGHT_HEADLESS: "true"
volumes:
- .:/app:cached
- bundle_cache:/usr/local/bundle
- node_modules:/app/node_modules
- playwright_cache:/ms-playwright
command: |
bash -c "
bundle exec rails db:test:prepare &&
bundle exec rails server -b 0.0.0.0 -p 3000 &
sleep 10 &&
pnpm exec playwright test --project=chromium
"
volumes:
postgres_test_data:
bundle_cache:
node_modules:
playwright_cache: