fuzzyworld

template / commit

Splitting out the dev setup from the build phase.

8eeb737d23bab399f172d35d84ba5af86e2d4c7a · Pavel Safronov · 2023-02-18 10:39:58 -0800 · parents f9aee9330ff5

Splitting out the dev setup from the build phase.
 .gitlab-ci.yml |  5 ++---
 Makefile       | 15 +++++++++++++--
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 1ae020b..d024539 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -22,13 +22,13 @@ before_script:
  - go version
  - choco install make
  - make --version
+ - make dev-setup
 
 build-job:
   extends:
   - .shared_windows_runners
   stage: build-and-test
   script:
-    - make dev-prep
     - make all
 
 release:
@@ -52,6 +52,5 @@ release:
   #   refs:
   #     - tags
 
-  script: 
-    - make dev-prep
+  script:
     - make release
\ No newline at end of file
diff --git a/Makefile b/Makefile
index ae03bb7..bc38858 100644
--- a/Makefile
+++ b/Makefile
@@ -6,17 +6,20 @@ LDFLAGS=-ldflags "-w -s -X main.Version=${VERSION}"
 
 all: build test lint
 
-dev-prep:

+dev-setup:

 	go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
 	golangci-lint --version
 	go install github.com/goreleaser/goreleaser@latest
 	goreleaser --version
 
+prep:

+	go mod tidy

+

 clean:
 	go clean
 	go mod tidy
 
-build:

+build: prep

 	go build ${LDFLAGS} -o ${BINARY} .
 
 lint: build
@@ -31,6 +34,14 @@ test_coverage: test
 test_coverage_html: test_coverage
 	open "./test-coverage.html"
 
+install: build test lint

+	go install ${LDFLAGS}

+	template reset

+

+uninstall:

+	go clean -i gitlab.com/PavelSafronov/template...

+	if [ -f ${BINARY} ] ; then rm ${BINARY} ; fi

+

 release-dry-run: build
 	goreleaser release --snapshot --rm-dist