navidrome/Makefile

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

101 lines
3.7 KiB
Makefile
Raw Normal View History

GO_VERSION=$(shell grep -e "^go " go.mod | cut -f 2 -d ' ')
NODE_VERSION=$(shell cat .nvmrc)
2020-01-26 18:36:24 +01:00
GIT_SHA=$(shell git rev-parse --short HEAD)
GIT_TAG=$(shell git describe --tags `git rev-list --tags --max-count=1`)
2020-01-25 17:06:04 +01:00
## Default target just build the Go project.
default:
go build -ldflags="-X github.com/deluan/navidrome/consts.gitSha=$(GIT_SHA) -X github.com/deluan/navidrome/consts.gitTag=master"
.PHONY: default
dev: check_env
2020-04-29 05:24:57 +02:00
npx foreman -j Procfile.dev -p 4533 start
.PHONY: dev
2020-01-20 04:48:36 +01:00
server: check_go_env
@reflex -d none -c reflex.conf
.PHONY: server
2020-04-05 04:23:20 +02:00
wire: check_go_env
wire ./...
.PHONY: wire
watch: check_go_env
ginkgo watch -notify ./...
.PHONY: watch
test: check_go_env
go test ./... -v
2020-01-18 01:36:50 +01:00
# @(cd ./ui && npm test -- --watchAll=false)
.PHONY: test
2020-01-20 01:34:54 +01:00
testall: check_go_env test
@(cd ./ui && npm test -- --watchAll=false)
.PHONY: testall
2020-01-20 01:34:54 +01:00
setup:
@which go-bindata || (echo "Installing BinData" && GO111MODULE=off go get -u github.com/go-bindata/go-bindata/...)
go mod download
@(cd ./ui && npm ci)
.PHONY: setup
setup-dev: setup
2020-05-07 17:57:07 +02:00
@which wire || (echo "Installing Wire" && GO111MODULE=off go get -u github.com/google/wire/cmd/wire)
@which ginkgo || (echo "Installing Ginkgo" && GO111MODULE=off go get -u github.com/onsi/ginkgo/ginkgo)
@which goose || (echo "Installing Goose" && GO111MODULE=off go get -u github.com/pressly/goose/cmd/goose)
@which reflex || (echo "Installing Reflex" && GO111MODULE=off go get -u github.com/cespare/reflex)
2020-05-09 21:02:23 +02:00
@which golangci-lint || (echo "Installing GolangCI-Lint" && cd .. && GO111MODULE=on go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.26.0)
2020-05-07 17:57:07 +02:00
@which lefthook || (echo "Installing Lefthook" && GO111MODULE=off go get -u github.com/Arkweid/lefthook)
2020-04-03 20:48:14 +02:00
@lefthook install
.PHONY: setup
2016-10-11 02:27:09 +02:00
Jamstash-master:
wget -N https://github.com/tsquillario/Jamstash/archive/master.zip
unzip -o master.zip
rm master.zip
(cd Jamstash-master && npm ci && npx bower install && npx grunt build)
rm -rf Jamstash-master/node_modules Jamstash-master/bower_components
2016-10-11 02:27:09 +02:00
check_env: check_go_env check_node_env
.PHONE: check_env
2016-10-11 02:27:09 +02:00
2020-04-03 22:00:17 +02:00
check_hooks:
@lefthook add pre-commit
@lefthook add pre-push
.PHONE: check_hooks
check_go_env:
2020-01-26 21:32:55 +01:00
@(hash go) || (echo "\nERROR: GO environment not setup properly!\n"; exit 1)
2020-02-26 15:37:48 +01:00
@go version | grep -q $(GO_VERSION) || (echo "\nERROR: Please upgrade your GO version\nThis project requires version $(GO_VERSION)"; exit 1)
.PHONY: check_go_env
2016-10-11 02:27:09 +02:00
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)
.PHONY: check_node_env
2020-01-08 17:13:05 +01:00
2020-01-25 17:06:04 +01:00
build: check_go_env
go build -ldflags="-X github.com/deluan/navidrome/consts.gitSha=$(GIT_SHA) -X github.com/deluan/navidrome/consts.gitTag=$(GIT_TAG)-SNAPSHOT"
.PHONY: build
2020-01-25 17:06:04 +01:00
2020-02-04 21:02:43 +01:00
buildall: check_env
@(cd ./ui && npm run build)
go-bindata -fs -prefix "resources" -tags embed -ignore="\\\*.go" -pkg resources -o resources/embedded_gen.go resources/...
go-bindata -fs -prefix "ui/build" -tags embed -nocompress -pkg assets -o assets/embedded_gen.go ui/build/...
go build -ldflags="-X github.com/deluan/navidrome/consts.gitSha=$(GIT_SHA) -X github.com/deluan/navidrome/consts.gitTag=$(GIT_TAG)-SNAPSHOT" -tags=embed
.PHONY: buildall
release:
@if [[ ! "${V}" =~ ^[0-9]+\.[0-9]+\.[0-9]+.*$$ ]]; then echo "Usage: make release V=X.X.X"; exit 1; fi
go mod tidy
@if [ -n "`git status -s`" ]; then echo "\n\nThere are pending changes. Please commit or stash first"; exit 1; fi
make test
git tag v${V}
git push origin v${V}
.PHONY: release
2020-04-04 20:36:23 +02:00
snapshot:
2020-04-16 22:26:14 +02:00
docker run -it -v $(PWD):/workspace -w /workspace deluan/ci-goreleaser:1.14.1-1 goreleaser release --rm-dist --skip-publish --snapshot
2020-04-04 20:36:23 +02:00
.PHONY: snapshot