-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
30 lines (22 loc) · 832 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
# Variables
GO_BIN := go
MAIN_PKG := ./cmd/cli/main.go
BINARY_NAME := ./bin/capital-gains
DOCKER_IMAGE := capital-gains:latest
build: ## Build the application
@$(GO_BIN) build -o $(BINARY_NAME) $(MAIN_PKG)
test: ## Run tests
@$(GO_BIN) test ./...
coverage: ## Run tests with coverage
@$(GO_BIN) test -cover ./...
clean: ## Clean up generate files, like binaries and cached tests
@$(GO_BIN) clean -testcache
@rm -f $(BINARY_NAME)
docker-build: ## Build Docker image
@docker build -t $(DOCKER_IMAGE) .
docker-run: ## Run the application inside a Docker container
@docker run --rm -i $(DOCKER_IMAGE)
## Default target
all: build
help: ## Shows available Makefile commands in a list
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'