2018-09-20 17:52:50 +02:00
|
|
|
LINT_ARGS ?= ./...
|
2019-02-12 10:17:06 +01:00
|
|
|
DEPLOY_HOST ?= 192.168.100.1
|
2018-09-17 14:17:54 +02:00
|
|
|
export GO111MODULE := on
|
|
|
|
|
|
|
|
build: bin/server
|
|
|
|
|
2018-09-18 18:07:40 +02:00
|
|
|
bin/server:
|
|
|
|
CGO_ENABLED=0 go build -mod=vendor -v -o ./bin/server ./cmd/server
|
2018-09-17 14:17:54 +02:00
|
|
|
|
2019-02-12 10:17:06 +01:00
|
|
|
cmd/server/static/dist:
|
|
|
|
cd cmd/server && npm install
|
|
|
|
cd cmd/server && npm run build
|
|
|
|
|
2018-09-17 14:17:54 +02:00
|
|
|
watch:
|
|
|
|
modd
|
|
|
|
|
2018-09-18 18:07:40 +02:00
|
|
|
test: tidy
|
|
|
|
GO111MODULE=off go clean -testcache
|
|
|
|
go test -mod=vendor -v ./...
|
2018-09-17 14:17:54 +02:00
|
|
|
|
|
|
|
lint:
|
2018-12-06 22:12:32 +01:00
|
|
|
@GO111MODULE=off golangci-lint run --tests=false --skip-dirs 'example' -e '.*/pkg/mod' -e ".*/go/src" --enable-all --disable lll $(LINT_ARGS)
|
2018-09-17 14:17:54 +02:00
|
|
|
|
2018-09-18 18:07:40 +02:00
|
|
|
tidy:
|
2018-09-17 14:17:54 +02:00
|
|
|
go mod tidy
|
|
|
|
|
2018-09-18 18:07:40 +02:00
|
|
|
vendor: tidy
|
|
|
|
go mod vendor
|
|
|
|
|
2019-02-12 10:17:06 +01:00
|
|
|
deps:
|
2018-09-17 14:17:54 +02:00
|
|
|
# Install modd
|
|
|
|
GO111MODULE=off go get -u github.com/cortesi/modd/cmd/modd
|
2018-09-20 17:52:50 +02:00
|
|
|
# Install golangci-lint
|
|
|
|
GO111MODULE=off go get -u github.com/golangci/golangci-lint/cmd/golangci-lint
|
2018-09-17 14:17:54 +02:00
|
|
|
|
2019-02-12 10:17:06 +01:00
|
|
|
release: cmd/server/static/dist
|
|
|
|
rm -rf release
|
|
|
|
NODE_ENV=production ./script/release
|
|
|
|
|
2018-09-17 14:17:54 +02:00
|
|
|
clean:
|
|
|
|
rm -rf ./bin
|
|
|
|
go clean -i -x -r -modcache
|
|
|
|
|
2019-02-12 10:17:06 +01:00
|
|
|
deploy: release
|
|
|
|
rsync -avzz --delete release/server-linux-arm/. root@$(DEPLOY_HOST):/opt/orion/
|
|
|
|
scp misc/openwrt/orion.init root@$(DEPLOY_HOST):/etc/init.d/orion
|
|
|
|
ssh root@$(DEPLOY_HOST) chmod +x /etc/init.d/orion
|
|
|
|
ssh root@$(DEPLOY_HOST) /etc/init.d/orion restart
|
|
|
|
|
2018-09-19 17:23:28 +02:00
|
|
|
doc:
|
|
|
|
@echo "Open your browser to http://localhost:6060/pkg/forge.cadoles.com/Pyxis/orion/ to see the documentation"
|
|
|
|
@godoc -http=:6060
|
|
|
|
|
2019-02-12 10:17:06 +01:00
|
|
|
.PHONY: test clean generate vendor deps lint watch tidy doc bin/server cmd/server/static/dist release
|