Skip to content

Commit

Permalink
update dev tools
Browse files Browse the repository at this point in the history
  • Loading branch information
dnephin committed Mar 10, 2019
1 parent 0ebdcf9 commit 2259c56
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 56 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: 2.1

orbs:
go: gotest/tools@dev:0.0.8
go: gotest/tools@0.0.8

workflows:
version: 2
Expand Down
1 change: 1 addition & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ linters-settings:
line-length: 100
gocritic:
enabled-tags:
- diagnostic
- performance
- style
- experimental
Expand Down
37 changes: 16 additions & 21 deletions dobi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@ mount=source:
bind: .
path: /go/src/gotest.tools/gotestsum

mount=depsources:
bind: ./.depsources
path: /go/pkg/dep/sources
mount=buildcache:
bind: ~/.cache/go-build
path: /root/.cache/go-build

mount=modcache:
bind: ~/go/pkg/mod
path: /go/pkg/mod

image=builder:
image: gotestsum-dev
Expand All @@ -17,45 +21,36 @@ image=builder:
args:
GOLANG_VERSION: '{env.GOLANG_VERSION:}'

image=linter:
image: gotestsum-lint
context: dobifiles/
dockerfile: Dockerfile
target: linter

job=shell:
use: builder
mounts: [source, depsources]
mounts: [source, buildcache, modcache]
interactive: true
command: sh

job=watch:
use: builder
mounts: [source]
mounts: [source, buildcache, modcache]
interactive: true
command: |
filewatcher -x vendor ./dist/gotestsum -- -test.timeout 10s
env: ['GOTESTSUM_FORMAT=short-verbose']
depends: [binary]

job=test-unit:
use: builder
mounts: [source]
mounts: [source, buildcache, modcache]
interactive: true
command: scripts/test-unit

job=deps:
use: builder
mounts: [source, depsources]
command: dep ensure

job=lint:
use: linter
mounts: [source]
use: builder
mounts: [source, buildcache, modcache]
command: golangci-lint run

job=binary:
use: builder
mounts: [source]
command: scripts/build
mounts: [source, buildcache, modcache]
command: bash -c 'mkdir -p dist; go build -o dist/gotestsum .'

alias=test:
tasks: [test-unit]
43 changes: 9 additions & 34 deletions dobifiles/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,45 +1,20 @@

ARG GOLANG_VERSION
FROM golang:${GOLANG_VERSION:-1.11-alpine} as golang
FROM golang:${GOLANG_VERSION:-1.12-alpine} as golang
RUN apk add -U curl git bash
ENV CGO_ENABLED=0 \
PS1="# " \
GO111MODULE=on
WORKDIR /go/src/gotest.tools/gotestsum
ENV CGO_ENABLED=0
ENV PS1="# "


FROM golang as tools
ARG FILEWATCHER=v0.3.2
RUN go get -d github.com/dnephin/filewatcher && \
cd /go/src/github.com/dnephin/filewatcher && \
git checkout -q "$FILEWATCHER" && \
go build -o /usr/bin/filewatcher .
ARG DEP_TAG=v0.4.1
RUN go get -d github.com/golang/dep/cmd/dep && \
cd /go/src/github.com/golang/dep && \
git checkout -q "$DEP_TAG" && \
go build -o /usr/bin/dep ./cmd/dep

RUN go get github.com/dnephin/filewatcher@v0.3.2
RUN wget -O- -q https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s && \
mv bin/golangci-lint /go/bin

FROM golang as dev
COPY --from=tools /usr/bin/filewatcher /usr/bin/filewatcher
COPY --from=tools /usr/bin/dep /usr/bin/dep

COPY --from=tools /go/bin/filewatcher /usr/bin/filewatcher
COPY --from=tools /go/bin/golangci-lint /usr/bin/golangci-lint

FROM dev as dev-with-source
COPY . .


FROM golang as linter
ARG GOMETALINTER=v2.0.5
RUN go get -d github.com/alecthomas/gometalinter && \
cd /go/src/github.com/alecthomas/gometalinter && \
git checkout -q "$GOMETALINTER" && \
go build -v -o /usr/local/bin/gometalinter . && \
gometalinter --install && \
rm -rf /go/src/* /go/pkg/*
ENTRYPOINT ["/usr/local/bin/gometalinter"]
CMD ["--config=.gometalinter.json", "./..."]


FROM linter as linter-with-source
COPY . .

0 comments on commit 2259c56

Please sign in to comment.