Files
Mazyar 4f05516fc2 Update Drone CI configuration and Makefile to remove legacy worker sources and add build target for worker
- Updated `.drone.yml` to remove lingering legacy worker source files after git deletion, ensuring a clean build environment.
- Modified `Makefile` to include a new `build-worker` target that removes deprecated scraper and queue source files, streamlining the worker build process.

This change enhances the build process by eliminating outdated components and ensuring that the worker is built without legacy dependencies.
2026-06-09 11:29:29 +03:30

136 lines
3.6 KiB
Makefile

# Tender Management Backend Makefile
.PHONY: help build build-worker run test clean docker-build docker-run docs run-docs
# Default target
help:
@echo "Available targets:"
@echo " build - Build the web server"
@echo " build-mac - Build for macOS (Intel)"
@echo " build-mac-arm64 - Build for macOS (Apple Silicon)"
@echo " build-windows - Build for Windows (64-bit)"
@echo " build-windows-32 - Build for Windows (32-bit)"
@echo " build-all - Build for all platforms"
@echo " run - Run the web server"
@echo " test - Run tests"
@echo " clean - Clean build artifacts"
@echo " docker-build - Build Docker image"
@echo " docker-run - Run Docker container"
# Build the web server
build:
@echo "Building web server..."
@mkdir -p bin
@go build -o bin/web ./cmd/web
@echo "Build completed successfully!"
# Build the worker (drops legacy scraper/queue sources removed from git)
build-worker:
@echo "Building worker..."
@rm -f cmd/worker/workers/scraper.go cmd/worker/workers/scraper_consumer.go cmd/worker/workers/queue_producer.go
@mkdir -p bin
@go build -o bin/worker ./cmd/worker
@echo "Worker build completed successfully!"
# Build for macOS (Intel)
build-mac:
@echo "Building web server for macOS (Intel)..."
@mkdir -p bin
@GOOS=darwin GOARCH=amd64 go build -o bin/web-mac ./cmd/web
@echo "macOS Intel build completed successfully!"
# Build for macOS (Apple Silicon)
build-mac-arm64:
@echo "Building web server for macOS (Apple Silicon)..."
@mkdir -p bin
@GOOS=darwin GOARCH=arm64 go build -o bin/web-mac-arm64 ./cmd/web
@echo "macOS ARM64 build completed successfully!"
# Build for Windows (64-bit)
build-windows:
@echo "Building web server for Windows (64-bit)..."
@mkdir -p bin
@GOOS=windows GOARCH=amd64 go build -o bin/web.exe ./cmd/web
@echo "Windows 64-bit build completed successfully!"
# Build for Windows (32-bit)
build-windows-32:
@echo "Building web server for Windows (32-bit)..."
@mkdir -p bin
@GOOS=windows GOARCH=386 go build -o bin/web-32.exe ./cmd/web
@echo "Windows 32-bit build completed successfully!"
# Build for all platforms
build-all: build build-mac build-mac-arm64 build-windows build-windows-32
@echo "All platform builds completed successfully!"
# Run the web server
run: build
@echo "Starting web server..."
@./bin/web
# Run tests
test:
@echo "Running tests..."
@go test ./...
# Clean build artifacts
clean:
@echo "Cleaning build artifacts..."
@rm -rf bin/
@go clean
# Build Docker image
docker-build:
@echo "Building Docker image..."
@docker build -t tender-management-api .
# Run Docker container
docker-run:
@echo "Running Docker container..."
@docker run -p 8081:8081 tender-management-api
# Development with hot reload (requires air)
dev:
@echo "Starting development server with hot reload..."
@air
# Install development dependencies
install-dev:
@echo "Installing development dependencies..."
@go install github.com/cosmtrek/air@latest
# Format code
fmt:
@echo "Formatting code..."
@go fmt ./...
# Vet code
vet:
@echo "Vetting code..."
@go vet ./...
# Lint code (requires golangci-lint)
lint:
@echo "Linting code..."
@golangci-lint run
# Generate API documentation
# Marked as .PHONY to avoid collision with the top-level docs directory
docs:
@echo "Generating API documentation..."
@swag init -g cmd/web/main.go -o cmd/web/docs
@echo "Swagger documentation generated successfully!"
# Run server with documentation
run-docs: docs run
# Database migrations (placeholder)
migrate:
@echo "Running database migrations..."
@echo "TODO: Implement database migrations"
# Seed database (placeholder)
seed:
@echo "Seeding database..."
@echo "TODO: Implement database seeding"