Skip to content

Commit 6911929

Browse files
committed
ci: Support multiple docker-compose tests.
1 parent 1ac73c2 commit 6911929

File tree

4 files changed

+29
-4
lines changed

4 files changed

+29
-4
lines changed

.github/workflows/dockerfile.yaml

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,13 +156,29 @@ jobs:
156156
kubectl -n "$namespace" logs "$pod"
157157
kubectl -n "$namespace" exec "$pod" -c zulip -- cat /var/log/zulip/errors.log
158158
159+
docker-compose-collect:
160+
runs-on: ubuntu-latest
161+
outputs:
162+
dirs: ${{ steps.dirs.outputs.dirs }}
163+
steps:
164+
- name: Checkout code
165+
uses: actions/checkout@v5
166+
167+
- id: dirs
168+
run: |
169+
echo "dirs=$(ls -d ci/*/ | jq --raw-input --slurp --compact-output 'split("\n")[:-1]')" >> ${GITHUB_OUTPUT}
170+
159171
docker-compose-test:
160172
runs-on: ubuntu-latest
161173
timeout-minutes: 10
162174
needs:
163175
- build
176+
- docker-compose-collect
164177
env:
165178
GITHUB_CI_IMAGE: ghcr.io/${{ github.repository }}:pr-${{ github.event.pull_request.number }}
179+
strategy:
180+
matrix:
181+
dir: ${{ fromJson(needs.docker-compose-collect.outputs.dirs) }}
166182
steps:
167183
- name: Checkout code
168184
uses: actions/checkout@v5
@@ -174,8 +190,8 @@ jobs:
174190
run: |
175191
docker compose \
176192
-f compose.yaml \
177-
-f ci/compose.override.yaml \
178-
--env-file ci/env \
193+
-f ${{ matrix.dir }}/compose.override.yaml \
194+
--env-file ${{ matrix.dir }}/env \
179195
config
180196
181197
- name: Log in to GHCR
@@ -189,8 +205,8 @@ jobs:
189205
run: |
190206
docker compose \
191207
-f compose.yaml \
192-
-f ci/compose.override.yaml \
193-
--env-file ci/env \
208+
-f ${{ matrix.dir }}/compose.override.yaml \
209+
--env-file ${{ matrix.dir }}/env \
194210
up -d --no-build
195211
196212
- name: Wait for services to be healthy
@@ -207,6 +223,9 @@ jobs:
207223
exit 1
208224
fi
209225
226+
- name: Run tests
227+
run: ${{ matrix.dir }}/test.sh
228+
210229
- name: Check service logs for critical errors
211230
if: success() || failure()
212231
continue-on-error: true
File renamed without changes.
File renamed without changes.

ci/basic/test.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
3+
set -eux
4+
5+
echo "Success!"
6+
exit 0

0 commit comments

Comments
 (0)