-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
54 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,25 @@ | ||
language: go | ||
|
||
go: | ||
- '1.10' | ||
- '1.11' | ||
|
||
notifications: | ||
email: false | ||
|
||
services: | ||
- docker | ||
env: | ||
- GO111MODULE=on | ||
|
||
git: | ||
depth: 1 | ||
|
||
before_install: | ||
- curl https://github.com/golang/dep/master/install.sh | sh | ||
- go get golang.org/x/tools/cmd/goimports | ||
os: linux | ||
|
||
install: | ||
- dep ensure | ||
- go get golang.org/x/tools/cmd/goimports | ||
- go get golang.org/x/tools/cmd/cover | ||
- go get github.com/mattn/goveralls | ||
- go mod vendor | ||
|
||
script: | ||
- bash ./travis/run.sh | ||
- 'if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then bash ./travis/run_on_pull_requests.sh; fi' | ||
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then bash ./travis/run_on_non_pull_requests.sh; fi' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/bin/bash | ||
|
||
# goimports test | ||
diff <(goimports -d $(find . -type f -name '*.go' -not -path "*/vendor/*")) <(printf "") | ||
|
||
if [ $? -ne 0 ]; then | ||
echo "goimports format error" >&2 | ||
exit 1 | ||
fi | ||
|
||
# run go test | ||
go test -v -mod=vendor ./... | ||
|
||
if [ $? -ne 0 ]; then | ||
echo "go test fail" >&2 | ||
exit 1 | ||
fi | ||
|
||
# generate go test coverage file | ||
go test -v -mod=vendor ./... -covermode=count -coverprofile=coverage.out | ||
|
||
if [ $? -ne 0 ]; then | ||
echo "go test coverage fail" >&2 | ||
exit 1 | ||
fi | ||
|
||
# notify to coveralls | ||
goveralls -coverprofile=coverage.out -service=travis-ci | ||
|
||
if [ $? -ne 0 ]; then | ||
echo "go update test coverage fail" >&2 | ||
exit 1 | ||
fi | ||
|
||
exit 0 |
14 changes: 9 additions & 5 deletions
14
travis/run.sh → travis/run_on_pull_requests
100755 → 100644
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,19 @@ | ||
#!/bin/bash | ||
|
||
# goimports test | ||
diff <(goimports -d $(find . -type f -name '*.go' -not -path "*/vendor/*")) <(printf "") | ||
|
||
if [ $? -ne 0 ]; then | ||
echo "goimports format error" >&2 | ||
exit 1 | ||
echo "goimports format error" >&2 | ||
exit 1 | ||
fi | ||
|
||
go test -p 1 ./... | ||
# run go test | ||
go test -v -mod=vendor ./... | ||
|
||
if [ $? -ne 0 ]; then | ||
echo "go test fail" >&2 | ||
exit 1 | ||
echo "go test fail" >&2 | ||
exit 1 | ||
fi | ||
|
||
exit 0 |