3
0

Makefile cleanup & structurize

- makefile is now divided in sections
 - remove separate test.sh and added 3 additional tasks (qa, qa.test & qa.vet)
 - add realize tool (watch & rebuild) along with .realize.yaml config
This commit is contained in:
Denis Arh
2018-07-12 17:33:35 +02:00
parent ed8482c803
commit 61aaf45c04
3 changed files with 89 additions and 20 deletions
Executable
+41
View File
@@ -0,0 +1,41 @@
settings:
files:
outputs:
status: false
path: ""
name: .r.outputs.log
logs:
status: false
path: ""
name: .r.logs.log
errors:
status: false
path: ""
name: .r.errors.log
legacy:
force: false
interval: 0s
server:
status: false
schema:
- name: crust
path: cmd/sam
commands:
vet:
status: true
test:
status: false
run:
status: true
args:
- api
watcher:
paths:
- .
- ../internal/
extensions:
- go
ignored_paths:
- .git
- .realize
- vendor
+48 -11
View File
@@ -1,16 +1,32 @@
.PHONY: build
.PHONY: build realize dep spec protobuf qa qa.test qa.vet
PKG = "github.com/$(shell cat .project)"
GO = go
GOGET = $(GO) get -u
########################################################################################################################
# Tool bins
SPEC = $(GOPATH)/bin/spec
PROTOC = $(GOPATH)/bin/protoc-gen-go
REALIZE = ${GOPATH}/bin/realize
SPEC=$(GOPATH)/bin/spec
PROTOC=$(GOPATH)/bin/protoc-gen-go
build:
docker build --rm -t $(shell cat .project) .
$(SPEC):
go get -u github.com/titpetric/spec/cmd/spec
$(PROTOC):
go get -u github.com/golang/protobuf/protoc-gen-go
########################################################################################################################
# Development
realize: $(REALIZE)
$(REALIZE) start
dep.update:
dep ensure -update -v
dep:
dep ensure -v
spec: $(SPEC)
cd sam/docs/src && $(SPEC)
@@ -20,8 +36,29 @@ protobuf: $(PROTOC)
# @todo this needs work (it hangs and outputs nothing)
$(PROTOC) --go_out=plugins=grpc:. -I. sam/chat/*.proto
dep:
dep ensure -v
dep.update:
dep ensure -update -v
########################################################################################################################
# QA
qa: qa.vet qa.test
qa.vet:
go vet `cd ${GOPATH}/src/; find $(PKG) -type f -name '*.go' -and -not -path '*vendor*'|xargs -n1 dirname|uniq`
qa.test:
go test `cd ${GOPATH}/src/; find $(PKG) -type f -name '*_test.go' -and -not -path '*vendor*'|xargs -n1 dirname|uniq`
########################################################################################################################
# Toolset
$(REALIZE):
$(GOGET) github.com/tockins/realize
$(SPEC):
$(GOGET) github.com/titpetric/spec/cmd/spec
$(PROTOC):
$(GOGET) github.com/golang/protobuf/protoc-gen-go
-9
View File
@@ -1,9 +0,0 @@
#!/bin/bash
set -e
set -u
PKG="github.com/$(<.project)"
go vet `cd ${GOPATH}/src/; find ${PKG} -type f -name '*.go' -and -not -path '*vendor*'|xargs -n1 dirname|uniq`
go test `cd ${GOPATH}/src/; find ${PKG} -type f -name '*_test.go' -and -not -path '*vendor*'|xargs -n1 dirname|uniq`