forked from evepraisal/go-evepraisal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
73 lines (57 loc) · 1.75 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
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 install github.com/jstemmer/go-junit-report@master
# brew install golangci-lint
build: generate
@go build -gcflags=-trimpath=$(shell pwd) \
-asmflags=-trimpath=$(shell pwd) \
-gcflags=-trimpath=$(shell pwd) \
-mod vendor \
${BUILD_OPTS} \
-o ./target/evepraisal-${GOOS}-${GOARCH} \
./evepraisal
install: generate
@go install -gcflags=-trimpath=$(shell pwd) -asmflags=-trimpath=$(shell pwd) -mod vendor ${BUILD_OPTS} ${PKG_DIRS}
@go install -gcflags=-trimpath=$(shell pwd) \
-asmflags=-trimpath=$(shell pwd) \
-gcflags=-trimpath=$(shell pwd) \
-mod vendor \
${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:
golangci-lint run -v ./...
run: install
evepraisal
run-reload:
reflex -c reflex.conf
dist:
ENV=PROD GOOS=linux GOARCH=amd64 make build
deploy-prod: dist
USERNAME=root HOSTNAME=evepraisal.com ./scripts/deploy.sh