52 lines
1.3 KiB
Makefile
52 lines
1.3 KiB
Makefile
# File: Makefile
|
|
.PHONY: all generate clean test test-unit test-integration build lint
|
|
|
|
# Variables
|
|
GOLANGCI_LINT_VERSION := v1.55.2
|
|
|
|
all: generate test build
|
|
|
|
generate:
|
|
@echo "Generating Go code from Protobuf definitions..."
|
|
@./scripts/gen-proto.sh
|
|
|
|
clean:
|
|
@echo "Cleaning up generated files and build artifacts..."
|
|
@rm -f ./api/v1alpha1/*.pb.go
|
|
@rm -f kat-agent katcall
|
|
|
|
# Run all tests
|
|
test: generate
|
|
@echo "Running all tests..."
|
|
@go test -v -count=1 ./... --coverprofile=coverage.out
|
|
|
|
# Run unit tests only (faster, no integration tests)
|
|
test-unit:
|
|
@echo "Running unit tests..."
|
|
@go test -v -count=1 ./...
|
|
|
|
# Run integration tests only
|
|
test-integration:
|
|
@echo "Running integration tests..."
|
|
@go test -v -count=1 -run Integration ./...
|
|
|
|
# Run tests for a specific package
|
|
test-package:
|
|
@echo "Running tests for package $(PACKAGE)..."
|
|
@go test -v ./$(PACKAGE)
|
|
|
|
kat-agent: $(shell find ./cmd/kat-agent -name '*.go') $(shell find . -name 'go.mod' -o -name 'go.sum')
|
|
@echo "Building kat-agent..."
|
|
@go build -o kat-agent ./cmd/kat-agent/main.go
|
|
|
|
build: generate kat-agent
|
|
@echo "Building all binaries..."
|
|
|
|
lint:
|
|
@echo "Running linter..."
|
|
@if ! command -v golangci-lint &> /dev/null; then \
|
|
echo "golangci-lint not found. Installing..."; \
|
|
go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION); \
|
|
fi
|
|
@golangci-lint run
|