forked from brocaar/chirpstack-application-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
90 lines (71 loc) · 2.74 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
.PHONY: build clean test package package-deb ui api statics requirements ui-requirements serve update-vendor internal/statics internal/migrations static/swagger/api.swagger.json
PKGS := $(shell go list ./... | grep -v /vendor |grep -v lora-app-server/api | grep -v /migrations | grep -v /static | grep -v /ui)
VERSION := $(shell git describe --always |sed -e "s/^v//")
build: ui/build internal/statics internal/migrations
@echo "Compiling source for $(GOOS) $(GOARCH)"
@mkdir -p build
@go build $(GO_EXTRA_BUILD_ARGS) -ldflags "-s -w -X main.version=$(VERSION)" -o build/lora-app-server cmd/lora-app-server/main.go
clean:
@echo "Cleaning up workspace"
@rm -rf build dist internal/migrations internal/static ui/build static/static
@rm -f static/index.html
@rm -rf docs/public
@rm -rf dist
test: internal/statics internal/migrations
@echo "Running tests"
@for pkg in $(PKGS) ; do \
golint $$pkg ; \
done
@go vet $(PKGS)
@go test -p 1 -v $(PKGS)
documentation:
@echo "Building documentation"
@mkdir -p dist/docs
@cd docs && hugo
@cd docs/public/ && tar -pczf ../../dist/lora-app-server-documentation.tar.gz .
dist: ui/build internal/statics internal/migrations
@goreleaser
build-snapshot: ui/build internal/statics internal/migrations
@goreleaser --snapshot
package-deb: package
@echo "Building deb package"
@cd packaging && TARGET=deb ./package.sh
ui/build:
@echo "Building ui"
@cd ui && npm run build
@mv ui/build/* static
api:
@echo "Generating API code from .proto files"
@go generate api/api.go
internal/statics internal/migrations: static/swagger/api.swagger.json
@echo "Generating static files"
@go generate cmd/lora-app-server/main.go
static/swagger/api.swagger.json:
@echo "Generating combined Swagger JSON"
@GOOS="" GOARCH="" go run api/swagger/main.go api/swagger > static/swagger/api.swagger.json
# shortcuts for development
requirements:
@echo "Installing development tools"
@go get -u github.com/golang/lint/golint
@go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway
@go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger
@go get -u github.com/golang/protobuf/protoc-gen-go
@go get -u github.com/elazarl/go-bindata-assetfs/...
@go get -u github.com/jteeuwen/go-bindata/...
@go get -u github.com/kisielk/errcheck
@go get -u github.com/smartystreets/goconvey
@go get -u golang.org/x/tools/cmd/stringer
@go get -u github.com/golang/dep/cmd/dep
@go get -u github.com/goreleaser/goreleaser
@dep ensure -v
ui-requirements:
@echo "Installing UI requirements"
@cd ui && npm install
serve: build
@echo "Starting Lora App Server"
./build/lora-app-server
update-vendor:
@echo "Updating vendored packages"
@govendor update +external
run-compose-test:
docker-compose run --rm appserver make test