mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-07 09:38:39 +08:00
Make pkg code change trigger ci workflow (#23312)
Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
This commit is contained in:
parent
03a4f60b6e
commit
5276529524
1
.github/workflows/code-checker.yaml
vendored
1
.github/workflows/code-checker.yaml
vendored
@ -11,6 +11,7 @@ on:
|
|||||||
paths:
|
paths:
|
||||||
- 'scripts/**'
|
- 'scripts/**'
|
||||||
- 'internal/**'
|
- 'internal/**'
|
||||||
|
- 'pkg/**'
|
||||||
- 'cmd/**'
|
- 'cmd/**'
|
||||||
- 'build/**'
|
- 'build/**'
|
||||||
- '.github/workflows/code-checker.yaml'
|
- '.github/workflows/code-checker.yaml'
|
||||||
|
|||||||
1
.github/workflows/mac.yaml
vendored
1
.github/workflows/mac.yaml
vendored
@ -10,6 +10,7 @@ on:
|
|||||||
paths:
|
paths:
|
||||||
- 'scripts/**'
|
- 'scripts/**'
|
||||||
- 'internal/**'
|
- 'internal/**'
|
||||||
|
- 'pkg/**'
|
||||||
- 'cmd/**'
|
- 'cmd/**'
|
||||||
- 'build/**'
|
- 'build/**'
|
||||||
- '.github/workflows/mac.yaml'
|
- '.github/workflows/mac.yaml'
|
||||||
|
|||||||
2
.github/workflows/main.yaml
vendored
2
.github/workflows/main.yaml
vendored
@ -7,6 +7,7 @@ on:
|
|||||||
paths:
|
paths:
|
||||||
- 'scripts/**'
|
- 'scripts/**'
|
||||||
- 'internal/**'
|
- 'internal/**'
|
||||||
|
- 'pkg/**'
|
||||||
- 'cmd/**'
|
- 'cmd/**'
|
||||||
- 'build/**'
|
- 'build/**'
|
||||||
- '.github/workflows/main.yaml'
|
- '.github/workflows/main.yaml'
|
||||||
@ -21,6 +22,7 @@ on:
|
|||||||
paths:
|
paths:
|
||||||
- 'scripts/**'
|
- 'scripts/**'
|
||||||
- 'internal/**'
|
- 'internal/**'
|
||||||
|
- 'pkg/**'
|
||||||
- 'cmd/**'
|
- 'cmd/**'
|
||||||
- 'build/**'
|
- 'build/**'
|
||||||
- '.github/workflows/main.yaml'
|
- '.github/workflows/main.yaml'
|
||||||
|
|||||||
1
Makefile
1
Makefile
@ -95,6 +95,7 @@ static-check: getdeps
|
|||||||
@source $(PWD)/scripts/setenv.sh && GO111MODULE=on $(INSTALL_PATH)/golangci-lint run --timeout=30m --config ./.golangci.yml ./internal/...
|
@source $(PWD)/scripts/setenv.sh && GO111MODULE=on $(INSTALL_PATH)/golangci-lint run --timeout=30m --config ./.golangci.yml ./internal/...
|
||||||
@source $(PWD)/scripts/setenv.sh && GO111MODULE=on $(INSTALL_PATH)/golangci-lint run --timeout=30m --config ./.golangci.yml ./cmd/...
|
@source $(PWD)/scripts/setenv.sh && GO111MODULE=on $(INSTALL_PATH)/golangci-lint run --timeout=30m --config ./.golangci.yml ./cmd/...
|
||||||
@source $(PWD)/scripts/setenv.sh && GO111MODULE=on $(INSTALL_PATH)/golangci-lint run --timeout=30m --config ./.golangci.yml ./tests/integration/...
|
@source $(PWD)/scripts/setenv.sh && GO111MODULE=on $(INSTALL_PATH)/golangci-lint run --timeout=30m --config ./.golangci.yml ./tests/integration/...
|
||||||
|
@source $(PWD)/scripts/setenv.sh && cd pkg && GO111MODULE=on $(INSTALL_PATH)/golangci-lint run --timeout=30m --config ../.golangci.yml ./...
|
||||||
|
|
||||||
verifiers: build-cpp getdeps cppcheck fmt static-check
|
verifiers: build-cpp getdeps cppcheck fmt static-check
|
||||||
|
|
||||||
|
|||||||
@ -17,6 +17,7 @@
|
|||||||
package metrics
|
package metrics
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
// #nosec
|
||||||
_ "net/http/pprof"
|
_ "net/http/pprof"
|
||||||
|
|
||||||
"github.com/prometheus/client_golang/prometheus"
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
|
|||||||
@ -61,7 +61,7 @@ func TestManager(t *testing.T) {
|
|||||||
|
|
||||||
t.Run("test merge and split", func(t *testing.T) {
|
t.Run("test merge and split", func(t *testing.T) {
|
||||||
prefix := fmt.Sprintf("mock%d", time.Now().UnixNano())
|
prefix := fmt.Sprintf("mock%d", time.Now().UnixNano())
|
||||||
c := NewDispatcherManager(prefix + "_pchannel_0", typeutil.ProxyRole, 1, newMockFactory())
|
c := NewDispatcherManager(prefix+"_pchannel_0", typeutil.ProxyRole, 1, newMockFactory())
|
||||||
assert.NotNil(t, c)
|
assert.NotNil(t, c)
|
||||||
_, err := c.Add("mock_vchannel_0", nil, mqwrapper.SubscriptionPositionUnknown)
|
_, err := c.Add("mock_vchannel_0", nil, mqwrapper.SubscriptionPositionUnknown)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
@ -85,7 +85,7 @@ func TestManager(t *testing.T) {
|
|||||||
|
|
||||||
t.Run("test run and close", func(t *testing.T) {
|
t.Run("test run and close", func(t *testing.T) {
|
||||||
prefix := fmt.Sprintf("mock%d", time.Now().UnixNano())
|
prefix := fmt.Sprintf("mock%d", time.Now().UnixNano())
|
||||||
c := NewDispatcherManager(prefix + "_pchannel_0", typeutil.ProxyRole, 1, newMockFactory())
|
c := NewDispatcherManager(prefix+"_pchannel_0", typeutil.ProxyRole, 1, newMockFactory())
|
||||||
assert.NotNil(t, c)
|
assert.NotNil(t, c)
|
||||||
_, err := c.Add("mock_vchannel_0", nil, mqwrapper.SubscriptionPositionUnknown)
|
_, err := c.Add("mock_vchannel_0", nil, mqwrapper.SubscriptionPositionUnknown)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|||||||
@ -67,7 +67,7 @@ func getSeekPositions(factory msgstream.Factory, pchannel string, maxNum int) ([
|
|||||||
defer stream.Close()
|
defer stream.Close()
|
||||||
stream.AsConsumer([]string{pchannel}, fmt.Sprintf("%d", rand.Int()), mqwrapper.SubscriptionPositionEarliest)
|
stream.AsConsumer([]string{pchannel}, fmt.Sprintf("%d", rand.Int()), mqwrapper.SubscriptionPositionEarliest)
|
||||||
positions := make([]*msgstream.MsgPosition, 0)
|
positions := make([]*msgstream.MsgPosition, 0)
|
||||||
timeoutCtx, cancel := context.WithTimeout(context.Background(), 30 * time.Second)
|
timeoutCtx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
|
|||||||
@ -19,8 +19,8 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"go.uber.org/zap"
|
|
||||||
"github.com/samber/lo"
|
"github.com/samber/lo"
|
||||||
|
"go.uber.org/zap"
|
||||||
|
|
||||||
config "github.com/milvus-io/milvus/pkg/config"
|
config "github.com/milvus-io/milvus/pkg/config"
|
||||||
"github.com/milvus-io/milvus/pkg/log"
|
"github.com/milvus-io/milvus/pkg/log"
|
||||||
|
|||||||
@ -26,7 +26,7 @@ BASEDIR=$(dirname "$0")
|
|||||||
source $BASEDIR/setenv.sh
|
source $BASEDIR/setenv.sh
|
||||||
|
|
||||||
# run unittest
|
# run unittest
|
||||||
echo "Running unittest under ./internal"
|
echo "Running unittest under ./internal & ./pkg"
|
||||||
|
|
||||||
# starting the timer
|
# starting the timer
|
||||||
beginTime=`date +%s`
|
beginTime=`date +%s`
|
||||||
@ -40,6 +40,15 @@ for d in $(go list ./internal/... | grep -v -e vendor -e kafka -e planparserv2/g
|
|||||||
rm profile.out
|
rm profile.out
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
pushd pkg
|
||||||
|
for d in $(go list ./... | grep -v -e vendor -e kafka -e planparserv2/generated -e mocks); do
|
||||||
|
go test -race ${APPLE_SILICON_FLAG} -v -coverpkg=./... -coverprofile=profile.out -covermode=atomic "$d"
|
||||||
|
if [ -f profile.out ]; then
|
||||||
|
grep -v kafka profile.out | grep -v planparserv2/generated | grep -v mocks | sed '1d' >> ${FILE_COVERAGE_INFO}
|
||||||
|
rm profile.out
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
popd
|
||||||
endTime=`date +%s`
|
endTime=`date +%s`
|
||||||
|
|
||||||
echo "Total time for go unittest:" $(($endTime-$beginTime)) "s"
|
echo "Total time for go unittest:" $(($endTime-$beginTime)) "s"
|
||||||
|
|||||||
@ -30,9 +30,10 @@ if [[ "$(uname -m)" == "arm64" ]]; then
|
|||||||
APPLE_SILICON_FLAG="-tags dynamic"
|
APPLE_SILICON_FLAG="-tags dynamic"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# ignore MinIO,S3 unittes
|
# ignore MinIO,S3 unittests
|
||||||
MILVUS_DIR="${ROOT_DIR}/internal/"
|
MILVUS_DIR="${ROOT_DIR}/internal/"
|
||||||
echo "Running go unittest under $MILVUS_DIR"
|
PKG_DIR="${ROOT_DIR}/pkg/"
|
||||||
|
echo "Running go unittest under $MILVUS_DIR & $PKG_DIR"
|
||||||
|
|
||||||
TEST_ALL=1
|
TEST_ALL=1
|
||||||
TEST_TAG="ALL"
|
TEST_TAG="ALL"
|
||||||
@ -70,7 +71,7 @@ go test -race -cover ${APPLE_SILICON_FLAG} "${MILVUS_DIR}/distributed/proxy/..."
|
|||||||
function test_querynode()
|
function test_querynode()
|
||||||
{
|
{
|
||||||
go test -race -cover ${APPLE_SILICON_FLAG} "${MILVUS_DIR}/querynode/..." -failfast -count=1
|
go test -race -cover ${APPLE_SILICON_FLAG} "${MILVUS_DIR}/querynode/..." -failfast -count=1
|
||||||
go test -race -cover ${APPLE_SILICON_FLAG} "${MILVUS_DIR}/distributed/querynode/..." -failfast -count=1
|
go test -race -cover ${APPLE_SILICON_FLAG} "${MILVUS_DIR}/distributed/querynodev2/..." -failfast -count=1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -114,6 +115,16 @@ go test -race -cover ${APPLE_SILICON_FLAG} "${MILVUS_DIR}/util/typeutil/..." -fa
|
|||||||
go test -race -cover ${APPLE_SILICON_FLAG} "${MILVUS_DIR}/util/importutil/..." -failfast -count=1
|
go test -race -cover ${APPLE_SILICON_FLAG} "${MILVUS_DIR}/util/importutil/..." -failfast -count=1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function test_pkg()
|
||||||
|
{
|
||||||
|
go test -race -cover ${APPLE_SILICON_FLAG} "${PKG_DIR}/common/..." -failfast -count=1
|
||||||
|
go test -race -cover ${APPLE_SILICON_FLAG} "${PKG_DIR}/config/..." -failfast -count=1
|
||||||
|
go test -race -cover ${APPLE_SILICON_FLAG} "${PKG_DIR}/log/..." -failfast -count=1
|
||||||
|
go test -race -cover ${APPLE_SILICON_FLAG} "${PKG_DIR}/mq/..." -failfast -count=1
|
||||||
|
go test -race -cover ${APPLE_SILICON_FLAG} "${PKG_DIR}/tracer/..." -failfast -count=1
|
||||||
|
go test -race -cover ${APPLE_SILICON_FLAG} "${PKG_DIR}/util/..." -failfast -count=1
|
||||||
|
}
|
||||||
|
|
||||||
function test_datanode
|
function test_datanode
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -172,6 +183,7 @@ test_allocator
|
|||||||
test_tso
|
test_tso
|
||||||
test_config
|
test_config
|
||||||
test_util
|
test_util
|
||||||
|
test_pkg
|
||||||
test_metastore
|
test_metastore
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -223,6 +235,9 @@ case "${TEST_TAG}" in
|
|||||||
util)
|
util)
|
||||||
test_util
|
test_util
|
||||||
;;
|
;;
|
||||||
|
pkg)
|
||||||
|
test_pkg
|
||||||
|
;;
|
||||||
metastore)
|
metastore)
|
||||||
test_metastore
|
test_metastore
|
||||||
;;
|
;;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user