@@ -234,6 +234,14 @@ jobs:
234234 /cds/gateway/dev/mtls/client1-key-public
235235 name-transformation : lowercase
236236
237+ # Prepare cert files for the following test suites
238+ - name : Prepare mTLS cert files for tests
239+ if : github.event.action != 'closed'
240+ run : |
241+ printf '%s' "$_cds_gateway_dev_mtls_client1_key_secret" > /tmp/client1-key.pem
242+ printf '%s' "$_cds_gateway_dev_mtls_client1_key_public" > /tmp/client1-cert.pem
243+ chmod 600 /tmp/client1-key.pem /tmp/client1-cert.pem
244+
237245 - name : Smoke test preview URL
238246 if : github.event.action != 'closed'
239247 id : smoke-test
@@ -247,9 +255,6 @@ jobs:
247255 exit 0
248256 fi
249257
250- # Reachability check: allow 404 (app routes might not exist yet) but fail otherwise
251- printf '%s' "$_cds_gateway_dev_mtls_client1_key_secret" > /tmp/client1-key.pem
252- printf '%s' "$_cds_gateway_dev_mtls_client1_key_public" > /tmp/client1-cert.pem
253258 STATUS=$(curl \
254259 --cert /tmp/client1-cert.pem \
255260 --key /tmp/client1-key.pem \
@@ -258,8 +263,6 @@ jobs:
258263 --write-out '%{http_code}' \
259264 --head \
260265 --max-time 30 "$PREVIEW_URL"/health || true)
261- rm -f /tmp/client1-key.pem
262- rm -f /tmp/client1-cert.pem
263266
264267 if [ "$STATUS" = "404" ]; then
265268 echo "Preview responded with expected 404"
@@ -285,6 +288,156 @@ jobs:
285288 echo "http_result=unexpected-status" >> "$GITHUB_OUTPUT"
286289 exit 0
287290
291+ # ---------- QUALITY CHECKS (Test Suites) ----------
292+
293+ # UNIT TESTS
294+ - name : Run unit tests
295+ if : github.event.action != 'closed'
296+ run : make test-unit
297+
298+ - name : Upload unit test results
299+ if : always()
300+ uses : actions/upload-artifact@v5
301+ with :
302+ name : unit-test-results
303+ path : gateway-api/test-artefacts/
304+ retention-days : 30
305+
306+ - name : Check unit-tests.xml exists
307+ id : check-unit
308+ if : always()
309+ run : |
310+ [ -f "gateway-api/test-artefacts/unit-tests.xml" ] && echo "exists=true" >> "$GITHUB_OUTPUT" || echo "exists=false" >> "$GITHUB_OUTPUT"
311+
312+
313+ - name : Publish unit test results to summary
314+ if : ${{ always() && steps.check-unit.outputs.exists == 'true' }}
315+ uses : test-summary/action@31493c76ec9e7aa675f1585d3ed6f1da69269a86
316+ with :
317+ paths : gateway-api/test-artefacts/unit-tests.xml
318+
319+ # CONTRACT TESTS
320+ - name : Run contract tests against preview
321+ if : github.event.action != 'closed'
322+ env :
323+ BASE_URL : ${{ steps.tf-output.outputs.preview_url }}
324+ MTLS_CERT : /tmp/client1-cert.pem
325+ MTLS_KEY : /tmp/client1-key.pem
326+ run : make test-contract
327+
328+ - name : Upload contract test results
329+ if : always()
330+ uses : actions/upload-artifact@v5
331+ with :
332+ name : contract-test-results
333+ path : gateway-api/test-artefacts/
334+ retention-days : 30
335+
336+ - name : Check contract-tests.xml exists
337+ id : check-contract
338+ if : always()
339+ run : |
340+ [ -f "gateway-api/test-artefacts/contract-tests.xml" ] && echo "exists=true" >> "$GITHUB_OUTPUT" || echo "exists=false" >> "$GITHUB_OUTPUT"
341+
342+
343+ - name : Publish contract test results to summary
344+ if : ${{ always() && steps.check-contract.outputs.exists == 'true' }}
345+ uses : test-summary/action@31493c76ec9e7aa675f1585d3ed6f1da69269a86
346+ with :
347+ paths : gateway-api/test-artefacts/contract-tests.xml
348+
349+ # SCHEMA TESTS
350+ - name : Run schema validation against preview
351+ if : github.event.action != 'closed'
352+ env :
353+ BASE_URL : ${{ steps.tf-output.outputs.preview_url }}
354+ MTLS_CERT : /tmp/client1-cert.pem
355+ MTLS_KEY : /tmp/client1-key.pem
356+ run : make test-schema
357+
358+ - name : Upload schema test results
359+ if : always()
360+ uses : actions/upload-artifact@v5
361+ with :
362+ name : schema-test-results
363+ path : gateway-api/test-artefacts/
364+ retention-days : 30
365+
366+ - name : Check schema-tests.xml exists
367+ id : check-schema
368+ if : always()
369+ run : |
370+ [ -f "gateway-api/test-artefacts/schema-tests.xml" ] && echo "exists=true" >> "$GITHUB_OUTPUT" || echo "exists=false" >> "$GITHUB_OUTPUT"
371+
372+ - name : Publish schema test results to summary
373+ if : ${{ always() && steps.check-schema.outputs.exists == 'true' }}
374+ uses : test-summary/action@31493c76ec9e7aa675f1585d3ed6f1da69269a86
375+ with :
376+ paths : gateway-api/test-artefacts/schema-tests.xml
377+
378+ # INTEGRATION TESTS
379+ - name : Run integration tests against preview
380+ if : github.event.action != 'closed'
381+ env :
382+ BASE_URL : ${{ steps.tf-output.outputs.preview_url }}
383+ MTLS_CERT : /tmp/client1-cert.pem
384+ MTLS_KEY : /tmp/client1-key.pem
385+ run : make test-integration
386+
387+ - name : Upload integration test results
388+ if : always()
389+ uses : actions/upload-artifact@v5
390+ with :
391+ name : integration-test-results
392+ path : gateway-api/test-artefacts/
393+ retention-days : 30
394+
395+ - name : Check integration-tests.xml exists
396+ id : check-integration
397+ if : always()
398+ run : |
399+ [ -f "gateway-api/test-artefacts/integration-tests.xml" ] && echo "exists=true" >> "$GITHUB_OUTPUT" || echo "exists=false" >> "$GITHUB_OUTPUT"
400+
401+ - name : Publish integration test results to summary
402+ if : ${{ always() && steps.check-integration.outputs.exists == 'true' }}
403+ uses : test-summary/action@31493c76ec9e7aa675f1585d3ed6f1da69269a86
404+ with :
405+ paths : gateway-api/test-artefacts/integration-tests.xml
406+
407+ # ACCEPTANCE TESTS
408+ - name : Run acceptance tests against preview
409+ if : github.event.action != 'closed'
410+ env :
411+ BASE_URL : ${{ steps.tf-output.outputs.preview_url }}
412+ MTLS_CERT : /tmp/client1-cert.pem
413+ MTLS_KEY : /tmp/client1-key.pem
414+ run : make test-acceptance
415+
416+ - name : Upload acceptance test results
417+ if : always()
418+ uses : actions/upload-artifact@v5
419+ with :
420+ name : acceptance-test-results
421+ path : gateway-api/test-artefacts/
422+ retention-days : 30
423+
424+ - name : Check acceptance-tests.xml exists
425+ id : check-acceptance
426+ if : always()
427+ run : |
428+ [ -f "gateway-api/test-artefacts/acceptance-tests.xml" ] && echo "exists=true" >> "$GITHUB_OUTPUT" || echo "exists=false" >> "$GITHUB_OUTPUT"
429+
430+ - name : Publish acceptance test results to summary
431+ if : ${{ always() && steps.check-acceptance.outputs.exists == 'true' }}
432+ uses : test-summary/action@31493c76ec9e7aa675f1585d3ed6f1da69269a86
433+ with :
434+ paths : gateway-api/test-artefacts/acceptance-tests.xml
435+
436+ # Cleanup after tests
437+ - name : Remove mTLS temp files
438+ if : github.event.action != 'closed'
439+ run : rm -f /tmp/client1-key.pem /tmp/client1-cert.pem || true
440+
288441 - name : Comment function name on PR
289442 if : github.event_name == 'pull_request' && github.event.action != 'closed'
290443 uses : actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd
0 commit comments