.PHONY: test test-all test-unit test-local test-integration lint lint-fix build dev run clean css-dev css-prod css-watch css-clean sprites sprites-clean # Default: Run unit tests only (fast, no Chrome needed) test: test-unit # Run unit tests only (CI-safe, skips tests requiring project root) test-unit: @echo "๐Ÿงช Running unit tests..." go test -short -v -race -coverprofile=coverage.txt -covermode=atomic ./... # Run unit tests from project root (includes all tests) test-local: @echo "๐Ÿงช Running ALL unit tests from project root..." 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 ./... # Run integration tests only test-integration: @echo "๐Ÿงช Running integration tests only..." go test -v -race -tags=integration ./internal/handlers -run PDF # Run linter on entire codebase (same as CI) lint: @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 ./... # Build binary build: @echo "๐Ÿ”จ Building..." go build -v -o cv-server . # 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 clean: css-clean @echo "๐Ÿงน Cleaning build artifacts..." rm -f cv-server coverage.txt coverage-report.txt benchmark.txt # Run all checks (lint + unit tests) check: lint test-unit @echo "โœ… All checks passed!" # Run everything (lint + all tests + build) all: lint test-all css-prod build @echo "โœ… Everything passed!" # ============================================================================ # 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/" # ============================================================================ # 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"