generated from ras0q/go-backend-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
31 lines (24 loc) · 856 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
SHELL := /bin/bash
APP_NAME := $(shell basename $(PWD))
GO_FILES := $(shell find . -type f -name '*.go' -not -path "./vendor/*")
GO_TEST_FLAGS := -v -cover -race -shuffle=on
.PHONY: help
help: ## Display this help
@echo "Commands:"
@grep -E '^[a-z-]+:.*## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
.PHONY: mod
mod: ## Download the dependencies
go mod download
build: $(GO_FILES) ## Compile the binary
go build -o $(APP_NAME)
.PHONY: test
test: test-unit test-integration ## Run all the tests
.PHONY: test-unit
test-unit: ## Run the unit tests
go test $(GO_TEST_FLAGS) . ./internal/...
.PHONY: test-integration
test-integration: ## Run the integration tests
go test $(GO_TEST_FLAGS) ./integration/...
.PHONY: lint
lint: ## Run the linter
golangci-lint run --timeout=5m --fix ./...