Skip to content

Commit a2ec3dd

Browse files
committed
Improve workflow
1 parent 5a1231b commit a2ec3dd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1895
-1240
lines changed

.github/mergify.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
pull_request_rules:
2+
- name: Test passed for code changed
3+
conditions:
4+
- or:
5+
- base=main
6+
- "status-success=Unittest AMD64 Ubuntu 18.04"
7+
- "status-success=lint"
8+
actions:
9+
label:
10+
add:
11+
- ci-passed
12+
13+
- name: Remove ci-passed when some test failed
14+
conditions:
15+
- or:
16+
- base=main
17+
- or:
18+
- "check-failure=Unittest AMD64 Ubuntu 18.04"
19+
- "check-failure=lint"
20+
actions:
21+
label:
22+
remove:
23+
- ci-passed

.github/workflows/golangci-lint.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: golangci-lint
2+
on:
3+
push:
4+
tags:
5+
- v*
6+
branches:
7+
- main
8+
pull_request:
9+
permissions:
10+
contents: read
11+
# Optional: allow read access to pull request. Use with `only-new-issues` option.
12+
# pull-requests: read
13+
jobs:
14+
golangci:
15+
name: lint
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/setup-go@v4
19+
with:
20+
go-version: 1.18
21+
- uses: actions/checkout@v3
22+
- name: golangci-lint core
23+
uses: golangci/golangci-lint-action@v3
24+
with:
25+
version: v1.53.3
26+
working-directory: ./core
27+
args: --timeout=10m --out-format=colored-line-number ./...
28+
skip-cache: true
29+
- name: golangci-lint server
30+
uses: golangci/golangci-lint-action@v3
31+
with:
32+
version: v1.53.3
33+
working-directory: ./server
34+
args: --timeout=10m --out-format=colored-line-number ./...
35+
skip-cache: true

.github/workflows/unit.yaml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Unittest
2+
3+
on:
4+
push:
5+
paths:
6+
- 'core/**'
7+
- 'server/**'
8+
- 'tests/**'
9+
# Triggers the workflow on push or pull request events but only for the master branch
10+
pull_request:
11+
paths:
12+
- 'core/**'
13+
- 'server/**'
14+
- 'tests/**'
15+
16+
17+
jobs:
18+
# This workflow contains a single job called "build"
19+
build:
20+
name: Unittest AMD64 Ubuntu ${{ matrix.ubuntu }}
21+
# The type of runner that the job will run on
22+
runs-on: ubuntu-latest
23+
timeout-minutes: 30
24+
strategy:
25+
fail-fast: false
26+
matrix:
27+
ubuntu: [18.04]
28+
env:
29+
UBUNTU: ${{ matrix.ubuntu }}
30+
services:
31+
mysql:
32+
image: mysql:5.7.42
33+
env:
34+
MYSQL_ROOT_PASSWORD: 123456
35+
MYSQL_DATABASE: milvuscdc
36+
ports:
37+
- 3306:3306
38+
etcd:
39+
image: bitnami/etcd:3.5.9
40+
ports:
41+
- 2379:2379
42+
- 2380:2380
43+
steps:
44+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
45+
- uses: actions/checkout@v3
46+
# Runs a single command using the runners shell
47+
- name: Run Unittest
48+
run: make test-go
49+
- name: Upload coverage to Codecov
50+
if: github.repository == 'milvus-io/milvus-sdk-go'
51+
uses: codecov/codecov-action@v1
52+
with:
53+
token: ${{ secrets.CODECOV_TOKEN }}
54+
file: ./coverage.project.out
55+
name: ubuntu-${{ matrix.ubuntu }}-unittests

.golangci.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
run:
2+
skip-dirs:
3+
- pb
4+
- mocks
5+
6+
linters-settings:
7+
golint:
8+
min-confidence: 0.8
9+
10+
misspell:
11+
locale: US
12+
13+
linters:
14+
disable-all: true
15+
enable:
16+
- typecheck
17+
- goimports
18+
- misspell
19+
- govet
20+
- ineffassign
21+
- gosimple
22+
- revive
23+
24+
issues:
25+
exclude-use-default: false
26+
exclude:
27+
- should have a package comment
28+
- should have comment
29+
- should be of the form
30+
- should not use dot imports
31+
- which can be annoying to use
32+
# Maximum issue count per one linter. Set to 0 to disable. Default is 50.
33+
max-issues-per-linter: 0
34+
# Maximum count of issues with same text. Set to 0 to disable. Default is 3.
35+
max-same-issues: 0
36+
service:
37+
golangci-lint-version: 1.50.0 # use the fixed version to not introduce new linters unexpectedly

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
PWD := $(shell pwd)
22

