From 435182d49fe2d2b138178bc34eb37051ab544327 Mon Sep 17 00:00:00 2001
From: Ken Brooks <kenneth.s.brooks@chase.com>
Date: Sun, 22 Mar 2020 19:25:36 -0400
Subject: [PATCH] adding tidy, test, fmt, and ci

---
 Makefile | 27 ++++++++++++++++++++++++---
 1 file changed, 24 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index ea272e8..f2b673d 100644
--- a/Makefile
+++ b/Makefile
@@ -1,12 +1,33 @@
 ARCH := darwin/amd64 linux/386 linux/amd64 windows/386 windows/amd64
 VERSION := $(shell git describe --always --dirty)
 LDFLAGS := -ldflags "-X main.version=${VERSION}"
+BUILD_DIR := build
+BINARY_NAME ?= yajsv
 
-yajsv: *.go
+.PHONY: build
+build: *.go
 	go build ${LDFLAGS}
 
+.PHONY: release
 release: *.go
-	gox -output 'build/{{.Dir}}.{{.OS}}.{{.Arch}}' -osarch "${ARCH}" ${LDFLAGS}
+	gox -output '${BUILD_DIR}/{{.Dir}}.{{.OS}}.{{.Arch}}' -osarch "${ARCH}" ${LDFLAGS}
 
+.PHONY: clean
 clean:
-	rm -rf build yajsv
+	$(eval BINARY := ${BINARY_NAME}$(if $(findstring windows,$(GOOS)),.exe,))
+	rm -rf ${BUILD_DIR} ${BINARY} coverage.out
+
+.PHONY: fmt
+fmt:
+	go fmt 	./...
+
+.PHONY: tidy
+tidy:
+	go mod tidy -v
+
+.PHONY: test
+test:
+	go test -coverprofile=coverage.out ./...
+
+.PHONY: ci
+ci: clean test build
\ No newline at end of file
-- 
GitLab