improve version checks for ci script (#3047)

This commit is contained in:
海亮
2023-10-16 21:18:23 +08:00
committed by GitHub
parent 19d7714503
commit d4e686226b

14
.github/workflows/build_and_test.sh vendored Normal file → Executable file
View File

@ -12,10 +12,10 @@ for file in `find . -name go.mod`; do
continue 1
fi
# package kuhecm needs golang >= v1.18
# package kuhecm needs golang >= v1.19
if [ "kubecm" = $(basename $dirpath) ]; then
continue 1
if ! go version|grep -q "1.19"; then
if ! go version|grep -qE "go1.19|go1.[2-9][0-9]"; then
echo "ignore kubecm as go version: $(go version)"
continue 1
fi
@ -23,15 +23,15 @@ for file in `find . -name go.mod`; do
# package etcd needs golang >= v1.19
if [ "etcd" = $(basename $dirpath) ]; then
if ! go version|grep -q "1.19"; then
if ! go version|grep -qE "go1.19|go1.[2-9][0-9]"; then
echo "ignore etcd as go version: $(go version)"
continue 1
fi
fi
# package example needs golang >= v1.19
# package example needs golang >= v1.20
if [ "example" = $(basename $dirpath) ]; then
if ! go version|grep -q "1.20"; then
if ! go version|grep -qE "go1.[2-9][0-9]"; then
echo "ignore example as go version: $(go version)"
continue 1
fi
@ -39,7 +39,7 @@ for file in `find . -name go.mod`; do
# package otlpgrpc needs golang >= v1.20
if [ "otlpgrpc" = $(basename $dirpath) ]; then
if ! go version|grep -q "1.20"; then
if ! go version|grep -qE "go1.[2-9][0-9]"; then
echo "ignore otlpgrpc as go version: $(go version)"
continue 1
fi
@ -47,7 +47,7 @@ for file in `find . -name go.mod`; do
# package otlphttp needs golang >= v1.20
if [ "otlphttp" = $(basename $dirpath) ]; then
if ! go version|grep -q "1.20"; then
if ! go version|grep -qE "go1.[2-9][0-9]"; then
echo "ignore otlphttp as go version: $(go version)"
continue 1
fi