3-
test:
3+
test-go:
44
@echo "Running go unittests..."
55
@(env bash $(PWD)/scripts/run_go_unittest.sh)
6+
7+
static-check:
8+
@echo "Running go-lint check:"
9+
@(env bash $(PWD)/scripts/run_go_lint.sh)

codecov.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#Configuration File for CodeCov
2+
codecov:
3+
notify:
4+
require_ci_to_pass: yes
5+
6+
coverage:
7+
precision: 2
8+
round: down
9+
range: "70...100"
10+
11+
status:
12+
project:
13+
default:
14+
threshold: 0% #Allow the coverage to drop by threshold%, and posting a success status.
15+
branches:
16+
- main
17+
patch:
18+
default:
19+
target: 80%
20+
threshold: 0%
21+
branches:
22+
- main
23+
if_ci_failed: error #success, failure, error, ignore
24+
25+
comment:
26+
layout: "reach, diff, flags, files"
27+
behavior: default
28+
require_changes: false
29+
branches: # branch names that can post comment
30+
- main
31+
32+
ignore:
33+
- "LICENSES"
34+
- ".git"
35+
- "*.yml"
36+
- "*.md"
37+
- "docs/.*"
38+
- "**/*.pb.go"
39+
- "examples/*"
40+
- "tests/*"
41+
- "**/mocks/*"
42+
- "*_gen.go"

