Skip to content

Commit 00ff653

Browse files
committed
Lint GH actions files
1 parent 425ca24 commit 00ff653

File tree

2 files changed

+52
-43
lines changed

2 files changed

+52
-43
lines changed

.github/workflows/test-k8s-deployment.yaml

Lines changed: 32 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1+
---
12
name: Test Kubernetes Deployment
23

34
on:
45
pull_request:
56
branches:
67
- main
7-
workflow_dispatch: # Allow manual triggering
8+
workflow_dispatch: # Allow manual triggering
89

910
jobs:
1011
test-k8s-deployment:
@@ -28,16 +29,16 @@ jobs:
2829
run: |
2930
# Create kind cluster
3031
kind create cluster --name kind
31-
32+
3233
# Verify cluster is running
3334
kind get clusters
34-
35+
3536
# Verify nodes are ready
3637
kubectl get nodes
37-
38+
3839
# Wait for cluster to be ready
3940
kubectl wait --for=condition=ready node --all --timeout=300s
40-
41+
4142
echo "✅ Kind cluster is ready"
4243
4344
- name: Install Docker Buildx
@@ -47,33 +48,33 @@ jobs:
4748
run: |
4849
cd subgraphs
4950
docker build -t subgraphs:test .
50-
51+
5152
# Verify the image was created
5253
if ! docker images | grep -q "subgraphs.*test"; then
5354
echo "❌ Docker build failed for subgraphs"
5455
exit 1
5556
fi
56-
57+
5758
echo "✅ Subgraphs Docker build successful"
58-
59+
5960
# Load image into kind cluster
6061
kind load docker-image subgraphs:test
6162
6263
- name: Test subgraphs container functionality
6364
run: |
6465
# Test subgraphs container locally before deploying to K8s
6566
docker run -d --name subgraphs-test -p 4001:4001 subgraphs:test
66-
67+
6768
# Wait for container to start
6869
sleep 10
69-
70+
7071
# Check if container is running
7172
if ! docker ps | grep -q "subgraphs-test"; then
7273
echo "❌ Subgraphs container failed to start"
7374
docker logs subgraphs-test
7475
exit 1
7576
fi
76-
77+
7778
# Test all subgraph endpoints
7879
echo "Testing products endpoint..."
7980
curl -X POST http://localhost:4001/products/graphql \
@@ -82,25 +83,25 @@ jobs:
8283
--max-time 10 \
8384
--retry 3 \
8485
--retry-delay 2 || exit 1
85-
86+
8687
echo "Testing reviews endpoint..."
8788
curl -X POST http://localhost:4001/reviews/graphql \
8889
-H "Content-Type: application/json" \
8990
-d '{"query":"{ __typename }"}' \
9091
--max-time 10 \
9192
--retry 3 \
9293
--retry-delay 2 || exit 1
93-
94+
9495
echo "Testing users endpoint..."
9596
curl -X POST http://localhost:4001/users/graphql \
9697
-H "Content-Type: application/json" \
9798
-d '{"query":"{ allUsers { id username } }"}' \
9899
--max-time 10 \
99100
--retry 3 \
100101
--retry-delay 2 || exit 1
101-
102+
102103
echo "✅ All subgraph endpoints responding"
103-
104+
104105
# Cleanup test container
105106
docker stop subgraphs-test || true
106107
docker rm subgraphs-test || true
@@ -120,23 +121,27 @@ jobs:
120121
echo "Verifying kind cluster status..."
121122
kind get clusters
122123
kubectl get nodes
123-
124+
124125
# Deploy using our scripts
125126
./run-k8s.sh --replicas 1
126-
127+
127128
# Wait for deployments to be ready
128-
kubectl wait --for=condition=available --timeout=300s deployment/subgraphs -n apollo-supergraph
129-
kubectl wait --for=condition=available --timeout=300s deployment/apollo-router -n apollo-supergraph
129+
kubectl wait --for=condition=available --timeout=300s \
130+
deployment/subgraphs -n apollo-supergraph
131+
kubectl wait --for=condition=available --timeout=300s \
132+
deployment/apollo-router -n apollo-supergraph
130133
131134
- name: Test Kubernetes deployment
132135
run: |
133136
# Port forward to access services
134-
kubectl port-forward svc/apollo-router-service 4000:4000 -n apollo-supergraph &
135-
kubectl port-forward svc/subgraphs-service 4001:4001 -n apollo-supergraph &
136-
137+
kubectl port-forward svc/apollo-router-service 4000:4000 \
138+
-n apollo-supergraph &
139+
kubectl port-forward svc/subgraphs-service 4001:4001 \
140+
-n apollo-supergraph &
141+
137142
# Wait for port forwarding
138143
sleep 10
139-
144+
140145
# Test subgraphs directly in K8s
141146
echo "Testing subgraphs in Kubernetes..."
142147
curl -X POST http://localhost:4001/products/graphql \
@@ -145,7 +150,7 @@ jobs:
145150
--max-time 10 \
146151
--retry 3 \
147152
--retry-delay 2 || exit 1
148-
153+
149154
# Test router in K8s
150155
echo "Testing router in Kubernetes..."
151156
curl -X POST http://localhost:4000/graphql \
@@ -154,17 +159,17 @@ jobs:
154159
--max-time 10 \
155160
--retry 3 \
156161
--retry-delay 2 || exit 1
157-
162+
158163
echo "✅ Kubernetes deployment test successful"
159164
160165
- name: Cleanup
161166
if: always()
162167
run: |
163168
# Stop port forwarding
164169
pkill -f "kubectl port-forward" || true
165-
170+
166171
# Clean up deployment
167172
./cleanup-k8s.sh || true
168-
173+
169174
# Delete kind cluster
170175
kind delete cluster || true

