From 50a9bd8360a01be7e9e3f087af18ab68cf873d58 Mon Sep 17 00:00:00 2001 From: Yousong Zhou Date: Mon, 15 Jul 2019 03:39:07 +0000 Subject: [PATCH] =?UTF-8?q?.circleci:=20=E6=94=B9=E8=BF=9Btest=E6=89=A7?= =?UTF-8?q?=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 避免go test执行两次 避免因push到codecov失败造成测试失败 1457 @@ -10576,5 +10576,33 @@ yunion.io/x/onecloud/pkg/webconsole/comm 1458 yunion.io/x/onecloud/pkg/webconsole/command/ssh_command.go:147: GetData 1459 yunion.io/x/onecloud/pkg/webconsole/command/ssh_command.go:164: ShowInf 1460 total: (statements) 1461 -Push /tmp/coverage.8mKa1lRFeG/profile.out to codecov.io^M 1462 -Exited with code 7 1463 \ No newline at end of file 1464 +Push /tmp/coverage.GrWO8OlTrX/profile.out to codecov.io^M 1465 +^M 1466 + _____ _^M 1467 + / ____| | |^M 1468 +| | ___ __| | ___ ___ _____ __^M 1469 +| | / _ \ / _` |/ _ \/ __/ _ \ \ / /^M 1470 +| |___| (_) | (_| | __/ (_| (_) \ V /^M 1471 + \_____\___/ \__,_|\___|\___\___/ \_/^M 1472 + Bash-8a28df4^M 1473 +^M 1474 +^M 1475 +==> Circle CI detected.^M 1476 + project root: .^M 1477 +--> token set from env^M 1478 + Yaml found at: vendor/github.com/gin-gonic/gin/codecov.yml^M 1479 + -> Found 1 reports^M 1480 +==> Detecting git/mercurial file structure^M 1481 +==> Reading reports^M 1482 + + /tmp/coverage.GrWO8OlTrX/profile.out bytes=2221509^M --- .circleci/config.yml | 4 +--- scripts/coverage.sh | 6 ++++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index a903d98972..19e5860f6a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -49,9 +49,7 @@ jobs: - run: name: unit_test command: | - pkgs="$((go list -mod vendor ./... || true) | grep -vE '/(host-image|hostimage)\>' | circleci tests split)" - go test -v -mod vendor -ldflags '-w' $pkgs - pkgs="$pkgs" ./scripts/coverage.sh --codecov + ./scripts/coverage.sh --codecov - save_cache: key: onecloud-test-cache-{{ checksum "go.mod" }}-{{ checksum "Makefile" }} paths: diff --git a/scripts/coverage.sh b/scripts/coverage.sh index 766014aa82..b108ecbe7e 100755 --- a/scripts/coverage.sh +++ b/scripts/coverage.sh @@ -31,7 +31,7 @@ covermode=${COVERMODE:-atomic} coverdir=$(mktemp -d /tmp/coverage.XXXXXXXXXX) profile="${coverdir}/profile.out" if [ -z "$pkgs" ]; then - pkgs="$(go list ./... | egrep -v 'host-image|hostimage')" + pkgs="$(go list -mod vendor ./... | grep -vE 'host-image|hostimage')" fi echo "mode: $covermode" >"$profile" @@ -48,6 +48,8 @@ case "${1-}" in go tool cover -html "$profile" ;; --codecov) - push_to_codecov + if ! push_to_codecov; then + echo "ignored: push to codecov failed" >&2 + fi ;; esac