# NOFX Makefile for testing and development .PHONY: help test test-backend test-frontend test-coverage clean # Default target help: @echo "NOFX Testing & Development Commands" @echo "" @echo "Testing:" @echo " make test - Run all tests (backend + frontend)" @echo " make test-backend - Run backend tests only" @echo " make test-frontend - Run frontend tests only" @echo " make test-coverage - Generate backend coverage report" @echo "" @echo "Build:" @echo " make build - Build backend binary" @echo " make build-frontend - Build frontend" @echo "" @echo "Clean:" @echo " make clean - Clean build artifacts and test cache" # ============================================================================= # Testing # ============================================================================= # Run all tests test: @echo "๐Ÿงช Running backend tests..." go test -v ./... @echo "" @echo "๐Ÿงช Running frontend tests..." cd web && npm run test @echo "โœ… All tests completed" # Backend tests only test-backend: @echo "๐Ÿงช Running backend tests..." go test -v ./... # Frontend tests only test-frontend: @echo "๐Ÿงช Running frontend tests..." cd web && npm run test # Coverage report test-coverage: @echo "๐Ÿ“Š Generating coverage..." go test -coverprofile=coverage.out ./... go tool cover -html=coverage.out -o coverage.html @echo "โœ… Backend coverage: coverage.html" # ============================================================================= # Build # ============================================================================= # Build backend binary build: @echo "๐Ÿ”จ Building backend..." go build -o nofx @echo "โœ… Backend built: ./nofx" # Build frontend build-frontend: @echo "๐Ÿ”จ Building frontend..." cd web && npm run build @echo "โœ… Frontend built: ./web/dist" # ============================================================================= # Development # ============================================================================= # Run backend in development mode run: @echo "๐Ÿš€ Starting backend..." go run main.go # Run frontend in development mode run-frontend: @echo "๐Ÿš€ Starting frontend dev server..." cd web && npm run dev # Format Go code fmt: @echo "๐ŸŽจ Formatting Go code..." go fmt ./... @echo "โœ… Code formatted" # Lint Go code (requires golangci-lint) lint: @echo "๐Ÿ” Linting Go code..." golangci-lint run @echo "โœ… Linting completed" # ============================================================================= # Clean # ============================================================================= clean: @echo "๐Ÿงน Cleaning..." rm -f nofx rm -f coverage.out coverage.html rm -rf web/dist go clean -testcache @echo "โœ… Cleaned" # ============================================================================= # Docker # ============================================================================= # Build Docker images docker-build: @echo "๐Ÿณ Building Docker images..." docker compose build @echo "โœ… Docker images built" # Run Docker containers docker-up: @echo "๐Ÿณ Starting Docker containers..." docker compose up -d @echo "โœ… Docker containers started" # Stop Docker containers docker-down: @echo "๐Ÿณ Stopping Docker containers..." docker compose down @echo "โœ… Docker containers stopped" # View Docker logs docker-logs: docker compose logs -f # ============================================================================= # Dependencies # ============================================================================= # Download Go dependencies deps: @echo "๐Ÿ“ฆ Downloading Go dependencies..." go mod download @echo "โœ… Dependencies downloaded" # Update Go dependencies deps-update: @echo "๐Ÿ“ฆ Updating Go dependencies..." go get -u ./... go mod tidy @echo "โœ… Dependencies updated" # Install frontend dependencies deps-frontend: @echo "๐Ÿ“ฆ Installing frontend dependencies..." cd web && npm install @echo "โœ… Frontend dependencies installed"