Skip to content

Commit

Permalink
Improve workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
SimFG committed Aug 30, 2023
1 parent 5a1231b commit 786ef30
Show file tree
Hide file tree
Showing 47 changed files with 1,898 additions and 1,240 deletions.
23 changes: 23 additions & 0 deletions .github/mergify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
pull_request_rules:
- name: Test passed for code changed
conditions:
- or:
- base=main
- "status-success=Unittest AMD64 Ubuntu 18.04"
- "status-success=lint"
actions:
label:
add:
- ci-passed

- name: Remove ci-passed when some test failed
conditions:
- or:
- base=main
- or:
- "check-failure=Unittest AMD64 Ubuntu 18.04"
- "check-failure=lint"
actions:
label:
remove:
- ci-passed
35 changes: 35 additions & 0 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: golangci-lint
on:
push:
tags:
- v*
branches:
- main
pull_request:
permissions:
contents: read
# Optional: allow read access to pull request. Use with `only-new-issues` option.
# pull-requests: read
jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v4
with:
go-version: 1.18
- uses: actions/checkout@v3
- name: golangci-lint core
uses: golangci/golangci-lint-action@v3
with:
version: v1.53.3
working-directory: ./core
args: --timeout=10m --out-format=colored-line-number ./...
skip-cache: true
- name: golangci-lint server
uses: golangci/golangci-lint-action@v3
with:
version: v1.53.3
working-directory: ./server
args: --timeout=10m --out-format=colored-line-number ./...
skip-cache: true
57 changes: 57 additions & 0 deletions .github/workflows/unit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Unittest

on:
push:
paths:
- 'core/**'
- 'server/**'
- 'tests/**'
# Triggers the workflow on push or pull request events but only for the master branch
pull_request:
paths:
- 'core/**'
- 'server/**'
- 'tests/**'


jobs:
# This workflow contains a single job called "build"
build:
name: Unittest AMD64 Ubuntu ${{ matrix.ubuntu }}
# The type of runner that the job will run on
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
ubuntu: [18.04]
env:
UBUNTU: ${{ matrix.ubuntu }}
services:
mysql:
image: mysql:5.7.42
env:
MYSQL_ROOT_PASSWORD: 123456
MYSQL_DATABASE: milvuscdc
ports:
- 3306:3306
etcd:
image: quay.io/coreos/etcd:v3.5.5
env:
ETCD_ADVERTISE_CLIENT_URLS: http://0.0.0.0:2379
ETCD_LISTEN_CLIENT_URLS: http://0.0.0.0:2379
ports:
- 2379:2379
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
# Runs a single command using the runners shell
- name: Run Unittest
run: make test-go
- name: Upload coverage to Codecov
if: github.repository == 'milvus-io/milvus-sdk-go'
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.project.out
name: ubuntu-${{ matrix.ubuntu }}-unittests
37 changes: 37 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
run:
skip-dirs:
- pb
- mocks

linters-settings:
golint:
min-confidence: 0.8

misspell:
locale: US

linters:
disable-all: true
enable:
- typecheck
- goimports
- misspell
- govet
- ineffassign
- gosimple
- revive

issues:
exclude-use-default: false
exclude:
- should have a package comment
- should have comment
- should be of the form
- should not use dot imports
- which can be annoying to use
# Maximum issue count per one linter. Set to 0 to disable. Default is 50.
max-issues-per-linter: 0
# Maximum count of issues with same text. Set to 0 to disable. Default is 3.
max-same-issues: 0
service:
golangci-lint-version: 1.50.0 # use the fixed version to not introduce new linters unexpectedly
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
PWD := $(shell pwd)

test:
test-go:
@echo "Running go unittests..."
@(env bash $(PWD)/scripts/run_go_unittest.sh)

static-check:
@echo "Running go-lint check:"
@(env bash $(PWD)/scripts/run_go_lint.sh)
42 changes: 42 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#Configuration File for CodeCov
codecov:
notify:
require_ci_to_pass: yes

coverage:
precision: 2
round: down
range: "70...100"

status:
project:
default:
threshold: 0% #Allow the coverage to drop by threshold%, and posting a success status.
branches:
- main
patch:
default:
target: 80%
threshold: 0%
branches:
- main
if_ci_failed: error #success, failure, error, ignore

comment:
layout: "reach, diff, flags, files"
behavior: default
require_changes: false
branches: # branch names that can post comment
- main

