Merge pull request #1248 from marcov/add-help-target

Add `help` and remove `watch` targets in docker.Makefile
This commit is contained in:
Silvin 2018-07-31 16:52:07 +02:00 committed by GitHub
commit 74071f2347
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 35 deletions

View File

@ -46,10 +46,6 @@ binary-osx: ## build executable for macOS
dynbinary: ## build dynamically linked binary dynbinary: ## build dynamically linked binary
./scripts/build/dynbinary ./scripts/build/dynbinary
.PHONY: watch
watch: ## monitor file changes and run go test
./scripts/test/watch
vendor: vendor.conf ## check that vendor matches vendor.conf vendor: vendor.conf ## check that vendor matches vendor.conf
rm -rf vendor rm -rf vendor
bash -c 'vndr |& grep -v -i clone' bash -c 'vndr |& grep -v -i clone'

View File

@ -41,84 +41,70 @@ build_e2e_image:
docker build -t $(E2E_IMAGE_NAME) --build-arg VERSION=$(VERSION) --build-arg GITCOMMIT=$(GITCOMMIT) -f ./dockerfiles/Dockerfile.e2e . docker build -t $(E2E_IMAGE_NAME) --build-arg VERSION=$(VERSION) --build-arg GITCOMMIT=$(GITCOMMIT) -f ./dockerfiles/Dockerfile.e2e .
# build executable using a container binary: build_binary_native_image ## build the CLI
binary: build_binary_native_image
docker run --rm $(ENVVARS) $(MOUNTS) $(BINARY_NATIVE_IMAGE_NAME) docker run --rm $(ENVVARS) $(MOUNTS) $(BINARY_NATIVE_IMAGE_NAME)
build: binary build: binary ## alias for binary
# clean build artifacts using a container
.PHONY: clean .PHONY: clean
clean: build_docker_image clean: build_docker_image ## clean build artifacts
docker run --rm $(ENVVARS) $(MOUNTS) $(DEV_DOCKER_IMAGE_NAME) make clean docker run --rm $(ENVVARS) $(MOUNTS) $(DEV_DOCKER_IMAGE_NAME) make clean
# run go test
.PHONY: test-unit .PHONY: test-unit
test-unit: build_docker_image test-unit: build_docker_image # run unit tests (using go test)
docker run --rm $(ENVVARS) $(MOUNTS) $(DEV_DOCKER_IMAGE_NAME) make test-unit docker run --rm $(ENVVARS) $(MOUNTS) $(DEV_DOCKER_IMAGE_NAME) make test-unit
.PHONY: test .PHONY: test ## run unit and e2e tests
test: test-unit test-e2e test: test-unit test-e2e
# build the CLI for multiple architectures using a container
.PHONY: cross .PHONY: cross
cross: build_cross_image cross: build_cross_image ## build the CLI for macOS and Windows
docker run --rm $(ENVVARS) $(MOUNTS) $(CROSS_IMAGE_NAME) make cross docker run --rm $(ENVVARS) $(MOUNTS) $(CROSS_IMAGE_NAME) make cross
.PHONY: binary-windows .PHONY: binary-windows
binary-windows: build_cross_image binary-windows: build_cross_image ## build the CLI for Windows
docker run --rm $(ENVVARS) $(MOUNTS) $(CROSS_IMAGE_NAME) make $@ docker run --rm $(ENVVARS) $(MOUNTS) $(CROSS_IMAGE_NAME) make $@
.PHONY: binary-osx .PHONY: binary-osx
binary-osx: build_cross_image binary-osx: build_cross_image ## build the CLI for macOS
docker run --rm $(ENVVARS) $(MOUNTS) $(CROSS_IMAGE_NAME) make $@ docker run --rm $(ENVVARS) $(MOUNTS) $(CROSS_IMAGE_NAME) make $@
.PHONY: watch
watch: build_docker_image
docker run --rm $(ENVVARS) $(MOUNTS) $(DEV_DOCKER_IMAGE_NAME) make watch
# start container in interactive mode for in-container development
.PHONY: dev .PHONY: dev
dev: build_docker_image dev: build_docker_image ## start a build container in interactive mode for in-container development
docker run -ti $(ENVVARS) $(MOUNTS) \ docker run -ti $(ENVVARS) $(MOUNTS) \
-v /var/run/docker.sock:/var/run/docker.sock \ -v /var/run/docker.sock:/var/run/docker.sock \
$(DEV_DOCKER_IMAGE_NAME) ash $(DEV_DOCKER_IMAGE_NAME) ash
shell: dev shell: dev ## alias for dev
# run linters in a container
.PHONY: lint .PHONY: lint
lint: build_linter_image lint: build_linter_image ## run linters
docker run -ti $(ENVVARS) $(MOUNTS) $(LINTER_IMAGE_NAME) docker run -ti $(ENVVARS) $(MOUNTS) $(LINTER_IMAGE_NAME)
# download dependencies (vendor/) listed in vendor.conf, using a container
.PHONY: vendor .PHONY: vendor
vendor: build_docker_image vendor.conf vendor: build_docker_image vendor.conf ## download dependencies (vendor/) listed in vendor.conf
docker run -ti --rm $(ENVVARS) $(MOUNTS) $(DEV_DOCKER_IMAGE_NAME) make vendor docker run -ti --rm $(ENVVARS) $(MOUNTS) $(DEV_DOCKER_IMAGE_NAME) make vendor
dynbinary: build_cross_image dynbinary: build_cross_image ## build the CLI dynamically linked
docker run -ti --rm $(ENVVARS) $(MOUNTS) $(CROSS_IMAGE_NAME) make dynbinary docker run -ti --rm $(ENVVARS) $(MOUNTS) $(CROSS_IMAGE_NAME) make dynbinary
.PHONY: authors .PHONY: authors
authors: ## generate AUTHORS file from git history authors: ## generate AUTHORS file from git history
docker run -ti --rm $(ENVVARS) $(MOUNTS) $(DEV_DOCKER_IMAGE_NAME) make authors docker run -ti --rm $(ENVVARS) $(MOUNTS) $(DEV_DOCKER_IMAGE_NAME) make authors
## generate man pages from go source and markdown
.PHONY: manpages .PHONY: manpages
manpages: build_docker_image manpages: build_docker_image ## generate man pages from go source and markdown
docker run -ti --rm $(ENVVARS) $(MOUNTS) $(DEV_DOCKER_IMAGE_NAME) make manpages docker run -ti --rm $(ENVVARS) $(MOUNTS) $(DEV_DOCKER_IMAGE_NAME) make manpages
## Generate documentation YAML files consumed by docs repo
.PHONY: yamldocs .PHONY: yamldocs
yamldocs: build_docker_image yamldocs: build_docker_image ## generate documentation YAML files consumed by docs repo
docker run -ti --rm $(ENVVARS) $(MOUNTS) $(DEV_DOCKER_IMAGE_NAME) make yamldocs docker run -ti --rm $(ENVVARS) $(MOUNTS) $(DEV_DOCKER_IMAGE_NAME) make yamldocs
.PHONY: shellcheck .PHONY: shellcheck
shellcheck: build_shell_validate_image shellcheck: build_shell_validate_image ## run shellcheck validation
docker run -ti --rm $(ENVVARS) $(MOUNTS) $(VALIDATE_IMAGE_NAME) make shellcheck docker run -ti --rm $(ENVVARS) $(MOUNTS) $(VALIDATE_IMAGE_NAME) make shellcheck
.PHONY: test-e2e .PHONY: test-e2e ## run e2e tests
test-e2e: test-e2e-non-experimental test-e2e-experimental test-e2e: test-e2e-non-experimental test-e2e-experimental
.PHONY: test-e2e-experimental .PHONY: test-e2e-experimental
@ -128,3 +114,7 @@ test-e2e-experimental: build_e2e_image
.PHONY: test-e2e-non-experimental .PHONY: test-e2e-non-experimental
test-e2e-non-experimental: build_e2e_image test-e2e-non-experimental: build_e2e_image
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock $(E2E_IMAGE_NAME) docker run --rm -v /var/run/docker.sock:/var/run/docker.sock $(E2E_IMAGE_NAME)
.PHONY: help
help: ## print this help
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {sub("\\\\n",sprintf("\n%22c"," "), $$2);printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)