Skip to content

Commit aa28e91

Browse files
committed
Add matrix strategy to test both Dockerfiles in integration tests
The integration-test job now uses a matrix with Dockerfile_simple and Dockerfile. Each matrix entry checks if its Dockerfile exists before running — all steps are guarded with an `if` condition so they skip gracefully when a Dockerfile is absent. This allows downstream forks that only have one Dockerfile to pass CI without errors. https://claude.ai/code/session_01RNJ3dVjV1VTHcC9ugE3FQJ
1 parent 233484e commit aa28e91

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

.github/workflows/k8s-manifests-ci.yml

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,42 +38,67 @@ jobs:
3838
integration-test:
3939
runs-on: ubuntu-latest
4040
needs: validate-manifests
41+
strategy:
42+
fail-fast: false
43+
matrix:
44+
dockerfile:
45+
- Dockerfile_simple
46+
- Dockerfile
4147
steps:
4248
- uses: actions/checkout@v4
4349

50+
- name: Check if Dockerfile exists
51+
id: check
52+
run: |
53+
if [ -f "${{ matrix.dockerfile }}" ]; then
54+
echo "exists=true" >> "$GITHUB_OUTPUT"
55+
echo "Found ${{ matrix.dockerfile }}, will run integration test"
56+
else
57+
echo "exists=false" >> "$GITHUB_OUTPUT"
58+
echo "Skipping: ${{ matrix.dockerfile }} not found"
59+
fi
60+
4461
- name: Build Docker image from current code
62+
if: steps.check.outputs.exists == 'true'
4563
run: |
46-
docker build -t openms-streamlit:test -f Dockerfile_simple .
64+
docker build -t openms-streamlit:test -f ${{ matrix.dockerfile }} .
4765
4866
- name: Create kind cluster
67+
if: steps.check.outputs.exists == 'true'
4968
uses: helm/kind-action@v1
5069
with:
5170
cluster_name: test-cluster
5271

5372
- name: Load image into kind cluster
73+
if: steps.check.outputs.exists == 'true'
5474
run: |
5575
kind load docker-image openms-streamlit:test --name test-cluster
5676
5777
- name: Install nginx ingress controller
78+
if: steps.check.outputs.exists == 'true'
5879
run: |
5980
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/kind/deploy.yaml
6081
kubectl wait --namespace ingress-nginx --for=condition=ready pod --selector=app.kubernetes.io/component=controller --timeout=90s
6182
6283
- name: Deploy with Kustomize
84+
if: steps.check.outputs.exists == 'true'
6385
run: |
6486
kubectl kustomize k8s/overlays/template-app/ | \
6587
sed 's|imagePullPolicy: IfNotPresent|imagePullPolicy: Never|g' | \
6688
kubectl apply -f -
6789
6890
- name: Wait for Redis to be ready
91+
if: steps.check.outputs.exists == 'true'
6992
run: |
7093
kubectl wait --for=condition=ready pod -l app=template-app,component=redis --timeout=60s
7194
7295
- name: Verify Redis Service is reachable
96+
if: steps.check.outputs.exists == 'true'
7397
run: |
7498
kubectl run redis-test --image=redis:7-alpine --rm -i --restart=Never -- redis-cli -h template-app-redis ping
7599
76100
- name: Verify all deployments are available
101+
if: steps.check.outputs.exists == 'true'
77102
run: |
78103
kubectl wait --for=condition=available deployment -l app=template-app --timeout=120s || true
79104
kubectl get pods -l app=template-app

0 commit comments

Comments
 (0)