Skip to content

Commit

Permalink
ci: fix k8s test
Browse files Browse the repository at this point in the history
Signed-off-by: Sertac Ozercan <[email protected]>
  • Loading branch information
sozercan committed Dec 6, 2023
1 parent 19669d0 commit 65baedf
Showing 1 changed file with 45 additions and 10 deletions.
55 changes: 45 additions & 10 deletions .github/workflows/test-kubernetes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ name: kubernetes-test
on:
push:
branches:
- main
- fix-k8s-test
# - main
paths-ignore:
- '**.md'
pull_request:
Expand Down Expand Up @@ -31,15 +32,35 @@ jobs:
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
df -H
- name: create buildx builder
run: docker buildx create --use --name builder --bootstrap
# need containerd image store for testing local images
- uses: crazy-max/ghaction-setup-docker@v2
with:
daemon-config: |
{
"debug": true,
"features": {
"containerd-snapshotter": true
}
}
- uses: crazy-max/ghaction-github-runtime@v3

- name: build aikit
run: docker buildx build . -t sozercan/aikit:test --load --cache-from=type=gha,scope=aikit --cache-to=type=gha,scope=aikit,mode=max
run: |
docker buildx build . -t aikit:test \
--load --progress plain \
--cache-from=type=gha,scope=aikit \
--cache-to=type=gha,scope=aikit,mode=max
- name: build test model
run: docker buildx build . -t sozercan/testmodel:test -f test/aikitfile.yaml --load --cache-from=type=gha,scope=testmodel --cache-to=type=gha,scope=testmodel,mode=max
run: |
docker buildx build . -t testmodel:test \
-f test/aikitfile.yaml \
--load --progress plain \
--cache-from=type=gha,scope=testmodel \
--cache-to=type=gha,scope=testmodel,mode=max
- name: list images
run: docker images

- name: install e2e dependencies
run: make test-e2e-dependencies
Expand All @@ -48,13 +69,27 @@ jobs:
run: kind create cluster --wait 5m

- name: load test model image into kind cluster
run: kind load docker-image sozercan/testmodel:test
run: kind load docker-image testmodel:test

- name: deploy test model
run: |
kubectl create deployment test-model-deployment --image=sozercan/testmodel:test --replicas 1
kubectl expose deployment test-model-deployment --port=8080 --target-port=8008 --name=test-model-service
kubectl create deployment test-model-deployment --image=testmodel:test --replicas 1
kubectl rollout status deployment test-model-deployment
kubectl expose deployment test-model-deployment --port=8080 --target-port=8080 --name=test-model-service
kubectl port-forward service/test-model-service 8080:8080 &
- name: run bats test
run: make test-e2e
- name: run test
run: |
curl http://127.0.0.1:8080/v1/chat/completions -H "Content-Type: application/json" -d '{"model": "llama-2-7b-chat", "messages": [{"role": "user", "content": "explain kubernetes in a sentence"}]}'
- name: save logs
if: always()
run: |
echo "KIND_LOGS_PATH=$(kind export logs)"" >> $GITHUB_ENV
- name: publish logs
if: always()
uses: actions/upload-artifact@v3
with:
name: kind-logs
path: ${KIND_LOGS_PATH}

0 comments on commit 65baedf

Please sign in to comment.