mirror of
https://github.com/vbatts/git-validation.git
synced 2024-11-17 13:58:39 +00:00
travis: adding checks for basic regressions
* go vet * golint * whether the tool builds * tests (there are none yet) Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
parent
41062f1be2
commit
e3ba588c3a
2 changed files with 32 additions and 1 deletions
20
.travis.yml
Normal file
20
.travis.yml
Normal file
|
@ -0,0 +1,20 @@
|
|||
language: go
|
||||
go:
|
||||
- 1.6
|
||||
- 1.5.3
|
||||
|
||||
sudo: false
|
||||
|
||||
before_install:
|
||||
- go get golang.org/x/tools/cmd/vet
|
||||
- go get -u github.com/golang/lint/golint
|
||||
- mkdir -p $GOPATH/src/github.com/vbatts && ln -sf $(pwd) $GOPATH/src/github.com/vbatts/git-validation && go get ./...
|
||||
|
||||
install: true
|
||||
|
||||
script:
|
||||
- go vet -x ./...
|
||||
- golint ./...
|
||||
- go build .
|
||||
- go test -v ./...
|
||||
|
13
main.go
13
main.go
|
@ -5,6 +5,7 @@ import (
|
|||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
_ "github.com/vbatts/git-validation/rules/dco"
|
||||
_ "github.com/vbatts/git-validation/rules/shortsubject"
|
||||
|
@ -19,6 +20,7 @@ var (
|
|||
flDebug = flag.Bool("D", false, "debug output")
|
||||
flQuiet = flag.Bool("q", false, "less output")
|
||||
flDir = flag.String("d", ".", "git directory to validate from")
|
||||
flNoTravis = flag.Bool("no-travis", false, "disables travis environment checks (when env TRAVIS=true is set)")
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
@ -44,7 +46,16 @@ func main() {
|
|||
rules = validate.FilterRules(rules, validate.SanitizeFilters(*flRun))
|
||||
}
|
||||
|
||||
runner, err := validate.NewRunner(*flDir, rules, *flCommitRange, *flVerbose)
|
||||
var commitRange = *flCommitRange
|
||||
if strings.ToLower(os.Getenv("TRAVIS")) == "true" && !*flNoTravis {
|
||||
if os.Getenv("TRAVIS_COMMIT_RANGE") != "" {
|
||||
commitRange = os.Getenv("TRAVIS_COMMIT_RANGE")
|
||||
} else if os.Getenv("TRAVIS_COMMIT") != "" {
|
||||
commitRange = os.Getenv("TRAVIS_COMMIT")
|
||||
}
|
||||
}
|
||||
|
||||
runner, err := validate.NewRunner(*flDir, rules, commitRange, *flVerbose)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue