Skip to content

Commit b80dfac

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 b80dfac

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

.github/workflows/dev-setup.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
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: Start dev stack
21+
run: make dev-detach
22+
23+
- name: Wait for Rails to be healthy
24+
run: |
25+
echo "Waiting for Rails to start..."
26+
for i in {1..60}; do
27+
if docker compose -f docker-compose.dev.yml exec -T web curl -fs http://localhost:3000/up 2>/dev/null; then
28+
echo "Rails is healthy!"
29+
exit 0
30+
fi
31+
echo "Attempt $i/60 - waiting 5s..."
32+
sleep 5
33+
done
34+
echo "Rails failed to start. Showing logs:"
35+
docker compose -f docker-compose.dev.yml logs --tail=200 web db
36+
exit 1
37+
38+
- name: Run db-reset while stack is running
39+
run: make db-reset
40+
41+
- name: Wait for web to restart
42+
run: |
43+
echo "Waiting for web to restart after db-reset..."
44+
for i in {1..30}; do
45+
if docker compose -f docker-compose.dev.yml exec -T web curl -fs http://localhost:3000/up 2>/dev/null; then
46+
echo "Web is healthy after db-reset!"
47+
exit 0
48+
fi
49+
echo "Attempt $i/30 - waiting 5s..."
50+
sleep 5
51+
done
52+
echo "Web failed to restart. Showing logs:"
53+
docker compose -f docker-compose.dev.yml logs --tail=200 web db
54+
exit 1
55+
56+
- name: Run RSpec tests
57+
run: make test
58+
59+
- name: Teardown
60+
if: always()
61+
run: make down

0 commit comments

Comments
 (0)