ignore:
- "LICENSES"
- ".git"
- "*.yml"
- "*.md"
- "docs/.*"
- "**/*.pb.go"
- "examples/*"
- "tests/*"
- "**/mocks/*"
- "*_gen.go"
6 changes: 4 additions & 2 deletions core/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/golang/protobuf v1.5.3
github.com/milvus-io/milvus-proto/go-api/v2 v2.3.0-dev.1.0.20230716112827-c3fe148f5e1d
github.com/milvus-io/milvus-sdk-go/v2 v2.2.1-0.20230814034926-dd5a31f64225
github.com/milvus-io/milvus/pkg v0.0.1
github.com/milvus-io/milvus/pkg v0.0.2-0.20230823021022-7af0f7d90cee
github.com/samber/lo v1.27.0
github.com/stretchr/testify v1.8.3
go.etcd.io/etcd/api/v3 v3.5.5
Expand Down Expand Up @@ -72,6 +72,7 @@ require (
github.com/nats-io/nats.go v1.24.0 // indirect
github.com/nats-io/nkeys v0.4.4 // indirect
github.com/nats-io/nuid v1.0.1 // indirect
github.com/panjf2000/ants/v2 v2.7.2 // indirect
github.com/pelletier/go-toml v1.9.3 // indirect
github.com/pierrec/lz4 v2.5.2+incompatible // indirect
github.com/pkg/errors v0.9.1 // indirect
Expand Down Expand Up @@ -122,6 +123,7 @@ require (
golang.org/x/exp v0.0.0-20220303212507-bbda1eaf7a17 // indirect
golang.org/x/net v0.10.0 // indirect
golang.org/x/oauth2 v0.6.0 // indirect
golang.org/x/sync v0.1.0 // indirect
golang.org/x/sys v0.8.0 // indirect
golang.org/x/term v0.8.0 // indirect
golang.org/x/text v0.9.0 // indirect
Expand All @@ -139,7 +141,7 @@ require (

replace (
github.com/apache/pulsar-client-go => github.com/milvus-io/pulsar-client-go v0.6.10
github.com/milvus-io/milvus/pkg => ../../milvus/pkg
github.com/milvus-io/milvus/pkg => github.com/SimFG/milvus/pkg v0.0.0-20230823080606-a88e7c27d190
github.com/streamnative/pulsarctl => github.com/xiaofan-luan/pulsarctl v0.5.1
github.com/tecbot/gorocksdb => ./../rocksdb
)
Expand Down
10 changes: 8 additions & 2 deletions core/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ github.com/DataDog/zstd v1.5.0/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwS
github.com/Joker/hpp v1.0.0/go.mod h1:8x5n+M1Hp5hC0g8okX3sR3vFQwynaX/UgSOM9MeBKzY=
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
github.com/Shopify/goreferrer v0.0.0-20181106222321-ec9c9a553398/go.mod h1:a1uqRtAwp2Xwc6WNPJEufxJ7fx3npB4UV/JOLmbu5I0=
github.com/SimFG/milvus/pkg v0.0.0-20230823080606-a88e7c27d190 h1:bFSt+ZoBSj0NP6yjixW5hS6RR6snda9Czff1YMkM+y0=
github.com/SimFG/milvus/pkg v0.0.0-20230823080606-a88e7c27d190/go.mod h1:s5pCBW6tOsKxj7uTe8AvS2mbJ4LgxGZWxbnY8XoKRS0=
github.com/actgardner/gogen-avro/v10 v10.1.0/go.mod h1:o+ybmVjEa27AAr35FRqU98DJu1fXES56uXniYFv4yDA=
github.com/actgardner/gogen-avro/v10 v10.2.1/go.mod h1:QUhjeHPchheYmMDni/Nx7VB0RsT/ee8YIgGY/xpEQgQ=
github.com/actgardner/gogen-avro/v9 v9.1.0/go.mod h1:nyTj6wPqDJoxM3qdnjcLv+EnMDSDFqE0qDpva2QRmKc=
Expand Down Expand Up @@ -462,8 +464,7 @@ github.com/microcosm-cc/bluemonday v1.0.2/go.mod h1:iVP4YcDBq+n/5fb23BhYFvIMq/le
github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
github.com/milvus-io/milvus-proto/go-api/v2 v2.3.0-dev.1.0.20230716112827-c3fe148f5e1d h1:XsQQ/MigebXEE2VXPKKmA3K7OHC+mkEUiErWvaWMikI=
github.com/milvus-io/milvus-proto/go-api/v2 v2.3.0-dev.1.0.20230716112827-c3fe148f5e1d/go.mod h1:1OIl0v5PQeNxIJhCvY+K55CBUOYDZevw9g9380u1Wek=
github.com/milvus-io/milvus-sdk-go/v2 v2.2.1-0.20230719020254-9e61d26bdcd3 h1:lHoCy8T7ehweyGuyMIdXTS5MO39zJlgVzJQl3nk+YX4=
github.com/milvus-io/milvus-sdk-go/v2 v2.2.1-0.20230719020254-9e61d26bdcd3/go.mod h1:hmrgMsXp/uFtCSnUkDzVQr4FK31x5seCKAIqkJO+uRM=
github.com/milvus-io/milvus-sdk-go/v2 v2.2.1-0.20230814034926-dd5a31f64225 h1:zmBNiRr/WUHGP2AMb0HxrECe8cWCdpPOpljAJfDlwPI=
github.com/milvus-io/milvus-sdk-go/v2 v2.2.1-0.20230814034926-dd5a31f64225/go.mod h1:hmrgMsXp/uFtCSnUkDzVQr4FK31x5seCKAIqkJO+uRM=
github.com/milvus-io/pulsar-client-go v0.6.10 h1:eqpJjU+/QX0iIhEo3nhOqMNXL+TyInAs1IAHZCrCM/A=
github.com/milvus-io/pulsar-client-go v0.6.10/go.mod h1:lQqCkgwDF8YFYjKA+zOheTk1tev2B+bKj5j7+nm8M1w=
Expand Down Expand Up @@ -525,6 +526,8 @@ github.com/onsi/gomega v1.19.0 h1:4ieX6qQjPP/BfC3mpsAtIGGlxTWPeA3Inl/7DtXw1tw=
github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro=
github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc=
github.com/panjf2000/ants/v2 v2.7.2 h1:2NUt9BaZFO5kQzrieOmK/wdb/tQ/K+QHaxN8sOgD63U=
github.com/panjf2000/ants/v2 v2.7.2/go.mod h1:KIBmYG9QQX5U2qzFP/yQJaq/nSb6rahS9iEHkrCMgM8=
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
github.com/pelletier/go-toml v1.9.3 h1:zeC5b1GviRUyKYd6OJPvBU/mcVDVoL1OhT17FCt5dSQ=
Expand Down Expand Up @@ -646,6 +649,7 @@ github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY=
github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s=
Expand Down Expand Up @@ -888,6 +892,8 @@ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
Expand Down
Loading

0 comments on commit 786ef30

Please sign in to comment.