-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
50 lines (37 loc) · 2.04 KB
/
Copy pathMakefile
File metadata and controls
50 lines (37 loc) · 2.04 KB
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
44
45
46
47
48
49
50
.PHONY: local build analyze tests-db tests-db-pattern tests-db-graph tests-unit tests-bench docs-swagger start stop help
GIT_COMMIT := $(shell git rev-parse --short=8 HEAD 2>/dev/null || echo "unknown")
GIT_TAG := $(shell git describe --tags --abbrev=0 2>/dev/null || echo "dev")
BUILD_DATE := $(shell date -u +%Y-%m-%d)
default: help
build: ## Build Docker image locally using the full CI build script
cd src && LOCAL=1 ./build/build.sh
analyze: ## Run linters, formatters, security scanners, etc
cd src && goimports -w .
cd src && golangci-lint run
cd src && govulncheck ./cmd/... ./internal/...
cd src && gosec -quiet -exclude-dir=tests ./...
tests-db: tests-db-pattern tests-db-graph ## Run all database integration tests
tests-db-pattern: ## Run pattern repository integration tests
cd src && ./internal/repository/tests/run-pattern-integration-tests.sh
tests-db-graph: ## Run graph repository integration tests
cd src && ./internal/repository/tests/run-graph-integration-tests.sh
tests-unit: ## Run unit tests with coverage
cd src && go test ./internal/... -coverprofile=coverage.out
cd src && go tool cover -html=coverage.out
tests-bench: ## Run benchmark tests
cd src && go test ./internal/... -bench=. -benchmem -run=^$$
docs-swagger: ## Generate Swagger 2.0 docs
cd src && go install github.com/swaggo/swag/cmd/swag@latest
cd src && swag init -g cmd/main/main.go -o docs/swagger --parseInternal
start: ## Start mnemonic using the latest image via Docker Compose
@printf "Starting mnemonic..."
@docker compose -f ./docker-compose.yaml up -d > /dev/null 2>&1 || true
@printf "done\n"
stop: ## Tear down mnemonic infrastructure started with 'make start'
@printf "Stopping mnemonic.."
@docker compose down -v --remove-orphans > /dev/null 2>&1 || true
@docker rmi migrate/migrate:latest -f > /dev/null 2>&1 || true
@docker system prune -v > /dev/null 2>&1 || true
@printf "done\n"
help: ## Show this help
@awk 'BEGIN {FS = ":.*##"; printf "\nAvailable targets:\n"} /^[a-zA-Z0-9_-]+:.*##/ { printf " %-20s %s\n", $$1, $$2 }' $(MAKEFILE_LIST)