Skip to content

Commit a4196fe

Browse files
committed
github: Add a docker-compose test.
1 parent 85b944c commit a4196fe

File tree

3 files changed

+86
-0
lines changed

3 files changed

+86
-0
lines changed

.github/workflows/dockerfile.yaml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,3 +141,62 @@ jobs:
141141
pod=$(kubectl get pods -n "$namespace" -l app.kubernetes.io/name=zulip --output name)
142142
kubectl -n "$namespace" logs "$pod"
143143
kubectl -n "$namespace" exec "$pod" -c zulip -- cat /var/log/zulip/errors.log
144+
145+
docker-compose-test:
146+
runs-on: ubuntu-latest
147+
timeout-minutes: 10
148+
needs:
149+
- build
150+
env:
151+
GITHUB_CI_IMAGE: ghcr.io/${{ github.repository }}:pr-${{ github.event.pull_request.number }}
152+
steps:
153+
- name: Checkout code
154+
uses: actions/checkout@v5
155+
156+
- name: Set up Docker Buildx
157+
uses: docker/setup-buildx-action@v3
158+
159+
- name: Verify Docker Compose config validation
160+
run: |
161+
docker compose \
162+
-f compose.yaml \
163+
-f ci/compose.override.yaml \
164+
--env-file ci/env \
165+
config
166+
167+
- name: Log in to GHCR
168+
uses: docker/login-action@v3
169+
with:
170+
registry: ghcr.io
171+
username: ${{ github.actor }}
172+
password: ${{ secrets.GITHUB_TOKEN }}
173+
174+
- name: Start Docker Compose services
175+
run: |
176+
docker compose \
177+
-f compose.yaml \
178+
-f ci/compose.override.yaml \
179+
-e GITHUB_CI_IMAGE=ghcr.io/${{ github.repository }}:pr-${{ github.event.pull_request.number }} \
180+
--env-file ci/env \
181+
up -d --no-build
182+
183+
- name: Wait for services to be healthy
184+
run: |
185+
echo "Waiting for zulip service to be healthy..."
186+
timeout 300 bash -c \
187+
'until docker inspect --format "{{.State.Health.Status}}" $(docker compose ps -q zulip) | grep -q healthy; do sleep 5; done'
188+
189+
- name: Verify all services are running
190+
run: |
191+
docker compose ps
192+
# Check that no services are in a failed state
193+
if docker compose ps | grep -E "(Exit|Restarting)"; then
194+
exit 1
195+
fi
196+
197+
- name: Check service logs for critical errors
198+
if: success() || failure()
199+
continue-on-error: true
200+
run: |
201+
docker compose ps
202+
docker compose logs zulip

ci/compose.override.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
secrets:
3+
zulip__postgres_password:
4+
environment: "ZULIP__POSTGRES_PASSWORD"
5+
zulip__memcached_password:
6+
environment: "ZULIP__MEMCACHED_PASSWORD"
7+
zulip__rabbitmq_password:
8+
environment: "ZULIP__RABBITMQ_PASSWORD"
9+
zulip__redis_password:
10+
environment: "ZULIP__REDIS_PASSWORD"
11+
zulip__secret_key:
12+
environment: "ZULIP__SECRET_KEY"
13+
zulip__email_password:
14+
environment: "ZULIP__EMAIL_PASSWORD"
15+
16+
services:
17+
zulip:
18+
image: "${GITHUB_CI_IMAGE:?error}"
19+
environment:
20+
SETTING_EXTERNAL_HOST: "zulip.example.net"
21+
SETTING_ZULIP_ADMINISTRATOR: "admin@example.net"

ci/env

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
ZULIP__POSTGRES_PASSWORD=postgres_password
2+
ZULIP__MEMCACHED_PASSWORD=memcached_password
3+
ZULIP__RABBITMQ_PASSWORD=rabbitmq_password
4+
ZULIP__REDIS_PASSWORD=redis_password
5+
ZULIP__SECRET_KEY=django_secret_key
6+
ZULIP__EMAIL_PASSWORD=outgoing_email_password

0 commit comments

Comments
 (0)