forked from milvus-io/milvus-sdk-go
-
Notifications
You must be signed in to change notification settings - Fork 0
95 lines (87 loc) · 3.84 KB
/
test-ci.yaml
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
name: Test CI
on:
push:
branches:
- master
pull_request:
paths:
- 'common/**'
- 'client/**'
- 'entity/**'
- 'internal/**'
- 'test/**'
- 'tests/**'
- 'merr/**'
jobs:
test:
name: Run Ci Test
runs-on: ubuntu-latest
timeout-minutes: 90
strategy:
matrix:
mode: [standalone, cluster]
env:
IMAGE_REPO: "milvusdb/milvus"
TAG_PREFIX: "master-"
RELEASE_NAME: "go-test"
IMAGE_TAG: "master-latest"
QA_NAMESPACE: "qa"
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: '0'
- name: Get the latest of Milvus image tag
shell: bash
working-directory: ci/scripts
run: |
url="https://registry.hub.docker.com/v2/repositories/$IMAGE_REPO/tags?page=1&name=$TAG_PREFIX"
echo "IMAGE_TAG=$(curl -s $url | jq --arg TAG_PREFIX "$TAG_PREFIX" -r '."results"[] | select(.images[].architecture == "amd64" and (.name | contains("gpu") | not) and (.name | startswith($TAG_PREFIX))) | .name' | head -n 1)" >> $GITHUB_ENV
# echo "IMAGE_TAG=$(./docker_image_find_tag.sh -n ${IMAGE_REPO} -t ${TAG_PREFIX}latest -f ${TAG_PREFIX} -F -L -q)" >> $GITHUB_ENV
# echo "IMAGE_TAG=$(curl -s $url | jq -r '."results"[]["name"] | select(test("amd64$"))' | head -n 1)" >> $GITHUB_ENV
# echo "IMAGE_TAG=$(./docker_image_find_tag.sh -n ${IMAGE_REPO} -t ${TAG_PREFIX}latest -f ${TAG_PREFIX} -F -L -q)" >> $GITHUB_ENV
# export IMAGE_TAG=$IMAGE_TAG
# export IMAGE_REPO=$IMAGE_REPO
# export RELEASE_NAME=$RELEASE_NAME
- name: Creating kind cluster
uses: helm/[email protected]
- name: Deploy milvus operator
shell: bash
run: |
kubectl get sc
helm install milvus-operator -n milvus-operator --create-namespace https://github.com/milvus-io/milvus-operator/releases/download/v0.6.9/milvus-operator-0.6.9.tgz
kubectl --timeout 20m wait --for=condition=ready pod -l app.kubernetes.io/instance=milvus-operator -n milvus-operator
kubectl get pods -n milvus-operator
- name: Install Milvus
shell: bash
working-directory: ci/milvus-operator
run: |
echo "IMAGE_REPO=$IMAGE_REPO, IMAGE_TAG=$IMAGE_TAG, RELEASE_NAME=$RELEASE_NAME"
kubectl create namespace ${QA_NAMESPACE}
envsubst < milvus-${{ matrix.mode }}.yaml | cat - | kubectl apply -f - -n ${QA_NAMESPACE}
kubectl -n ${QA_NAMESPACE} wait --for=condition=MilvusReady milvus/${RELEASE_NAME} --timeout 20m
kubectl --timeout 20m wait --for=condition=ready pod -l app.kubernetes.io/instance=${RELEASE_NAME} -n ${QA_NAMESPACE}
kubectl describe milvus ${RELEASE_NAME} -n ${QA_NAMESPACE}
kubectl get pod -o wide -n ${QA_NAMESPACE} | grep -E "NAME|${RELEASE_NAME}"
kubectl get svc -n ${QA_NAMESPACE}
kubectl port-forward service/${RELEASE_NAME}-milvus 19530 -n ${QA_NAMESPACE} >/dev/null 2>&1 & sleep 10s
- name: Run Ci Test
shell: bash
working-directory: test/
run: |
nc -vz 127.0.0.1 19530
curl -sSL "https://github.com/gotestyourself/gotestsum/releases/download/v1.8.2/gotestsum_1.8.2_linux_amd64.tar.gz" | sudo tar -xz -C /usr/local/bin gotestsum
gotestsum --format testname --hide-summary=output ./testcases/... --tags L0 --addr=127.0.0.1:19530 -timeout=60m
- name: Export logs
if: ${{ !success() }}
shell: bash
working-directory: ci/scripts/
run: |
bash ./export_log_k8s_for_operator.sh ${QA_NAMESPACE} ${RELEASE_NAME} milvus_logs/
- name: Archive logs
if: ${{ !success() }}
uses: actions/upload-artifact@v3
with:
name: milvus-logs-${{ matrix.mode }}
path: |
ci/scripts/milvus_logs/