Merge pull request #64 from rosenhouse/travis-ginkgo

travis: run with ginkgo -p instead of go test
This commit is contained in:
Casey Callendrello 2017-08-31 14:28:55 +02:00 committed by GitHub
commit 556e509097
2 changed files with 15 additions and 11 deletions

View File

@ -8,7 +8,7 @@ go:
env: env:
global: global:
- PATH=$GOROOT/bin:$PATH - PATH=$GOROOT/bin:$GOPATH/bin:$PATH
matrix: matrix:
- TARGET=amd64 - TARGET=amd64
- TARGET=arm - TARGET=arm
@ -19,6 +19,9 @@ env:
matrix: matrix:
fast_finish: true fast_finish: true
install:
- go get github.com/onsi/ginkgo/ginkgo
script: script:
- | - |
if [ "${TARGET}" == "amd64" ]; then if [ "${TARGET}" == "amd64" ]; then

21
test.sh
View File

@ -12,33 +12,34 @@ echo "Running tests"
# test everything that's not in vendor # test everything that's not in vendor
pushd "$GOPATH/src/$REPO_PATH" >/dev/null pushd "$GOPATH/src/$REPO_PATH" >/dev/null
TESTABLE="$(go list ./... | grep -v vendor | xargs echo)" ALL_PKGS="$(go list ./... | grep -v vendor | xargs echo)"
popd >/dev/null popd >/dev/null
GINKGO_FLAGS="-p --randomizeAllSpecs --randomizeSuites --failOnPending --progress"
# user has not provided PKG override # user has not provided PKG override
if [ -z "$PKG" ]; then if [ -z "$PKG" ]; then
TEST=$TESTABLE GINKGO_FLAGS="$GINKGO_FLAGS -r ."
FMT=$TESTABLE LINT_TARGETS="$ALL_PKGS"
# user has provided PKG override # user has provided PKG override
else else
TEST=$PKG GINKGO_FLAGS="$GINKGO_FLAGS $PKG"
LINT_TARGETS="$PKG"
# only run gofmt on packages provided by user
FMT="$TEST"
fi fi
sudo -E bash -c "umask 0; PATH=${GOROOT}/bin:$(pwd)/bin:${PATH} go test ${TEST}" cd "$GOPATH/src/$REPO_PATH"
sudo -E bash -c "umask 0; PATH=${GOROOT}/bin:$(pwd)/bin:${PATH} ginkgo ${GINKGO_FLAGS}"
echo "Checking gofmt..." echo "Checking gofmt..."
fmtRes=$(go fmt $FMT) fmtRes=$(go fmt $LINT_TARGETS)
if [ -n "${fmtRes}" ]; then if [ -n "${fmtRes}" ]; then
echo -e "go fmt checking failed:\n${fmtRes}" echo -e "go fmt checking failed:\n${fmtRes}"
exit 255 exit 255
fi fi
echo "Checking govet..." echo "Checking govet..."
vetRes=$(go vet $TEST) vetRes=$(go vet $LINT_TARGETS)
if [ -n "${vetRes}" ]; then if [ -n "${vetRes}" ]; then
echo -e "govet checking failed:\n${vetRes}" echo -e "govet checking failed:\n${vetRes}"
exit 255 exit 255