-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
112 lines (92 loc) · 3.27 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
THIS_FILE := $(lastword $(MAKEFILE_LIST))
APP_NAME := DMRHub
APP_PATH := github.com/USA-RedDragon/DMRHub
GOFMT_FILES?=$$(find . -name '*.go' | grep -v vendor)
fmt:
gofmt -w $(GOFMT_FILES)
install-deps:
@echo "--> Installing Golang dependencies"
go get
@echo "--> Done"
build-frontend:
@echo "--> Installing JavaScript assets"
@cd internal/http/frontend && npm ci
@echo "--> Building Vue application"
@cd internal/http/frontend && npm run build
@echo "--> Done"
build: install-deps build-frontend
@echo "--> Building"
@go generate ./...
@env CGO_ENABLED=0 go build -o bin/$(APP_NAME)
@echo "--> Done"
# CI handles the frontend on its own so that
# we don't have to rebuild the frontend on each
# architecture
build-ci: install-deps
@echo "--> Building"
@go generate ./...
@env CGO_ENABLED=0 go build -o bin/$(APP_NAME)
@echo "--> Done"
run:
@echo "--> Running"
@go run .
@echo "--> Done"
coverage:
@echo "--> Running tests"
@env CGO_ENABLED=0 go test -v -coverprofile=coverage.txt -coverpkg=./... -covermode=atomic ./...
@echo "--> Done"
view-coverage:
@echo "--> Viewing coverage"
@go tool cover -html=coverage.txt
@echo "--> Done"
lint:
@echo "--> Linting"
@golangci-lint run
@echo "--> Done"
test:
@echo "--> Running tests"
@env CGO_ENABLED=0 go test -p 2 -v ./...
@echo "--> Done"
benchmark:
@echo "--> Running benchmarks"
@env CGO_ENABLED=0 go test -run ^$ -benchmem -bench=. ./...
@echo "--> Done"
update-dbs: update-repeaterdb update-userdb
update-userdb:
@echo "--> Updating user database"
wget -O internal/userdb/users.json https://www.radioid.net/static/users.json
@rm -f internal/userdb/users.json.xz
@cd internal/userdb && xz -e users.json
@date --rfc-3339=seconds | sed 's/ /T/' > internal/userdb/userdb-date.txt.tmp
@tr -d '\n' < internal/userdb/userdb-date.txt.tmp > internal/userdb/userdb-date.txt
@rm -f internal/userdb/userdb-date.txt.tmp
@echo "--> Done"
update-repeaterdb:
@echo "--> Updating repeater database"
wget -O internal/repeaterdb/repeaters.json https://www.radioid.net/static/rptrs.json
@rm -f internal/repeaterdb/repeaters.json.xz
@cd internal/repeaterdb && xz -e repeaters.json
@date --rfc-3339=seconds | sed 's/ /T/' > internal/repeaterdb/repeaterdb-date.txt.tmp
@tr -d '\n' < internal/repeaterdb/repeaterdb-date.txt.tmp > internal/repeaterdb/repeaterdb-date.txt
@rm -f internal/repeaterdb/repeaterdb-date.txt.tmp
@echo "--> Done"
frontend-unit-test:
@cd internal/http/frontend && npm run test:unit
frontend-e2e-test-electron:
@cd internal/http/frontend && npm ci
@echo "--> Building Vue application"
@cd internal/http/frontend && env NODE_ENV=test npm run build
@echo "--> Running end-to-end tests"
@cd internal/http/frontend && env NODE_ENV=test npm run test:e2e
frontend-e2e-test-chrome:
@cd internal/http/frontend && npm ci
@echo "--> Building Vue application"
@cd internal/http/frontend && env NODE_ENV=test npm run build
@echo "--> Running end-to-end tests"
@cd internal/http/frontend && env NODE_ENV=test npm run test:e2e:chrome
frontend-e2e-test-firefox:
@cd internal/http/frontend && npm ci
@echo "--> Building Vue application"
@cd internal/http/frontend && env NODE_ENV=test npm run build
@echo "--> Running end-to-end tests"
@cd internal/http/frontend && env NODE_ENV=test BROWSER=firefox npm run test:e2e:firefox