This repository has been archived by the owner on Apr 6, 2020. It is now read-only.
forked from mattermost/mattermost-push-proxy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
85 lines (62 loc) · 1.83 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
.PHONY: all dist build-server package test clean run update-dependencies-after-release gofmt govet check-style
GOPATH ?= $(GOPATH:)
GOFLAGS ?= $(GOFLAGS:)
BUILD_NUMBER ?= $(BUILD_NUMBER:)
BUILD_DATE = $(shell date -u)
BUILD_HASH = $(shell git rev-parse HEAD)
GO=go
ifeq ($(BUILD_NUMBER),)
BUILD_NUMBER := dev
endif
DIST_ROOT=dist
DIST_PATH=$(DIST_ROOT)/mattermost-push-proxy
TESTS=.
all: dist
check-style: gofmt govet
dist: | gofmt govet build-server test package
update-dependencies-after-release:
@echo Run this to updated the go lang dependencies after a major release
dep ensure -update
build-server: gofmt govet
@echo Building proxy push server
rm -Rf $(DIST_ROOT)
$(GO) clean $(GOFLAGS) -i ./...
$(GO) build $(GOFLAGS) ./...
$(GO) install $(GOFLAGS) ./...
gofmt:
@echo GOFMT
$(eval GOFMT_OUTPUT := $(shell gofmt -d -s server/ main.go 2>&1))
@echo "$(GOFMT_OUTPUT)"
@if [ ! "$(GOFMT_OUTPUT)" ]; then \
echo "gofmt sucess"; \
else \
echo "gofmt failure"; \
exit 1; \
fi
govet:
@echo Running govet
$(GO) get golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow
$(GO) vet $$(go list ./...) .
$(GO) vet -vettool=$(GOPATH)/bin/shadow $$(go list ./...)
@echo Govet success
package:
@ echo Packaging push proxy
mkdir -p $(DIST_PATH)/bin
cp $(GOPATH)/bin/mattermost-push-proxy $(DIST_PATH)/bin
cp -RL config $(DIST_PATH)/config
touch $(DIST_PATH)/config/build.txt
echo $(BUILD_NUMBER) | tee -a $(DIST_PATH)/config/build.txt
mkdir -p $(DIST_PATH)/logs
cp LICENSE.txt $(DIST_PATH)
cp NOTICE.txt $(DIST_PATH)
cp README.md $(DIST_PATH)
tar -C dist -czf $(DIST_PATH).tar.gz mattermost-push-proxy
test:
$(GO) test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=180s ./server || exit 1
clean:
@echo Cleaning
rm -Rf $(DIST_ROOT)
go clean $(GOFLAGS) -i ./...
run:
@echo Starting go web server
$(GO) run $(GOFLAGS) main.go