1
0
mirror of https://github.com/hybridgroup/gobot.git synced 2025-04-26 13:48:49 +08:00

Further refinement of test.sh

* Update to test on go1.9.2
* Ensure flag from tip doesn't break build
This commit is contained in:
Trevor Rosen 2017-11-06 13:26:08 -06:00
parent 98d68d8549
commit f5b5632690
No known key found for this signature in database
GPG Key ID: 56054B6FF40DE0F9
3 changed files with 14 additions and 8 deletions

View File

@ -4,7 +4,7 @@ dist: trusty
go_import_path: gobot.io/x/gobot
go:
- 1.8.4
- 1.9.1
- 1.9.2
- tip
matrix:
allow_failures:

View File

@ -16,8 +16,7 @@ fmt_check:
# Test and generate coverage
test_with_coverage:
./ci/test.sh
exit $$?
./ci/test.sh || exit 1
deps:
ifeq (,$(shell which dep))

View File

@ -3,6 +3,11 @@
## Only uncomment the below for debugging
#set -euxo pipefail
LOCAL_GO_VERSION=$(go version | awk -F' ' '{print $3}' | tr -d '[:space:]')
GO_VERSION="${TRAVIS_GO_VERSION:=$LOCAL_GO_VERSION}"
TIP_VERSION_IDENTIFIER="tip"
echo $GO_VERSION
# Hold the package names that contain failures
FAIL_PACKAGES=()
@ -16,11 +21,13 @@ pushd $PWD/..
# Iterate over all non-vendor packages and run tests with coverage
for package in $EXCLUDING_VENDOR; do \
result=$(go test -covermode=count -coverprofile=tmp.cov $package)
# If a `go test` command has failures, it will exit 1
# a go vet check should exit 2 (https://github.com/golang/go/blob/master/src/cmd/vet/all/main.go#L58)
# `go test` contains `vet` was introduced in this Change https://go-review.googlesource.com/c/go/+/74356
if [ $? -eq 1 ]; then
if [ $GO_VERSION == $TIP_VERSION_IDENTIFIER ]; then
# `go test` runs a vet subset as of this Change https://go-review.googlesource.com/c/go/+/74356
result=$(go test -vet=off -covermode=count -coverprofile=tmp.cov $package)
else
result=$(go test -covermode=count -coverprofile=tmp.cov $package)
fi
if [ $? -ne 0 ]; then
FAIL_PACKAGES+=($package);
fi;
echo "$result"