Skip to content

Commit 140e29a

Browse files
committed
feat: move smoke test into build-and-publish workflow
- Add KIND smoke test job to build-and-publish.yml - Runs on every PR (including Renovate Dockerfile bumps) - Publish now requires both test + smoke-test to pass - Remove separate helm-smoke-test.yml to avoid duplication
1 parent 238a56a commit 140e29a

File tree

2 files changed

+121
-163
lines changed

2 files changed

+121
-163
lines changed

.github/workflows/build-and-publish.yml

Lines changed: 121 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,130 @@ jobs:
117117
test -d /keys \
118118
&& echo "/keys OK"
119119
120+
smoke-test:
121+
name: KIND Smoke Test
122+
runs-on: ubuntu-latest
123+
needs: test
124+
steps:
125+
- name: Checkout
126+
uses: actions/checkout@v6
127+
128+
- name: Set up Docker Buildx
129+
uses: docker/setup-buildx-action@v3
130+
131+
- name: Build image
132+
uses: docker/build-push-action@v6
133+
with:
134+
context: ./docker/
135+
load: true
136+
tags: ${{ env.TEST_TAG }}
137+
cache-from: type=gha
138+
cache-to: type=gha,mode=max
139+
140+
- name: Set up Helm
141+
uses: azure/setup-helm@v4
142+
143+
- name: Create KIND cluster
144+
uses: helm/kind-action@v1
145+
146+
- name: Load image into KIND
147+
run: kind load docker-image ${{ env.TEST_TAG }} --name chart-testing
148+
149+
- name: Add subchart repos & build deps
150+
run: |
151+
helm repo add kubelauncher https://kubelauncher.github.io/charts
152+
helm dependency build charts/
153+
154+
- name: Lint chart
155+
run: helm lint charts/
156+
157+
- name: Generate signing key
158+
run: |
159+
SIGNING_KEY="ed25519 a_test $(openssl rand -base64 32)"
160+
echo "SIGNING_KEY=${SIGNING_KEY}" >> "$GITHUB_ENV"
161+
162+
- name: Install chart
163+
run: |
164+
helm install beacon-node charts/ \
165+
--set image.repository=beacon-node \
166+
--set image.tag=test \
167+
--set image.digest="" \
168+
--set image.pullPolicy=Never \
169+
--set serverName=beacon-node-test.local \
170+
--set "signingKey=${SIGNING_KEY}" \
171+
--set postgresql.enabled=true \
172+
--set postgresql.auth.password=testpass \
173+
--set postgresql.auth.postgresPassword=testpass \
174+
--set redis.enabled=true \
175+
--set ingress.enabled=false \
176+
--set workers.enabled=true \
177+
--wait \
178+
--timeout 300s
179+
180+
- name: Verify pods are running
181+
run: |
182+
kubectl get pods -o wide
183+
kubectl wait --for=condition=ready pod -l app.kubernetes.io/name=beacon-node --timeout=120s
184+
185+
- name: Check beacon-node logs for errors
186+
run: |
187+
POD=$(kubectl get pod -l app.kubernetes.io/name=beacon-node -o jsonpath='{.items[0].metadata.name}')
188+
kubectl logs "$POD" --tail=50
189+
if kubectl logs "$POD" | grep -i "FATAL" | grep -v "reserved for"; then
190+
echo "FATAL errors found in logs"
191+
exit 1
192+
fi
193+
echo "No FATAL errors in logs"
194+
195+
- name: Smoke test Synapse endpoints
196+
run: |
197+
POD=$(kubectl get pod -l app.kubernetes.io/name=beacon-node -o jsonpath='{.items[0].metadata.name}')
198+
199+
echo "--- /.well-known/matrix/server ---"
200+
RESPONSE=$(kubectl exec "$POD" -- curl -sf http://localhost:8008/.well-known/matrix/server)
201+
echo "$RESPONSE"
202+
echo "$RESPONSE" | grep -q "m.server" || (echo "FAIL: missing m.server" && exit 1)
203+
204+
echo "--- /.well-known/matrix/client ---"
205+
RESPONSE=$(kubectl exec "$POD" -- curl -sf http://localhost:8008/.well-known/matrix/client)
206+
echo "$RESPONSE"
207+
echo "$RESPONSE" | grep -q "m.homeserver" || (echo "FAIL: missing m.homeserver" && exit 1)
208+
209+
echo "--- /_matrix/client/versions ---"
210+
RESPONSE=$(kubectl exec "$POD" -- curl -sf http://localhost:8008/_matrix/client/versions)
211+
echo "$RESPONSE"
212+
echo "$RESPONSE" | grep -q "versions" || (echo "FAIL: missing versions" && exit 1)
213+
214+
echo "--- /_matrix/federation/v1/version ---"
215+
RESPONSE=$(kubectl exec "$POD" -- curl -sf http://localhost:8008/_matrix/federation/v1/version)
216+
echo "$RESPONSE"
217+
echo "$RESPONSE" | grep -q "Synapse" || (echo "FAIL: unexpected version response" && exit 1)
218+
219+
echo "--- /_matrix/client/v3/login ---"
220+
RESPONSE=$(kubectl exec "$POD" -- curl -sf http://localhost:8008/_matrix/client/v3/login)
221+
echo "$RESPONSE"
222+
echo "$RESPONSE" | grep -q "m.login.password" || (echo "FAIL: login flow missing" && exit 1)
223+
224+
echo "All smoke tests passed"
225+
226+
- name: Debug on failure
227+
if: failure()
228+
run: |
229+
echo "=== Pod status ==="
230+
kubectl get pods -o wide
231+
echo "=== Events ==="
232+
kubectl get events --sort-by='.lastTimestamp'
233+
echo "=== Beacon node logs ==="
234+
POD=$(kubectl get pod -l app.kubernetes.io/name=beacon-node -o jsonpath='{.items[0].metadata.name}' 2>/dev/null)
235+
[ -n "$POD" ] && kubectl logs "$POD" --tail=100
236+
echo "=== PostgreSQL logs ==="
237+
PG_POD=$(kubectl get pod -l app.kubernetes.io/name=postgresql -o jsonpath='{.items[0].metadata.name}' 2>/dev/null)
238+
[ -n "$PG_POD" ] && kubectl logs "$PG_POD" --tail=50
239+
120240
publish:
121241
name: Publish to GHCR
122242
runs-on: ubuntu-latest
123-
needs: test
243+
needs: [test, smoke-test]
124244
if: github.event_name != 'pull_request'
125245
permissions:
126246
contents: read

.github/workflows/helm-smoke-test.yml

Lines changed: 0 additions & 162 deletions
This file was deleted.

0 commit comments

Comments
 (0)