未验证 提交 52765295 编写于 作者: C congqixia 提交者: GitHub

Make pkg code change trigger ci workflow (#23312)

Signed-off-by: NCongqi Xia <congqi.xia@zilliz.com>
上级 03a4f60b
......@@ -11,6 +11,7 @@ on:
paths:
- 'scripts/**'
- 'internal/**'
- 'pkg/**'
- 'cmd/**'
- 'build/**'
- '.github/workflows/code-checker.yaml'
......
......@@ -10,6 +10,7 @@ on:
paths:
- 'scripts/**'
- 'internal/**'
- 'pkg/**'
- 'cmd/**'
- 'build/**'
- '.github/workflows/mac.yaml'
......
......@@ -7,6 +7,7 @@ on:
paths:
- 'scripts/**'
- 'internal/**'
- 'pkg/**'
- 'cmd/**'
- 'build/**'
- '.github/workflows/main.yaml'
......@@ -21,6 +22,7 @@ on:
paths:
- 'scripts/**'
- 'internal/**'
- 'pkg/**'
- 'cmd/**'
- 'build/**'
- '.github/workflows/main.yaml'
......
......@@ -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 ./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 && cd pkg && GO111MODULE=on $(INSTALL_PATH)/golangci-lint run --timeout=30m --config ../.golangci.yml ./...
verifiers: build-cpp getdeps cppcheck fmt static-check
......
......@@ -17,6 +17,7 @@
package metrics
import (
// #nosec
_ "net/http/pprof"
"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) {
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)
_, err := c.Add("mock_vchannel_0", nil, mqwrapper.SubscriptionPositionUnknown)
assert.NoError(t, err)
......@@ -85,7 +85,7 @@ func TestManager(t *testing.T) {
t.Run("test run and close", func(t *testing.T) {
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)
_, err := c.Add("mock_vchannel_0", nil, mqwrapper.SubscriptionPositionUnknown)
assert.NoError(t, err)
......
......@@ -67,7 +67,7 @@ func getSeekPositions(factory msgstream.Factory, pchannel string, maxNum int) ([
defer stream.Close()
stream.AsConsumer([]string{pchannel}, fmt.Sprintf("%d", rand.Int()), mqwrapper.SubscriptionPositionEarliest)
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()
for {
select {
......
......@@ -19,8 +19,8 @@ import (
"sync"
"time"
"go.uber.org/zap"
"github.com/samber/lo"
"go.uber.org/zap"
config "github.com/milvus-io/milvus/pkg/config"
"github.com/milvus-io/milvus/pkg/log"
......
......@@ -26,7 +26,7 @@ BASEDIR=$(dirname "$0")
source $BASEDIR/setenv.sh
# run unittest
echo "Running unittest under ./internal"
echo "Running unittest under ./internal & ./pkg"
# starting the timer
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
fi
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`
echo "Total time for go unittest:" $(($endTime-$beginTime)) "s"
......
......@@ -30,9 +30,10 @@ if [[ "$(uname -m)" == "arm64" ]]; then
APPLE_SILICON_FLAG="-tags dynamic"
fi
# ignore MinIO,S3 unittes
# ignore MinIO,S3 unittests
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_TAG="ALL"
......@@ -70,7 +71,7 @@ go test -race -cover ${APPLE_SILICON_FLAG} "${MILVUS_DIR}/distributed/proxy/..."
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}/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
}
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
{
......@@ -172,6 +183,7 @@ test_allocator
test_tso
test_config
test_util
test_pkg
test_metastore
}
......@@ -223,6 +235,9 @@ case "${TEST_TAG}" in
util)
test_util
;;
pkg)
test_pkg
;;
metastore)
test_metastore
;;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册