YTSFlix_Go/Makefile

39 lines
1.1 KiB
Makefile
Raw Normal View History

2018-11-04 14:58:15 +00:00
PROJECT_NAME=ytsflix
PKG := git.adphi.net/Adphi/$(PROJECT_NAME)
VERSION=0.0.2
GOPATH:=$(shell go env GOPATH)
.PHONY: tests deps build docker push coverage
all: deps tests coverage build docker push## Run all commands except docker
all-docker: docker push ## Run all docker commands
tests: ## Run test suite
@go test -v ./... -cover
coverage: ## Generate global code coverage report
@mkdir -p cover
@touch cover/${PROJECT_NAME}cov
go tool cover -html=cover/${PROJECT_NAME}cov -o coverage.html
docker: deps ## Build Docker images
@docker build -f Dockerfile -t adphi/${PROJECT_NAME}:latest -t adphi/${PROJECT_NAME}:${VERSION} .
push : ## Push Docker images
@docker push adphi/${PROJECT_NAME}:latest
@docker push adphi/${PROJECT_NAME}:${VERSION}
deps: ## Get dependencies
@rm -rf vendor
@govendor init
@govendor add +external
build: ## Build service
@go build -v -o build/${PROJECT_NAME} cmd/main.go
help: ## Display this help screen
@grep -h -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'