-
Notifications
You must be signed in to change notification settings - Fork 0
136 lines (115 loc) · 3.92 KB
/
Copy pathci.yml
File metadata and controls
136 lines (115 loc) · 3.92 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
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: "-D warnings"
jobs:
check:
name: fmt + clippy + test + build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Cache cargo registry and target
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Format check
run: cargo fmt --all --check
- name: Clippy
run: cargo clippy --workspace --all-targets
- name: Test
run: cargo test --workspace
- name: Build release
run: cargo build --release
e2e:
name: end-to-end on kind
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo registry and target
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-e2e-${{ hashFiles('**/Cargo.lock') }}
- name: Build operator and crdgen
run: cargo build --bins
- name: Create kind cluster
uses: helm/kind-action@v1
with:
cluster_name: e2e
- name: Install CRD
run: |
cargo run --bin crdgen > deploy/crd.yaml
kubectl apply -f deploy/crd.yaml
kubectl wait --for=condition=Established crd/vllmservices.inference.michelecampi.dev --timeout=30s
- name: Start operator in background
run: |
./target/debug/vllm-coldstart-operator > operator.log 2>&1 &
echo $! > operator.pid
sleep 3
echo "operator started (pid $(cat operator.pid))"
- name: Apply a VllmService
run: kubectl apply -f deploy/examples/ci-placeholder.yaml
- name: Wait for Deployment to be created
run: |
for i in $(seq 1 30); do
if kubectl get deployment ci-placeholder >/dev/null 2>&1; then
echo "Deployment created after ${i}s"
exit 0
fi
sleep 1
done
echo "ERROR: Deployment not created within 30s"
kubectl get all
cat operator.log
exit 1
- name: Wait for status to reach Ready
run: |
for i in $(seq 1 60); do
phase=$(kubectl get vllmservice ci-placeholder -o jsonpath='{.status.phase}' 2>/dev/null || true)
echo "[$i] phase=${phase:-<none>}"
if [ "$phase" = "Ready" ]; then
echo "VllmService reached Ready after ${i}s"
kubectl get vllmservice ci-placeholder -o jsonpath='{.status.message}'
exit 0
fi
sleep 2
done
echo "ERROR: VllmService did not reach Ready within 120s"
kubectl get vllmservice ci-placeholder -o yaml
cat operator.log
exit 1
- name: Verify owner reference and garbage collection
run: |
owner=$(kubectl get deployment ci-placeholder -o jsonpath='{.metadata.ownerReferences[0].kind}')
[ "$owner" = "VllmService" ] || { echo "ERROR: bad owner ref: $owner"; exit 1; }
kubectl delete vllmservice ci-placeholder
for i in $(seq 1 30); do
if ! kubectl get deployment ci-placeholder >/dev/null 2>&1; then
echo "Deployment garbage-collected after ${i}s"
exit 0
fi
sleep 1
done
echo "ERROR: Deployment not garbage-collected within 30s"
exit 1
- name: Stop operator
if: always()
run: kill "$(cat operator.pid)" 2>/dev/null || true