From 6fe56f88782f9f5af87890ad06a7baec0bc66dec Mon Sep 17 00:00:00 2001 From: iratusmachina Date: Mon, 6 May 2024 03:27:16 -0400 Subject: [PATCH] Adding Makefile --- Makefile | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..98771f9 --- /dev/null +++ b/Makefile @@ -0,0 +1,32 @@ +# Inspired from https://dustinspecker.com/posts/go-combined-unit-integration-code-coverage/ and https://netdevops.me/2023/test-coverage-for-go-integration-tests/ +BIN_DIR = $(CURDIR)/artifacts +BINARY = $(BIN_DIR)/gocustomurls +CURRENT_DIR = $(shell pwd) +CUR_TAG = $(shell git tag | sort -g | tail -1 | cut -c 2-) +VERSION_NUMBER ?= 0.0.0 + +ifneq ($(CI_COMMIT_TAG),) + VERSION_NUMBER := $(CI_COMMIT_TAG:v%=%) +else + VERSION_NUMBER := ${CUR_TAG} +endif + +.PHONY: clean +clean: + go clean + +.PHONY: dep +dep: + go mod tidy + +.PHONY: fmt +fmt: + go fmt ./... + +.PHONY: lint +lint: + golangci-lint run --timeout 3m --verbose + +.PHONY: build +build: + go build -o $(BINARY) \ No newline at end of file