2025-12-06 11:32:13 +00:00
|
|
|
.PHONY: test test-all test-unit test-integration lint lint-fix build dev run clean css-dev css-prod css-watch css-clean sprites sprites-clean
|
2025-10-20 08:54:21 +01:00
|
|
|
|
2025-11-20 14:01:03 +00:00
|
|
|
# Default: Run unit tests only (fast, no Chrome needed)
|
|
|
|
|
test: test-unit
|
2025-10-20 08:54:21 +01:00
|
|
|
|
2025-11-20 14:01:03 +00:00
|
|
|
# Run unit tests only (CI-safe, no Chrome)
|
2025-11-11 21:43:12 +00:00
|
|
|
test-unit:
|
|
|
|
|
@echo "🧪 Running unit tests..."
|
2025-11-20 14:01:03 +00:00
|
|
|
go test -v -race -coverprofile=coverage.txt -covermode=atomic ./...
|
|
|
|
|
|
|
|
|
|
# Run ALL tests including PDF/Chrome integration tests
|
|
|
|
|
test-all:
|
|
|
|
|
@echo "🧪 Running ALL tests (including integration tests)..."
|
|
|
|
|
go test -v -race -tags=integration -coverprofile=coverage.txt -covermode=atomic ./...
|
2025-11-11 21:43:12 +00:00
|
|
|
|
|
|
|
|
# Run integration tests only
|
|
|
|
|
test-integration:
|
2025-11-20 14:01:03 +00:00
|
|
|
@echo "🧪 Running integration tests only..."
|
|
|
|
|
go test -v -race -tags=integration ./internal/handlers -run PDF
|
2025-11-11 21:43:12 +00:00
|
|
|
|
2025-12-06 11:32:13 +00:00
|
|
|
# Run linter on entire codebase (same as CI)
|
2025-11-20 14:01:03 +00:00
|
|
|
lint:
|
2025-12-06 11:32:13 +00:00
|
|
|
@echo "🔍 Running golangci-lint on entire codebase..."
|
|
|
|
|
golangci-lint run ./...
|
|
|
|
|
|
|
|
|
|
# Run linter and auto-fix issues where possible
|
|
|
|
|
lint-fix:
|
|
|
|
|
@echo "🔧 Running golangci-lint with auto-fix..."
|
|
|
|
|
golangci-lint run --fix ./...
|
2025-11-11 21:43:12 +00:00
|
|
|
|
2025-11-20 14:01:03 +00:00
|
|
|
# Build binary
|
|
|
|
|
build:
|
|
|
|
|
@echo "🔨 Building..."
|
|
|
|
|
go build -v -o cv-server .
|
2025-10-30 12:19:57 +00:00
|
|
|
|
2025-11-30 09:29:35 +00:00
|
|
|
# Run in development mode with hot reload
|
|
|
|
|
dev:
|
|
|
|
|
@echo "🚀 Starting development server with hot reload..."
|
|
|
|
|
GO_ENV=development TEMPLATE_HOT_RELOAD=true go run main.go
|
|
|
|
|
|
|
|
|
|
# Run in production mode
|
|
|
|
|
run:
|
|
|
|
|
@echo "🚀 Starting server..."
|
|
|
|
|
go run main.go
|
|
|
|
|
|
|
|
|
|
# Clean build artifacts
|
2025-11-30 12:32:46 +00:00
|
|
|
clean: css-clean
|
2025-11-30 09:29:35 +00:00
|
|
|
@echo "🧹 Cleaning build artifacts..."
|
|
|
|
|
rm -f cv-server coverage.txt coverage-report.txt benchmark.txt
|
|
|
|
|
|
2025-11-20 14:01:03 +00:00
|
|
|
# Run all checks (lint + unit tests)
|
|
|
|
|
check: lint test-unit
|
|
|
|
|
@echo "✅ All checks passed!"
|
2025-10-30 12:19:57 +00:00
|
|
|
|
2025-11-20 14:01:03 +00:00
|
|
|
# Run everything (lint + all tests + build)
|
2025-11-30 12:32:46 +00:00
|
|
|
all: lint test-all css-prod build
|
2025-11-20 14:01:03 +00:00
|
|
|
@echo "✅ Everything passed!"
|
2025-11-30 12:32:46 +00:00
|
|
|
|
|
|
|
|
# ============================================================================
|
|
|
|
|
# CSS Build Targets (Lightning CSS)
|
|
|
|
|
# ============================================================================
|
|
|
|
|
|
|
|
|
|
# Bundle CSS for development (readable, with source maps)
|
|
|
|
|
css-dev:
|
|
|
|
|
@echo "🎨 Bundling CSS for development..."
|
|
|
|
|
@mkdir -p static/dist
|
|
|
|
|
lightningcss --bundle static/css/main.css -o static/dist/bundle.css
|
|
|
|
|
@echo "✅ Created static/dist/bundle.css"
|
|
|
|
|
|
|
|
|
|
# Bundle and minify CSS for production
|
|
|
|
|
css-prod:
|
|
|
|
|
@echo "🎨 Bundling and minifying CSS for production..."
|
|
|
|
|
@mkdir -p static/dist
|
|
|
|
|
lightningcss --bundle --minify static/css/main.css -o static/dist/bundle.min.css
|
|
|
|
|
@echo "✅ Created static/dist/bundle.min.css ($$(wc -c < static/dist/bundle.min.css | tr -d ' ') bytes)"
|
|
|
|
|
|
|
|
|
|
# Watch CSS files for changes (development)
|
|
|
|
|
css-watch:
|
|
|
|
|
@echo "👀 Watching CSS files for changes..."
|
|
|
|
|
@while true; do \
|
|
|
|
|
$(MAKE) css-dev; \
|
|
|
|
|
fswatch -1 -r static/css; \
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
# Clean generated CSS files
|
|
|
|
|
css-clean:
|
|
|
|
|
@echo "🧹 Cleaning generated CSS..."
|
|
|
|
|
rm -rf static/dist
|
|
|
|
|
@echo "✅ Cleaned static/dist/"
|
2025-12-04 11:38:36 +00:00
|
|
|
|
|
|
|
|
# ============================================================================
|
|
|
|
|
# Sprite Generation Targets
|
|
|
|
|
# ============================================================================
|
|
|
|
|
|
|
|
|
|
# Generate CSS sprites from source images
|
|
|
|
|
sprites:
|
|
|
|
|
@echo "🖼️ Generating CSS sprites..."
|
|
|
|
|
@go build -o sprites ./cmd/sprites && ./sprites && rm -f sprites
|
|
|
|
|
@echo "✅ Sprites generated successfully!"
|
|
|
|
|
|
|
|
|
|
# Clean generated sprite files
|
|
|
|
|
sprites-clean:
|
|
|
|
|
@echo "🧹 Cleaning generated sprites..."
|
|
|
|
|
rm -rf static/images/sprites/*.png static/images/sprites/sprite-map.json static/sprite-showcase.html
|
|
|
|
|
@echo "✅ Cleaned sprite files"
|