forked from evepraisal/go-evepraisal
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
83 lines (67 loc) · 2.08 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
PKG_DIRS=$(shell go list ./... | grep -v /vendor/)
PKG_FILES=$(shell go list -f '{{ range $$value := .GoFiles }}{{if (ne $$value "bindata.go") }}{{$$.Dir}}/{{$$value}} {{end}}{{end}}' ./...)
TEST_REPORT_PATH ?= target/reports
ENV?=dev
ifeq ($(ENV), dev)
BUILD_OPTS?=-tags dev
BINDATA_FLAGS?=-debug
else
BUILD_OPTS?=
endif
GOOS?=$(shell go env GOOS)
GOARCH?=$(shell go env GOARCH)
GOPATH?=$(shell go env GOPATH)
SHELL := $(shell which bash)
export PATH := $(PATH):$(GOPATH)/bin
default: build
.PHONY: setup build install generate clean test test-reload run run-reload dist deploy
setup:
go get -u github.com/go-bindata/go-bindata/[email protected]
go get -u github.com/cespare/reflex
go get -u github.com/jstemmer/go-junit-report@master
go get -u github.com/fzipp/gocyclo
go get -u github.com/jgautheron/goconst/cmd/goconst
go get -u golang.org/x/tools/cmd/goimports
go get -u github.com/gordonklaus/ineffassign
go get -u github.com/walle/lll/cmd/lll
go get -u github.com/client9/misspell/cmd/misspell
build: generate
go build -mod mod ${BUILD_OPTS} -o ./target/evepraisal-${GOOS}-${GOARCH} ./evepraisal
install: generate
go install -mod mod ${BUILD_OPTS} ${PKG_DIRS}
generate:
go generate ${BUILD_OPTS} ${PKG_DIRS}
clean:
go clean ./...
rm -rf target
test: generate
mkdir -p ${TEST_REPORT_PATH}
go test ${PKG_DIRS} -v 2>&1 | tee ${TEST_REPORT_PATH}/go-test.out
cat ${TEST_REPORT_PATH}/go-test.out | go-junit-report -set-exit-code > ${TEST_REPORT_PATH}/go-test-report.xml
test-reload:
reflex -c reflex.test.conf
lint:
@echo "govet"
go vet ${PKG_DIRS}
@echo "gocyclo"
@gocyclo -over 50 ${PKG_FILES}
@echo "goconst"
@goconst -ignore "vendor\/" ${PKG_FILES}
@echo "gofmt"
@gofmt -d ${PKG_FILES}
@echo "goimports"
@goimports -d ${PKG_FILES}
@echo "ineffassign"
@ineffassign .
@echo "line length linter"
@lll --maxlength 150 --skiplist="" ${PKG_FILES}
@echo "misspell"
@misspell ${PKG_FILES}
run: install
evepraisal
run-reload:
reflex -c reflex.conf
dist:
ENV=PROD GOOS=linux GOARCH=amd64 make build
deploy-prod: dist
USERNAME=root HOSTNAME=new.evepraisal.com ./scripts/deploy.sh