navidrome/Makefile

82 lines
2.8 KiB
Makefile
Raw Normal View History

GO_VERSION=1.13
2020-01-24 00:31:32 +01:00
NODE_VERSION=v13.7.0
2020-01-25 17:06:04 +01:00
GIT_HASH=$(shell git rev-parse --short HEAD)
GIT_BRANCH=$(shell git symbolic-ref --short -q HEAD)
GIT_TAG=$(shell git describe --tags --abbrev=0 2> /dev/null)
GIT_COUNT=$(shell git rev-list HEAD --count)
2020-01-20 04:48:36 +01:00
.PHONY: dev
dev: check_env data
@goreman -f Procfile.dev -b 4533 start
.PHONY: server
server: check_go_env data
@reflex -d none -c reflex.conf
.PHONY: watch
watch: check_go_env
ginkgo watch -notify ./...
.PHONY: test
test: check_go_env
go test ./... -v
2020-01-18 01:36:50 +01:00
# @(cd ./ui && npm test -- --watchAll=false)
2020-01-20 01:34:54 +01:00
.PHONY: testall
testall: check_go_env test
@(cd ./ui && npm test -- --watchAll=false)
2016-10-11 02:27:09 +02:00
.PHONY: setup
setup: Jamstash-master
2020-01-23 00:35:44 +01:00
@which reflex || (echo "Installing Reflex" && GO111MODULE=off go get -u github.com/cespare/reflex)
@which goconvey || (echo "Installing GoConvey" && GO111MODULE=off go get -u github.com/smartystreets/goconvey)
@which wire || (echo "Installing Wire" && GO111MODULE=off go get -u github.com/google/wire/cmd/wire)
2020-01-23 00:35:44 +01:00
@which goreman || (echo "Installing Goreman" && GO111MODULE=off go get -u github.com/mattn/goreman)
@which ginkgo || (echo "Installing Ginkgo" && GO111MODULE=off go get -u github.com/onsi/ginkgo/ginkgo)
@which go-bindata || (echo "Installing BinData" && GO111MODULE=off go get -u github.com/go-bindata/go-bindata/...)
go mod download
@(cd ./ui && npm ci)
2016-10-11 02:27:09 +02:00
.PHONY: static
static:
cd static && go-bindata -fs -prefix "static" -nocompress -ignore="\\\*.go" -pkg static .
Jamstash-master:
wget -N https://github.com/tsquillario/Jamstash/archive/master.zip
unzip -o master.zip
rm master.zip
2016-10-11 02:27:09 +02:00
.PHONE: check_env
check_env: check_go_env check_node_env
2016-10-11 02:27:09 +02:00
.PHONY: check_go_env
check_go_env:
2020-01-26 21:32:55 +01:00
@(hash go) || (echo "\nERROR: GO environment not setup properly!\n"; exit 1)
@go version | grep -q $(GO_VERSION) || (echo "\nERROR: Please upgrade your GO version\n"; exit 1)
2016-10-11 02:27:09 +02:00
.PHONY: check_node_env
check_node_env:
@(hash node) || (echo "\nERROR: Node environment not setup properly!\n"; exit 1)
@node --version | grep -q $(NODE_VERSION) || (echo "\nERROR: Please check your Node version. Should be $(NODE_VERSION)\n"; exit 1)
2020-01-08 17:13:05 +01:00
2020-01-15 00:55:12 +01:00
data:
mkdir data
2020-01-23 00:35:44 +01:00
2020-01-24 00:31:32 +01:00
UI_SRC = $(shell find ui/src ui/public -name "*.js")
ui/build: $(UI_SRC) $(UI_PUBLIC) ui/package-lock.json
2020-01-23 00:35:44 +01:00
@(cd ./ui && npm run build)
2020-01-24 00:31:32 +01:00
assets/embedded_gen.go: ui/build
go-bindata -fs -prefix "ui/build" -tags embed -nocompress -pkg assets -o assets/embedded_gen.go ui/build/...
2020-01-23 00:35:44 +01:00
2020-01-25 17:06:04 +01:00
.PHONY: build
build: check_go_env
go build -ldflags="-X main.gitCount=$(GIT_COUNT) -X main.gitHash=$(GIT_HASH) -X main.gitBranch=$(GIT_BRANCH) -X main.gitTag=$(GIT_TAG)"
2020-01-23 00:35:44 +01:00
.PHONY: buildall
2020-01-24 00:31:32 +01:00
buildall: check_go_env assets/embedded_gen.go
2020-01-25 17:06:04 +01:00
go build -ldflags="-X main.gitCount=$(GIT_COUNT) -X main.gitHash=$(GIT_HASH) -X main.gitBranch=$(GIT_BRANCH) -X main.gitTag=$(GIT_TAG)" \
-tags embed
2020-01-23 00:35:44 +01:00