Skip to content

Commit

Permalink
Merge pull request #1 from gomicro/actions
Browse files Browse the repository at this point in the history
Adding actions
  • Loading branch information
dan9186 authored Apr 10, 2020
2 parents a98727f + bc572fc commit 7a09a03
Showing 1 changed file with 20 additions and 19 deletions.
39 changes: 20 additions & 19 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ DOCKER_SERVICE_NAME := $(APP)-app-$(JOB_ID)
all: test

.PHONY: clean
clean: ## Cleans out all generated items
clean: ## Clean out all generated items
-@$(GOCLEAN)
-@rm -f output.txt
-@rm -rf coverage
Expand All @@ -50,32 +50,33 @@ coverage_compfriendly: ## Generates the code coverage in a computer friendly ma
@$(GOCMD) tool cover -func=$(COVERAGE_DIR)/tmp/full.out | tail -n 1 | sed -e 's/^.*statements)[[:space:]]*//' -e 's/%//'

.PHONY: deploy
deploy: dockerize push_image ## Deploys the service

.PHONY: dockerize
dockerize: ## Create a docker image of the project
docker build \
-t $(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_LABEL) .

.PHONY: gcr_login
gcr_login: ## Login to the GCR image repo
docker login -u _json_key -p "$$(cat $(HOME)/.gcp/keyfile.json)" https://us.gcr.io

.PHONY: push_image
push_image: ## Push the latest docker image to the repo
docker push $(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_LABEL)
deploy: ## Deploy the artifacts
@echo "Logging into Docker Hub"
-@echo "$(DOCKER_PASSWORD)" | docker login -u "$(DOCKER_USERNAME)" --password-stdin
@ext/goreleaser release

.PHONY: help
help: ## Show This Help
help: ## Show This Help
@for line in $$(cat Makefile | grep "##" | grep -v "grep" | sed "s/:.*##/:/g" | sed "s/\ /!/g"); do verb=$$(echo $$line | cut -d ":" -f 1); desc=$$(echo $$line | cut -d ":" -f 2 | sed "s/!/\ /g"); printf "%-30s--%s\n" "$$verb" "$$desc"; done

.PHONY: test
test: unit_test ## Run all available tests

.PHONY: unit_test
unit_test: ## Run unit tests
unit_test: ## Run all available unit tests
$(GOTEST)

.PHONY: fmt
fmt: ## Run go fmt
$(GOFMT)
fmt: ## Run gofmt
@echo "checking formatting..."
@$(GOFMT) $(shell $(GOLIST) ./... | grep -v '/vendor/')

.PHONY: vet
vet: ## Run go vet
@echo "vetting..."
@$(GOVET) $(shell $(GOLIST) ./... | grep -v '/vendor/')

.PHONY: lint
lint: ## Run golint
@echo "linting..."
@$(GOLINTCMD) -set_exit_status $(shell $(GOLIST) ./... | grep -v '/vendor/')

0 comments on commit 7a09a03

Please sign in to comment.