orion/Makefile

54 lines
1.4 KiB
Makefile

LINT_ARGS ?= ./...
DEPLOY_HOST ?= 192.168.100.1
export GO111MODULE := on
build: bin/server
bin/server:
CGO_ENABLED=0 go build -mod=vendor -v -o ./bin/server ./cmd/server
cmd/server/static/dist:
cd cmd/server && npm install
cd cmd/server && npm run build
watch:
modd
test: tidy
GO111MODULE=off go clean -testcache
go test -mod=vendor -v ./...
lint:
@GO111MODULE=off golangci-lint run --tests=false --skip-dirs 'example' -e '.*/pkg/mod' -e ".*/go/src" --enable-all --disable lll $(LINT_ARGS)
tidy:
go mod tidy
vendor: tidy
go mod vendor
deps:
# Install modd
GO111MODULE=off go get -u github.com/cortesi/modd/cmd/modd
# Install golangci-lint
GO111MODULE=off go get -u github.com/golangci/golangci-lint/cmd/golangci-lint
release: cmd/server/static/dist
rm -rf release
NODE_ENV=production ./script/release
clean:
rm -rf ./bin
go clean -i -x -r -modcache
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
doc:
@echo "Open your browser to http://localhost:6060/pkg/forge.cadoles.com/Pyxis/orion/ to see the documentation"
@godoc -http=:6060
.PHONY: test clean generate vendor deps lint watch tidy doc bin/server cmd/server/static/dist release