Skip to content

Commit a69de69

Browse files
committed
github: Add a docker-compose test.
1 parent 629885b commit a69de69

File tree

3 files changed

+85
-0
lines changed

3 files changed

+85
-0
lines changed

.github/workflows/dockerfile.yaml

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