1 В избранное 0 Ответвления 0

OSCHINA-MIRROR/mirrors-Zinc

Присоединиться к Gitlife
Откройте для себя и примите участие в публичных проектах с открытым исходным кодом с участием более 10 миллионов разработчиков. Приватные репозитории также полностью бесплатны :)
Присоединиться бесплатно
Клонировать/Скачать
coverage.sh 2.1 КБ
Копировать Редактировать Web IDE Исходные данные Просмотреть построчно История
Hengfei Yang Отправлено 15.07.2022 03:23 8976c72
#! /bin/sh
export ZINC_FIRST_ADMIN_USER=admin
export ZINC_FIRST_ADMIN_PASSWORD=Complexpass#123
export ZINC_WAL_SYNC_INTERVAL=10ms
export ZINC_WAL_REDOLOG_NO_SYNC=true
export ZINC_ENABLE_TEXT_KEYWORD_MAPPING=true
# clean up
find ./pkg -name data -type d|xargs rm -fR
find ./test -name data -type d|xargs rm -fR
rm -f coverage.out
# clean up finished
go test ./... -race -covermode=atomic -coverprofile=coverage.out
# If test fails exit the pipeline # Check discussion at https://github.com/golang/go/issues/25989
rc=$?
if [ $rc -ne 0 ]; then
echo "testing failed" >&2
exit $rc
fi
# codecov moved to separate github action to avoid running it when run locally
########## codecov starts ########
# make sure to set CODECOV_TOKEN env variable before doing this
# os=`uname -s`
# if ! command -v codecov &> /dev/null
# then
# # codecov uploader does not exist. Most likely in a CI environment.
# if [ $os == "Darwin" ]; then
# url="https://uploader.codecov.io/latest/macos/codecov"
# elif [ $os == "Linux" ]; then
# url="https://uploader.codecov.io/latest/linux/codecov"
# elif [ $os == "Windows" ]; then
# url="https://uploader.codecov.io/latest/linux/codecov"
# else
# echo "Unknown OS"
# continue
# fi
# curl -Os $url
# chmod +x codecov
# ./codecov -t ${CODECOV_TOKEN} -f coverage.out
# rm codecov
# else
# codecov -t ${CODECOV_TOKEN} -f coverage.out
# fi
########## codecov ends ########3
# Example setup https://github.com/lluuiissoo/go-testcoverage/blob/main/.github/workflows/ci.yml
# enable threshold
COVERAGE_THRESHOLD=81
totalCoverage=`go tool cover -func=coverage.out | grep total | grep -Eo '[0-9]+\.[0-9]'`
# clean up
find ./pkg -name data -type d|xargs rm -fR
find ./test -name data -type d|xargs rm -fR
# clean up finished
echo "Total Coverage is $totalCoverage %"
diff=$(echo "$totalCoverage < $COVERAGE_THRESHOLD" | bc)
if [ $diff -eq 1 ]; then
echo "Coverage is below threshold of $COVERAGE_THRESHOLD %"
exit 1
else
echo "Coverage is above threshold of $COVERAGE_THRESHOLD %"
exit 0
fi

Опубликовать ( 0 )

Вы можете оставить комментарий после Вход в систему

1
https://api.gitlife.ru/oschina-mirror/mirrors-Zinc.git
git@api.gitlife.ru:oschina-mirror/mirrors-Zinc.git
oschina-mirror
mirrors-Zinc
mirrors-Zinc
main