-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
43 lines (33 loc) · 1.13 KB
/
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
32
33
34
35
36
37
38
39
40
41
42
43
BINARY := molen
PKG := $(shell go list -m)
LOCAL_BIN_DIR := $(PWD)/bin
.DEFAULT_GOAL := help
.PHONY: run
run: ## Run the binary file
go run cmd/molen/main.go
.PHONY: env
env: ## Create environment in foreground
docker compose -p molen -f env/docker-compose.yml up -d
.PHONY: env-down
env-down: ## Destroy environment
docker compose -p molen down
.PHONY: build
build: docs ## Build the binary file
goreleaser build --snapshot --rm-dist --single-target
.PHONY: docs
docs: ## Generate swagger documentation
swag init --pd -g internal/server/server.go
.PHONY: lint
lint: ## Lint Go files
@golangci-lint --version
@GOPATH="$(shell dirname $(PWD))" $(LOCAL_BIN_DIR)/golangci-lint-$(GOLANGCI_LINT_VERSION) run ./...
.PHONY: test
test: ## Run unit tests
@go test -v -race ./...
.PHONY: coverage
coverage: ## Run unit tests with coverage
@go test -v -race -cover -coverpkg=./... -coverprofile=coverage.out -covermode=atomic ./...
@go tool cover -func=coverage.out
.PHONY: help
help: ## Display this help screen
@grep -h -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'