Skip to content

Commit deca280

Browse files
committed
Add CI test to verify that the compose dev setup works
We broke part of it many commits ago and didn't even notice, because we didn't try to set it up again from scratch.
1 parent 464436e commit deca280

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed

.github/workflows/dev-setup.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Dev Setup
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
dev-setup:
11+
runs-on: ubuntu-latest
12+
timeout-minutes: 20
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Set up Docker Buildx
18+
uses: docker/setup-buildx-action@v3
19+
20+
- name: Prepare dev env file
21+
run: cp .env.development.example .env.development
22+
23+
- name: Start dev stack
24+
run: make dev-detach
25+
26+
- name: Wait for Rails to be healthy
27+
run: |
28+
echo "Waiting for Rails to start..."
29+
for i in {1..60}; do
30+
if docker compose -f docker-compose.dev.yml exec -T web curl -fs http://localhost:3000/up 2>/dev/null; then
31+
echo "Rails is healthy!"
32+
exit 0
33+
fi
34+
echo "Attempt $i/60 - waiting 5s..."
35+
sleep 5
36+
done
37+
echo "Rails failed to start. Showing logs:"
38+
docker compose -f docker-compose.dev.yml logs --tail=200 web db
39+
exit 1
40+
41+
- name: Run db-reset while stack is running
42+
run: make db-reset
43+
44+
- name: Wait for web to restart
45+
run: |
46+
echo "Waiting for web to restart after db-reset..."
47+
for i in {1..30}; do
48+
if docker compose -f docker-compose.dev.yml exec -T web curl -fs http://localhost:3000/up 2>/dev/null; then
49+
echo "Web is healthy after db-reset!"
50+
exit 0
51+
fi
52+
echo "Attempt $i/30 - waiting 5s..."
53+
sleep 5
54+
done
55+
echo "Web failed to restart. Showing logs:"
56+
docker compose -f docker-compose.dev.yml logs --tail=200 web db
57+
exit 1
58+
59+
- name: Run RSpec tests
60+
run: make test
61+
62+
- name: Teardown
63+
if: always()
64+
run: make down

0 commit comments

Comments
 (0)