diff --git a/.travis.yml b/.travis.yml index 33f94f5..3fbee5b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,22 @@ language: go +sudo: required +services: + - docker + go: - - 1.6 - - 1.5 + - "1.10" + - "1.9" + - "1.8" + env: - - GO15VENDOREXPERIMENT=1 + global: + - WATCHER_VERSION=0.2.4 + +matrix: + fast_finish: true + +script: go test ./... + +after_success: + ./build.sh diff --git a/Dockerfiles/Dockerfile.go1.10 b/Dockerfiles/Dockerfile.go1.10 new file mode 100644 index 0000000..47a432c --- /dev/null +++ b/Dockerfiles/Dockerfile.go1.10 @@ -0,0 +1,9 @@ +FROM golang:1.10-alpine3.7 + +VOLUME /go/src + +ARG WATCHER_VERSION=0.2.4 + +ADD watcher $GOPATH/bin/watcher + +CMD ["watcher"] diff --git a/Dockerfiles/Dockerfile.go1.8 b/Dockerfiles/Dockerfile.go1.8 new file mode 100644 index 0000000..a6beadc --- /dev/null +++ b/Dockerfiles/Dockerfile.go1.8 @@ -0,0 +1,9 @@ +FROM golang:1.8-alpine3.6 + +VOLUME /go/src + +ARG WATCHER_VERSION=0.2.4 + +ADD watcher $GOPATH/bin/watcher + +CMD ["watcher"] diff --git a/Dockerfiles/Dockerfile.go1.9 b/Dockerfiles/Dockerfile.go1.9 new file mode 100644 index 0000000..d54130c --- /dev/null +++ b/Dockerfiles/Dockerfile.go1.9 @@ -0,0 +1,9 @@ +FROM golang:1.9-alpine3.7 + +VOLUME /go/src + +ARG WATCHER_VERSION=0.2.4 + +ADD watcher $GOPATH/bin/watcher + +CMD ["watcher"] diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..2c39c1b --- /dev/null +++ b/build.sh @@ -0,0 +1,10 @@ +#!/bin/bash -xe +#if [ "$TRAVIS_BRANCH" == "master" ]; then + go build -o watcher cmd/watcher/main.go + docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD" + GO_VERSION=$(go version | awk '{print $3}') + + docker build -f Dockerfiles/Dockerfile.$GO_VERSION -t canthefason/go-watcher:$WATCHER_VERSION-$GO_VERSION . + + docker push canthefason/go-watcher:$WATCHER_VERSION-$GO_VERSION +#fi diff --git a/common_test.go b/common_test.go index 7847e1f..ae04adf 100644 --- a/common_test.go +++ b/common_test.go @@ -8,7 +8,7 @@ func TestParamsGet(t *testing.T) { run := params.Get("run") if run != "statler" { - t.Error("Expected statler but got %s in params.Get()", run) + t.Errorf("Expected statler but got %s in params.Get()", run) t.FailNow() } } @@ -20,7 +20,7 @@ func TestParamsClone(t *testing.T) { params.cloneRunFlag() watch := params.Get("watch") if watch != "statler" { - t.Error("Expected statler but got %s when watch param is not set", watch) + t.Errorf("Expected statler but got %s when watch param is not set", watch) } params.Watcher["watch"] = "waldorf" diff --git a/watch.go b/watch.go index 0704936..d576f88 100644 --- a/watch.go +++ b/watch.go @@ -41,7 +41,7 @@ func MustRegisterWatcher(params *Params) *Watcher { if watchVendorStr != "" { watchVendor, err = strconv.ParseBool(watchVendorStr) if err != nil { - log.Println("Wrong watch-vendor value: %s (default=false)", watchVendorStr) + log.Printf("Wrong watch-vendor value: %s (default=false)\n", watchVendorStr) } }