Files
dyn/Makefile

59 lines
1.6 KiB
Makefile

.PHONY: build test test-unit test-integration test-compose run clean docker-build docker-push help
# Variables
BINARY_NAME=dyn-server
DOCKER_IMAGE=git.dws.rip/DWS/dyn
VERSION=$(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
help: ## Show this help message
@echo "Available targets:"
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-20s\033[0m %s\n", $$1, $$2}'
build: ## Build the binary
go build -o $(BINARY_NAME) cmd/server/main.go
test: ## Run all tests
go test ./... -v
test-unit: ## Run unit tests only
go test ./internal/... -v
test-integration: ## Run integration tests (with mock server)
go test ./tests/integration -v -run 'TestIntegration_[^C]'
test-compose: ## Run containerized integration tests with podman/docker-compose
@echo "Running compose integration tests..."
bash tests/integration/compose_test.sh
test-compose-go: ## Run Go-based compose integration tests
RUN_COMPOSE_TESTS=true go test ./tests/integration -v -run TestComposeIntegration -timeout 120s
run: build ## Build and run the server
./$(BINARY_NAME)
dev: ## Run in development mode
go run cmd/server/main.go
docker-build: ## Build Docker image
docker build -t $(DOCKER_IMAGE):$(VERSION) -t $(DOCKER_IMAGE):latest .
docker-push: docker-build ## Push Docker image
docker push $(DOCKER_IMAGE):$(VERSION)
docker push $(DOCKER_IMAGE):latest
clean: ## Clean build artifacts
rm -f $(BINARY_NAME)
go clean
deps: ## Download dependencies
go mod download
go mod tidy
lint: ## Run linter (requires golangci-lint)
golangci-lint run ./...
fmt: ## Format Go code
go fmt ./...
.DEFAULT_GOAL := help