.github/workflows/test.yaml

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
name: Test Apollo Supergraph
23

34
on:
@@ -58,19 +59,19 @@ jobs:
5859
run: |
5960
cd router
6061
./compose.sh
61-
62+
6263
# Verify the supergraph file was created
6364
if [ ! -f "supergraph.graphql" ]; then
64-
echo "❌ Supergraph composition failed - supergraph.graphql not created"
65+
echo "❌ Supergraph composition failed - file not created"
6566
exit 1
6667
fi
67-
68+
6869
# Verify the supergraph contains expected content
6970
if ! grep -q "join__Graph" supergraph.graphql; then
7071
echo "❌ Supergraph composition failed - missing join__Graph"
7172
exit 1
7273
fi
73-
74+
7475
echo "✅ Supergraph composition successful"
7576
7677
test-docker-builds:
@@ -87,13 +88,13 @@ jobs:
8788
run: |
8889
cd subgraphs
8990
docker build -t subgraphs:test .
90-
91+
9192
# Verify the image was created
9293
if ! docker images | grep -q "subgraphs.*test"; then
9394
echo "❌ Docker build failed for subgraphs"
9495
exit 1
9596
fi
96-
97+
9798
echo "✅ Subgraphs Docker build successful"
9899
99100
test-scripts:
@@ -112,7 +113,7 @@ jobs:
112113
bash -n "$script" || exit 1
113114
fi
114115
done
115-
116+
116117
# Test scripts in scripts directory
117118
if [ -d "scripts" ]; then
118119
for script in scripts/*.sh; do
@@ -122,7 +123,7 @@ jobs:
122123
fi
123124
done
124125
fi
125-
126+
126127
echo "✅ All scripts have valid syntax"
127128
128129
- name: Test script help options
@@ -133,7 +134,7 @@ jobs:
133134
./kill-minikube.sh --help || exit 1
134135
./setup-minikube.sh --help || exit 1
135136
./setup-env.sh --help || exit 1
136-
137+
137138
echo "✅ All script help options working"
138139
139140
test-k8s-yaml:
@@ -158,33 +159,36 @@ jobs:
158159
fi
159160
done
160161
fi
161-
162+
162163
# Test GitHub Actions workflows
163164
for workflow in .github/workflows/*.yaml; do
164165
if [ -f "$workflow" ]; then
165166
echo "Validating workflow: $workflow"
166167
yamllint "$workflow" || exit 1
167168
fi
168169
done
169-
170+
170171
echo "✅ All YAML files have valid format"
171172
172173
- name: Test Kubernetes manifest structure
173174
run: |
174175
# Basic structure validation without kubectl
175176
echo "Testing Kubernetes manifest structure..."
176-
177+
177178
# Check if required files exist
178-
required_files=("k8s/namespace.yaml" "k8s/subgraphs-deployment-clusterip.yaml" "k8s/router-deployment-clusterip.yaml" "k8s/ingress.yaml")
179-
179+
required_files=("k8s/namespace.yaml" \
180+
"k8s/subgraphs-deployment-clusterip.yaml" \
181+
"k8s/router-deployment-clusterip.yaml" \
182+
"k8s/ingress.yaml")
183+
180184
for file in "${required_files[@]}"; do
181185
if [ ! -f "$file" ]; then
182186
echo "❌ Required Kubernetes manifest missing: $file"
183187
exit 1
184188
fi
185189
echo "✅ Found: $file"
186190
done
187-
191+
188192
# Check for basic Kubernetes resource types
189193
for file in k8s/*.yaml; do
190194
if [ -f "$file" ]; then
@@ -199,5 +203,5 @@ jobs:
199203
fi
200204
fi
201205
done
202-
206+
203207
echo "✅ All Kubernetes manifests have basic structure"

0 commit comments

Comments
 (0)