-
Notifications
You must be signed in to change notification settings - Fork 0
186 lines (152 loc) · 4.98 KB
/
pr-validation.yml
File metadata and controls
186 lines (152 loc) · 4.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
name: PR Validation
on:
pull_request:
branches: [main]
push:
branches: [main]
permissions:
contents: read
env:
# Consistent image tag for CI
IMAGE_TAG: ci-${{ github.sha }}
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install just
uses: extractions/setup-just@v2
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.25'
cache-dependency-path: device-plugin/go.sum
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Check formatting
run: just fmt-check
- name: Run linters
run: just lint-strict
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install just
uses: extractions/setup-just@v2
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.25'
cache-dependency-path: device-plugin/go.sum
- name: Build device plugin
run: just plugin-build
integration:
name: Integration Tests
runs-on: ubuntu-24.04
needs: [lint, build]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.25'
cache-dependency-path: device-plugin/go.sum
- name: Enable KVM
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
# Verify KVM is available
if [ ! -e /dev/kvm ]; then
echo "::error::KVM is not available on this runner"
exit 1
fi
ls -la /dev/kvm
echo "✓ KVM enabled"
- name: Install just
uses: extractions/setup-just@v2
- name: Install kind
run: |
go install sigs.k8s.io/kind@latest
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
- name: Install kubectl
uses: azure/setup-kubectl@v4
- name: Create KIND cluster
run: |
just local-up
echo "✓ KIND cluster created"
- name: Build device plugin
run: |
just plugin-build
echo "✓ Device plugin built"
- name: Push device plugin to local registry
run: |
just plugin-local-push
echo "✓ Device plugin pushed to local registry"
- name: Deploy device plugin
run: |
just plugin-local-deploy
echo "✓ Device plugin deployed"
- name: Wait for device plugin to be ready
run: |
echo "Waiting for device plugin DaemonSet..."
kubectl rollout status daemonset/hyperlight-device-plugin -n hyperlight-system --timeout=120s
# Wait for node resources to be advertised
echo "Waiting for node resources..."
for i in {1..30}; do
capacity=$(kubectl get nodes -o jsonpath='{.items[0].status.allocatable.hyperlight\.dev/hypervisor}' 2>/dev/null || echo "0")
if [ "$capacity" != "0" ] && [ -n "$capacity" ]; then
echo "✓ Node advertising $capacity hyperlight.dev/hypervisor devices"
break
fi
echo "Waiting for device plugin to register resources... ($i/30)"
sleep 2
done
- name: Run device plugin tests
run: |
./scripts/test.sh plugin
./scripts/test.sh nodes
./scripts/test.sh kvm
echo "✓ Device plugin tests passed"
- name: Build Hyperlight app
run: |
just app-build
echo "✓ Hyperlight app built"
- name: Push Hyperlight app to local registry
run: |
just app-local-push
echo "✓ Hyperlight app pushed to local registry"
- name: Deploy Hyperlight app
run: |
just app-local-deploy
echo "✓ Hyperlight app deployed"
- name: Wait for Hyperlight app to be ready
run: |
echo "Waiting for Hyperlight app deployment..."
kubectl rollout status deployment/hyperlight-hello-kvm --timeout=180s
- name: Validate Hyperlight app output
run: |
./scripts/test.sh app
echo "✓ Hyperlight app tests passed"
- name: Show status
if: always()
run: |
echo "=== Pods ==="
kubectl get pods -A
echo ""
echo "=== Device Plugin Logs ==="
kubectl logs -n hyperlight-system -l app.kubernetes.io/name=hyperlight-device-plugin --tail=50 || true
echo ""
echo "=== Hyperlight App Logs ==="
kubectl logs -l app=hyperlight-hello --tail=50 || true
- name: Cleanup
if: always()
run: |
just local-down || true