From a99924ea200fe9ae2a527e6c6175f3556a2239ba Mon Sep 17 00:00:00 2001 From: Deluan Date: Thu, 24 Sep 2020 17:23:46 -0400 Subject: [PATCH] Converted pre-push hook into a make target, avoid calling tests twice when releasing --- Makefile | 11 +++++++++-- git/pre-push | 7 +------ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index afec28da..474d1653 100644 --- a/Makefile +++ b/Makefile @@ -86,13 +86,20 @@ buildall: check_env 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 +pre-push: + golangci-lint run -v + + @echo + make test +.PHONY: pre-push + 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 + make pre-push git tag v${V} - git push origin v${V} + git push origin v${V} --no-verify .PHONY: release snapshot: diff --git a/git/pre-push b/git/pre-push index 2d3acf25..da7eaba2 100755 --- a/git/pre-push +++ b/git/pre-push @@ -1,9 +1,4 @@ #!/bin/sh set -e -echo "#### Linting" -golangci-lint run -v - -echo -echo "#### Running tests" -make test \ No newline at end of file +make pre-push \ No newline at end of file