forked from moira-alert/notifier
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
68 lines (56 loc) · 1.8 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
VERSION := $(shell git describe --always --tags --abbrev=0 | tail -c +2)
RELEASE := $(shell git describe --always --tags | awk -F- '{ if ($$2) dot="."} END { printf "1%s%s%s%s\n",dot,$$2,dot,$$3}')
VENDOR := "SKB Kontur"
URL := "https://github.com/moira-alert"
LICENSE := "GPLv3"
default: test build
build:
go build -ldflags "-X main.Version=$(VERSION)-$(RELEASE)" -o build/moira-notifier github.com/moira-alert/notifier/notifier
test: prepare
cd tests && ginkgo -r --randomizeAllSpecs --randomizeSuites --tags=func -cover -coverpkg=../ --failOnPending --trace --race --progress
.PHONY: test
lint:
go vet -x ./...
golint ./...
prepare:
go get github.com/kardianos/govendor
govendor sync
clean:
rm -rf build
tar:
mkdir -p build/root/usr/local/bin
mkdir -p build/root/usr/lib/systemd/system
mkdir -p build/root/etc/logrotate.d/
mv build/moira-notifier build/root/usr/local/bin/
cp pkg/moira-notifier.service build/root/usr/lib/systemd/system/moira-notifier.service
cp pkg/logrotate build/root/etc/logrotate.d/moira-notifier
tar -czvPf build/moira-notifier-$(VERSION)-$(RELEASE).tar.gz -C build/root .
rpm:
fpm -t rpm \
-s "tar" \
--description "Moira Notifier" \
--vendor $(VENDOR) \
--url $(URL) \
--license $(LICENSE) \
--name "moira-notifier" \
--version "$(VERSION)" \
--iteration "$(RELEASE)" \
--after-install "./pkg/postinst" \
--depends logrotate \
-p build \
build/moira-notifier-$(VERSION)-$(RELEASE).tar.gz
deb:
fpm -t deb \
-s "tar" \
--description "Moira Notifier" \
--vendor $(VENDOR) \
--url $(URL) \
--license $(LICENSE) \
--name "moira-notifier" \
--version "$(VERSION)" \
--iteration "$(RELEASE)" \
--after-install "./pkg/postinst" \
--depends logrotate \
-p build \
build/moira-notifier-$(VERSION)-$(RELEASE).tar.gz
packages: clean build tar rpm deb