Use Travis build stages for lint and test builds
- Lint build runs scripts in ci directory. - Test build runs go test kkn.fi/vanity - Test build is only run if Lint succeeds - Run all stages (Lint & Test) with Go 1.9 git-svn-id: file:///srv/svn/repo/toyohime/trunk@73 922d331f-388e-da47-97a9-ad700dc0b8b9
This commit is contained in:
parent
3cd1c026a8
commit
86974d94cd
16
.travis.yml
16
.travis.yml
@ -1,6 +1,14 @@
|
||||
dist: trusty
|
||||
language: go
|
||||
go_import_path: kkn.fi/vanity
|
||||
script: make test
|
||||
go:
|
||||
- 1.9
|
||||
- tip
|
||||
go: 1.9.x
|
||||
jobs:
|
||||
include:
|
||||
- stage: lint
|
||||
script:
|
||||
- ./ci/validate-gofmt.sh
|
||||
- go get -u github.com/golang/lint/golint
|
||||
- ./ci/lint.sh
|
||||
- stage: test
|
||||
script: go test kkn.fi/vanity
|
||||
install: skip
|
||||
|
14
ci/lint.sh
Executable file
14
ci/lint.sh
Executable file
@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
pkg=kkn.fi/vanity
|
||||
|
||||
go vet $pkg
|
||||
if [ $? -ne 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
output=`golint $pkg`
|
||||
if [ "$output" != "" ]; then
|
||||
echo "$output" 1>&2
|
||||
exit 1
|
||||
fi
|
13
ci/validate-gofmt.sh
Executable file
13
ci/validate-gofmt.sh
Executable file
@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
# $pkg is relative path to package
|
||||
pkg=kkn.fi/vanity
|
||||
importPath=kkn.fi/vanity
|
||||
relativePkg="${pkg/$importPath/.}"
|
||||
|
||||
output=`gofmt -s -l $relativePkg`
|
||||
if [ "$output" != "" ]; then
|
||||
echo "validate-gofmt.sh: error $pkg" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
exit 0
|
Loading…
x
Reference in New Issue
Block a user