This is an automated email from the ASF dual-hosted git repository.

smihaylov pushed a commit to branch travis
in repository https://gitbox.apache.org/repos/asf/incubator-milagro-dta.git

commit 64215e5fb7788d1c1926ec819ab423a30c7e3bd1
Author: Stanislav Mihaylov <[email protected]>
AuthorDate: Fri Sep 6 10:53:54 2019 +0300

    Add travis
---
 .travis.yml       | 13 +++++++++++++
 Dockerfile-alpine | 13 ++++++++++---
 lint.sh           |  2 +-
 3 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..5854278
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,13 @@
+language: go
+go:
+  - "1.12.x"
+
+services:
+  - docker
+
+install:
+  - docker build -t milagro-test -f Dockerfile-alpine .
+  - docker run -d -p 127.0.0.1:5556:5556 --name milagro milagro-test
+
+script:
+  - docker ps | grep -q milagro
diff --git a/Dockerfile-alpine b/Dockerfile-alpine
index d27f2c9..0589934 100644
--- a/Dockerfile-alpine
+++ b/Dockerfile-alpine
@@ -1,4 +1,4 @@
-FROM golang:alpine as builder
+FROM golang:1.12-alpine as builder
 
 RUN apk update && apk add --no-cache \
     ca-certificates \
@@ -74,22 +74,29 @@ RUN mkdir -p pqnist/build && \
        make && make install
 
 
+RUN go get -u golang.org/x/lint/golint
+
 RUN echo Building Milagro DTA
 
 ENV PROJECT_PATH=/src/github.com/apache/incubator-milagro-dta
 ENV CGO_LDFLAGS="-L $LIBRARY_PATH"
 ENV CGO_CPPFLAGS="-I $C_INCLUDE_PATH"
 
-ADD . $PROJECT_PATH
 WORKDIR $PROJECT_PATH
+ADD . $PROJECT_PATH
+
+RUN GO111MODULES=on go mod vendor
+
+RUN ./lint.sh
 
 RUN CGO_ENABLED=1 \
-    GO111MODULES=on \
     go build \
       -ldflags '-w -linkmode external -extldflags "-static"' \
       -o $GOPATH/bin/milagro \
       github.com/apache/incubator-milagro-dta/cmd/service
 
+RUN go test -cover `go list ./...`
+
 RUN $GOPATH/bin/milagro init
 
 FROM scratch
diff --git a/lint.sh b/lint.sh
index 6a2e742..7b862e2 100755
--- a/lint.sh
+++ b/lint.sh
@@ -4,4 +4,4 @@ echo "Run go fmt"
 test -z "$(gofmt -s -l . 2>&1 | grep -v vendor | tee /dev/stderr)"
 
 echo "Run go lint"
-golint -set_exit_status $(go list ./... | grep -v /vendor/)
+golint -set_exit_status $(go list ./...)

Reply via email to