diff --git a/Makefile b/Makefile index 4b9a71eae8..89ca9a4762 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,6 @@ test: lint: @gometalinter --config gometalinter.json ./... - .PHONY: binary binary: @./scripts/build/binary @@ -33,6 +32,10 @@ cross: dynbinary: @./scripts/build/dynbinary +.PHONY: watch +watch: + @./scripts/test/watch + # download dependencies (vendor/) listed in vendor.conf .PHONY: vendor vendor: vendor.conf diff --git a/README.md b/README.md index fcf49495ce..340556d8c7 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,6 @@ Run all linting: ``` $ make -f docker.Makefile lint ``` -` ### In-container development environment diff --git a/docker.Makefile b/docker.Makefile index 5fde78e470..3117ac538e 100644 --- a/docker.Makefile +++ b/docker.Makefile @@ -46,6 +46,10 @@ test: build_docker_image cross: build_cross_image @docker run --rm $(MOUNTS) $(CROSS_IMAGE_NAME) make cross +.PHONY: watch +watch: build_docker_image + @docker run --rm $(MOUNTS) $(DEV_DOCKER_IMAGE_NAME) make watch + # start container in interactive mode for in-container development .PHONY: dev dev: build_docker_image diff --git a/dockerfiles/Dockerfile.dev b/dockerfiles/Dockerfile.dev index d1887e85ef..a14ea25f29 100644 --- a/dockerfiles/Dockerfile.dev +++ b/dockerfiles/Dockerfile.dev @@ -15,6 +15,10 @@ RUN go get github.com/jteeuwen/go-bindata/go-bindata && \ cp /go/bin/go-bindata /usr/bin && \ rm -rf /go/src/* /go/pkg/* /go/bin/* +RUN go get github.com/dnephin/filewatcher && \ + cp /go/bin/filewatcher /usr/bin/ && \ + rm -rf /go/src/* /go/pkg/* /go/bin/* + ENV CGO_ENABLED=0 WORKDIR /go/src/github.com/docker/cli CMD sh diff --git a/scripts/test/watch b/scripts/test/watch new file mode 100755 index 0000000000..61057e2430 --- /dev/null +++ b/scripts/test/watch @@ -0,0 +1,12 @@ +#!/bin/sh + +set -e + +filewatcher \ + -L 5 \ + -x '**/*.swp' \ + -x .git \ + -x build \ + -x .idea \ + -- \ + sh -c 'go test -timeout 10s -v ./${dir} || ( echo; echo; exit 1 )'