-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
94 lines (72 loc) · 2.29 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
84
85
86
87
88
89
90
91
92
93
94
PROJ=siconv
ORG_PATH=github.com/insighted4
REPO_PATH=$(ORG_PATH)/$(PROJ)
export PATH := $(PWD)/bin:$(PATH)
VERSION ?= $(shell ./scripts/git-version)
ENVIRONMENT ?= development
export ENVIRONMENT
$( shell mkdir -p bin )
$( shell mkdir -p release/bin )
$( shell mkdir -p release/images )
$( shell mkdir -p results )
user=$(shell id -u -n)
group=$(shell id -g -n)
export GOBIN=$(PWD)/bin
# Prefer ./bin instead of system packages for things like protoc, where we want
# to use the version orchestra uses, not whatever a developer has installed.
export PATH=$(GOBIN):$(shell printenv PATH)
export GO15VENDOREXPERIMENT=1
export GIN_MODE=release
LD_FLAGS="-w -X $(REPO_PATH)/version.Version=$(VERSION)"
build: clean bin/siconv
bin/siconv: check-go-version
@echo "Building SICONV"
@go install -v -ldflags $(LD_FLAGS) $(REPO_PATH)/cmd/siconv
.PHONY: release-binary
release-binary:
@echo "Releasing binary files"
@go build -race -o release/bin/server -v -ldflags $(LD_FLAGS) $(REPO_PATH)/cmd/siconv
.PHONY: start
start: build
@echo "Staring Server"
@$(GOBIN)/server start
.PHONY: revendor
revendor:
@dep ensure
test:
@echo "Testing"
@go test -v -i $(shell go list ./... | grep -v '/vendor/')
@go test -v $(shell go list ./... | grep -v '/vendor/')
testcoverage:
@echo "Testing with coverage"
@mkdir -p results
@go test -v ./... | go2xunit -output results/tests.xml
@gocov test ./... | gocov-xml > results/cobertura-coverage.xml
testrace:
@echo "Testing with race detection"
@go test -v -i --race $(shell go list ./... | grep -v '/vendor/')
@go test -v --race $(shell go list ./... | grep -v '/vendor/')
vet:
@echo "Running go tool vet on packages"
@go vet $(shell go list ./... | grep -v '/vendor/')
fmt:
@echo "Running gofmt on package sources"
@go fmt $(shell go list ./... | grep -v '/vendor/')
lint:
@echo "lint"
@for package in $(shell go list ./... | grep -v '/vendor/' | grep -v '/api' | grep -v '/server/internal'); do \
golint -set_exit_status $$package $$i || exit 1; \
done
.PHONY: check-go-version
check-go-version:
@echo "Checking Golang version"
@./scripts/check-go-version
.PHONY: clean
clean:
@echo "Cleaning Binary Folders"
@rm -rf bin/*
@rm -rf release/*
@rm -rf results/*
testall: testcoverage testrace vet fmt # lint
FORCE:
.PHONY: fmt lint test testall testcoverage testrace vet