core/go.mod

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ require (
88
github.com/golang/protobuf v1.5.3
99
github.com/milvus-io/milvus-proto/go-api/v2 v2.3.0-dev.1.0.20230716112827-c3fe148f5e1d
1010
github.com/milvus-io/milvus-sdk-go/v2 v2.2.1-0.20230814034926-dd5a31f64225
11-
github.com/milvus-io/milvus/pkg v0.0.1
11+
github.com/milvus-io/milvus/pkg v0.0.2-0.20230823021022-7af0f7d90cee
1212
github.com/samber/lo v1.27.0
1313
github.com/stretchr/testify v1.8.3
1414
go.etcd.io/etcd/api/v3 v3.5.5
@@ -72,6 +72,7 @@ require (
7272
github.com/nats-io/nats.go v1.24.0 // indirect
7373
github.com/nats-io/nkeys v0.4.4 // indirect
7474
github.com/nats-io/nuid v1.0.1 // indirect
75+
github.com/panjf2000/ants/v2 v2.7.2 // indirect
7576
github.com/pelletier/go-toml v1.9.3 // indirect
7677
github.com/pierrec/lz4 v2.5.2+incompatible // indirect
7778
github.com/pkg/errors v0.9.1 // indirect
@@ -122,6 +123,7 @@ require (
122123
golang.org/x/exp v0.0.0-20220303212507-bbda1eaf7a17 // indirect
123124
golang.org/x/net v0.10.0 // indirect
124125
golang.org/x/oauth2 v0.6.0 // indirect
126+
golang.org/x/sync v0.1.0 // indirect
125127
golang.org/x/sys v0.8.0 // indirect
126128
golang.org/x/term v0.8.0 // indirect
127129
golang.org/x/text v0.9.0 // indirect
@@ -139,7 +141,7 @@ require (
139141

140142
replace (
141143
github.com/apache/pulsar-client-go => github.com/milvus-io/pulsar-client-go v0.6.10
142-
github.com/milvus-io/milvus/pkg => ../../milvus/pkg
144+
github.com/milvus-io/milvus/pkg => github.com/SimFG/milvus/pkg v0.0.0-20230823080606-a88e7c27d190
143145
github.com/streamnative/pulsarctl => github.com/xiaofan-luan/pulsarctl v0.5.1
144146
github.com/tecbot/gorocksdb => ./../rocksdb
145147
)

core/go.sum

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ github.com/DataDog/zstd v1.5.0/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwS
5757
github.com/Joker/hpp v1.0.0/go.mod h1:8x5n+M1Hp5hC0g8okX3sR3vFQwynaX/UgSOM9MeBKzY=
5858
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
5959
github.com/Shopify/goreferrer v0.0.0-20181106222321-ec9c9a553398/go.mod h1:a1uqRtAwp2Xwc6WNPJEufxJ7fx3npB4UV/JOLmbu5I0=
60+
github.com/SimFG/milvus/pkg v0.0.0-20230823080606-a88e7c27d190 h1:bFSt+ZoBSj0NP6yjixW5hS6RR6snda9Czff1YMkM+y0=
61+
github.com/SimFG/milvus/pkg v0.0.0-20230823080606-a88e7c27d190/go.mod h1:s5pCBW6tOsKxj7uTe8AvS2mbJ4LgxGZWxbnY8XoKRS0=
6062
github.com/actgardner/gogen-avro/v10 v10.1.0/go.mod h1:o+ybmVjEa27AAr35FRqU98DJu1fXES56uXniYFv4yDA=
6163
github.com/actgardner/gogen-avro/v10 v10.2.1/go.mod h1:QUhjeHPchheYmMDni/Nx7VB0RsT/ee8YIgGY/xpEQgQ=
6264
github.com/actgardner/gogen-avro/v9 v9.1.0/go.mod h1:nyTj6wPqDJoxM3qdnjcLv+EnMDSDFqE0qDpva2QRmKc=
@@ -462,8 +464,7 @@ github.com/microcosm-cc/bluemonday v1.0.2/go.mod h1:iVP4YcDBq+n/5fb23BhYFvIMq/le
462464
github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
463465
github.com/milvus-io/milvus-proto/go-api/v2 v2.3.0-dev.1.0.20230716112827-c3fe148f5e1d h1:XsQQ/MigebXEE2VXPKKmA3K7OHC+mkEUiErWvaWMikI=
464466
github.com/milvus-io/milvus-proto/go-api/v2 v2.3.0-dev.1.0.20230716112827-c3fe148f5e1d/go.mod h1:1OIl0v5PQeNxIJhCvY+K55CBUOYDZevw9g9380u1Wek=
465-
github.com/milvus-io/milvus-sdk-go/v2 v2.2.1-0.20230719020254-9e61d26bdcd3 h1:lHoCy8T7ehweyGuyMIdXTS5MO39zJlgVzJQl3nk+YX4=
466-
github.com/milvus-io/milvus-sdk-go/v2 v2.2.1-0.20230719020254-9e61d26bdcd3/go.mod h1:hmrgMsXp/uFtCSnUkDzVQr4FK31x5seCKAIqkJO+uRM=
467+
github.com/milvus-io/milvus-sdk-go/v2 v2.2.1-0.20230814034926-dd5a31f64225 h1:zmBNiRr/WUHGP2AMb0HxrECe8cWCdpPOpljAJfDlwPI=
467468
github.com/milvus-io/milvus-sdk-go/v2 v2.2.1-0.20230814034926-dd5a31f64225/go.mod h1:hmrgMsXp/uFtCSnUkDzVQr4FK31x5seCKAIqkJO+uRM=
468469
github.com/milvus-io/pulsar-client-go v0.6.10 h1:eqpJjU+/QX0iIhEo3nhOqMNXL+TyInAs1IAHZCrCM/A=
469470
github.com/milvus-io/pulsar-client-go v0.6.10/go.mod h1:lQqCkgwDF8YFYjKA+zOheTk1tev2B+bKj5j7+nm8M1w=
@@ -525,6 +526,8 @@ github.com/onsi/gomega v1.19.0 h1:4ieX6qQjPP/BfC3mpsAtIGGlxTWPeA3Inl/7DtXw1tw=
525526
github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro=
526527
github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
527528
github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc=
529+
github.com/panjf2000/ants/v2 v2.7.2 h1:2NUt9BaZFO5kQzrieOmK/wdb/tQ/K+QHaxN8sOgD63U=
530+
github.com/panjf2000/ants/v2 v2.7.2/go.mod h1:KIBmYG9QQX5U2qzFP/yQJaq/nSb6rahS9iEHkrCMgM8=
528531
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
529532
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
530533
github.com/pelletier/go-toml v1.9.3 h1:zeC5b1GviRUyKYd6OJPvBU/mcVDVoL1OhT17FCt5dSQ=
@@ -646,6 +649,7 @@ github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
646649
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
647650
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
648651
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
652+
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
649653
github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY=
650654
github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
651655
github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s=
@@ -888,6 +892,8 @@ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJ
888892
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
889893
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
890894
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
895+
golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o=
896+
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
891897
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
892898
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
893899
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=

0 commit comments

Comments
 (0)