forked from reef-pi/reef-pi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
129 lines (104 loc) · 2.35 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
SOURCEDIR=.
SOURCES = $(shell find $(SOURCEDIR) -name '*.go')
VERSION:=$(shell git describe --always --tags)
BINARY=bin/reef-pi
DETECT_RACE='-race'
ifeq ($(OS), Windows_NT)
BINARY=./bin/reef-pi.exe
DETECT_RACE=
endif
.PHONY:bin
bin:
make go
make build-ui
.PHONY:build-ui
build-ui:
npm run build
.PHONY:go
go:
go build -o $(BINARY) -ldflags "-s -w -X main.Version=$(VERSION)" ./commands
.PHONY:pi
pi:
env GOOS=linux GOARCH=arm go build -o $(BINARY) -ldflags "-s -w -X main.Version=$(VERSION)" ./commands
.PHONY: pi-zero
pi-zero:
env GOARM=6 GOOS=linux GOARCH=arm go build -o $(BINARY) -ldflags "-s -w -X main.Version=$(VERSION)" ./commands
.PHONY: test
test:
go test -count=1 -cover $(DETECT_RACE) ./...
.PHONY: js-lint
js-lint:
npm run js-lint
.PHONY: sass-lint
sass-lint:
npm run sass-lint
.PHONY: install
install:
make go-get
npm install
.PHONY: go-get
go-get:
go get -u golang.org/x/tools/cmd/goimports
ifeq ($(OS), Windows_NT)
go get -u github.com/StackExchange/wmi
endif
.PHONY: vet
vet:
go vet ./...
.PHONY: imports
imports:
goimports -w -local github.com/reef-pi/reef-pi -d ./controller
.PHONY: build
build: clean go-get test bin
.PHONY: ui
ui:
npm run ui
.PHONY: ui-dev
ui-dev:
npm run ui-dev
.PHONY: deb
deb: ui api-doc
mkdir -p dist/var/lib/reef-pi/ui dist/usr/bin dist/etc/reef-pi
cp bin/reef-pi dist/usr/bin/reef-pi
cp -r ui/* dist/var/lib/reef-pi/ui
cp build/config.yaml dist/etc/reef-pi/config.yaml
mkdir dist/var/lib/reef-pi/images
bundle exec fpm -t deb -s dir -a armhf -n reef-pi -v $(VERSION) -m ranjib@linux.com --deb-systemd build/reef-pi.service -C dist -p reef-pi-$(VERSION).deb .
.PHONY: clean
clean:
-rm -rf *.deb
-rm -rf dist
-rm -rf ui
-rm -rf bin/*
-find jsx -iname __snapshots__ -print | xargs rm -rf
-find . -name '*.db' -exec rm {} \;
-find . -name '*.crt' -exec rm {} \;
-find . -name '*.key' -exec rm {} \;
.PHONY: standard
standard:
npm run standard
.PHONY: jest
jest:
npm run jest
.PHONY: start-dev
start-dev:
ifeq ($(OS), Windows_NT)
set DEV_MODE=1
$(BINARY)
else
DEV_MODE=1 $(BINARY)
endif
.PHONY: race
race:
./scripts/race.sh 12
.PHONY: spec
spec:
swagger generate spec /w ./commands/ -i swagger.yml -o swagger.json -m
.PHONY: serve-spec
serve-spec:
npx redoc-cli serve swagger.json -p 8888
api-doc:
npx redoc-cli bundle swagger.json -o ui/assets/api.html
.PHONY: smoke
smoke:
npm run ci-smoke