support make file
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -3,4 +3,5 @@ __debug_bin
|
|||||||
.vscode
|
.vscode
|
||||||
.idea
|
.idea
|
||||||
tmp/
|
tmp/
|
||||||
docker-compose.yml
|
docker-compose.yml
|
||||||
|
atom
|
||||||
29
Makefile
29
Makefile
@@ -1,36 +1,19 @@
|
|||||||
buildAt=`date +%Y/%m/%d-%H:%M:%S`
|
buildAt=`date +%Y/%m/%d-%H:%M:%S`
|
||||||
gitHash=`git rev-parse HEAD`
|
gitHash=`git rev-parse HEAD`
|
||||||
version=`git rev-parse --abbrev-ref HEAD | grep -v HEAD || git describe --exact-match HEAD || git rev-parse HEAD` ## todo: use current release git tag
|
version=`git rev-parse --abbrev-ref HEAD | grep -v HEAD || git describe --exact-match HEAD || git rev-parse HEAD` ## todo: use current release git tag
|
||||||
flags="-X 'app/utils.Version=${version}' -X 'app/utils.BuildAt=${buildAt}' -X 'app/utils.GitHash=${gitHash}'"
|
flags="-X 'atom/utils.Version=${version}' -X 'atom/utils.BuildAt=${buildAt}' -X 'atom/utils.GitHash=${gitHash}'"
|
||||||
|
|
||||||
GOPATH:=$(shell go env GOPATH)
|
GOPATH:=$(shell go env GOPATH)
|
||||||
|
|
||||||
.PHONY: init
|
|
||||||
init:
|
|
||||||
@go get -u google.golang.org/protobuf/proto
|
|
||||||
@go install github.com/golang/protobuf/protoc-gen-go@latest
|
|
||||||
@go install github.com/go-micro/generator/cmd/protoc-gen-micro@latest
|
|
||||||
|
|
||||||
.PHONY: proto
|
|
||||||
proto:
|
|
||||||
@protoc --proto_path=. --micro_out=. --go_out=:. proto/web_api.proto
|
|
||||||
|
|
||||||
.PHONY: update
|
|
||||||
update:
|
|
||||||
@go get -u
|
|
||||||
|
|
||||||
.PHONY: tidy
|
.PHONY: tidy
|
||||||
tidy:
|
tidy:
|
||||||
@go mod tidy
|
@go mod tidy
|
||||||
|
|
||||||
.PHONY: build
|
.PHONY: dist
|
||||||
build:
|
dist:
|
||||||
@go build -ldflags=${flags}
|
@go build -ldflags=${flags} -o bin/atom
|
||||||
|
@cp config.toml bin/
|
||||||
|
|
||||||
.PHONY: test
|
.PHONY: test
|
||||||
test:
|
test:
|
||||||
@go test -v ./... -cover
|
@go test -v ./... -cover
|
||||||
|
|
||||||
.PHONY: docker
|
|
||||||
docker:
|
|
||||||
@docker build -t web_api:latest .
|
|
||||||
2
bin/.gitignore
vendored
Normal file
2
bin/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
*
|
||||||
|
!.gitignore
|
||||||
Reference in New Issue
Block a user