travis: disable windows, update import path config, and only run goveralls on linux (#115)

This commit is contained in:
Robert van Gent
2019-02-05 16:08:41 -08:00
committed by GitHub
parent bee5b6c7c7
commit b1113bfdf1
2 changed files with 42 additions and 5 deletions

View File

@@ -15,10 +15,9 @@
os: os:
- linux - linux
- osx - osx
- windows
language: go language: go
go_import_path: github.com/google/go-cloud go_import_path: github.com/google/wire
go: "1.11.x" go: "1.11.x"
before_install: before_install:
@@ -37,11 +36,12 @@ install:
- "git config --global core.autocrlf input" - "git config --global core.autocrlf input"
- "git checkout -- ." - "git checkout -- ."
- "go install ./cmd/wire" - "go install ./cmd/wire"
- "go install github.com/mattn/goveralls" - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
go install github.com/mattn/goveralls;
fi
script: script:
- 'go test -race -coverpkg=./... -coverprofile=coverage.out ./...' - 'internal/runtests.sh'
- 'goveralls -coverprofile=coverage.out -service=travis-ci'
env: env:
global: global:

37
internal/runtests.sh Executable file
View File

@@ -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