From b1113bfdf158c49d2383116a6f6fdd37fc2b5293 Mon Sep 17 00:00:00 2001 From: Robert van Gent Date: Tue, 5 Feb 2019 16:08:41 -0800 Subject: [PATCH] travis: disable windows, update import path config, and only run goveralls on linux (#115) --- .travis.yml | 10 +++++----- internal/runtests.sh | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 5 deletions(-) create mode 100755 internal/runtests.sh diff --git a/.travis.yml b/.travis.yml index 8340ab1..21f267c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,10 +15,9 @@ os: - linux - osx - - windows language: go -go_import_path: github.com/google/go-cloud +go_import_path: github.com/google/wire go: "1.11.x" before_install: @@ -37,11 +36,12 @@ install: - "git config --global core.autocrlf input" - "git checkout -- ." - "go install ./cmd/wire" - - "go install github.com/mattn/goveralls" + - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then + go install github.com/mattn/goveralls; + fi script: - - 'go test -race -coverpkg=./... -coverprofile=coverage.out ./...' - - 'goveralls -coverprofile=coverage.out -service=travis-ci' + - 'internal/runtests.sh' env: global: diff --git a/internal/runtests.sh b/internal/runtests.sh new file mode 100755 index 0000000..4b501cf --- /dev/null +++ b/internal/runtests.sh @@ -0,0 +1,37 @@ +#!/usr/bin/env bash +# Copyright 2019 The Wire Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# https://coderwall.com/p/fkfaqq/safer-bash-scripts-with-set-euxo-pipefail +set -euxo pipefail + +if [[ $# -gt 0 ]]; then + echo "usage: runtests.sh" 1>&2 + exit 64 +fi + +result=0 + +# Run Go tests. Only do coverage for the Linux build +# because it is slow, and Coveralls will only save the last one anyway. +if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then + go test -race -coverpkg=./... -coverprofile=coverage.out ./... || result=1 + if [ -f coverage.out ]; then + goveralls -coverprofile=coverage.out -service=travis-ci + fi +else + go test -race ./... || result=1 +fi + +exit $result