first commit
This commit is contained in:
commit
57bb8aafbe
27 changed files with 8538 additions and 0 deletions
119
Makefile
Normal file
119
Makefile
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
# Makefile for deb-bootc-compose
|
||||
# Debian's equivalent to Fedora's Pungi compose system
|
||||
|
||||
.PHONY: all build clean test install help
|
||||
|
||||
# Variables
|
||||
BINARY_NAME=deb-bootc-compose
|
||||
BUILD_DIR=build
|
||||
VERSION=$(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
|
||||
LDFLAGS=-ldflags "-X main.Version=$(VERSION)"
|
||||
|
||||
# Default target
|
||||
all: build
|
||||
|
||||
# Build the binary
|
||||
build: $(BUILD_DIR)
|
||||
@echo "Building $(BINARY_NAME)..."
|
||||
@cd cmd/compose && go build $(LDFLAGS) -o ../../$(BUILD_DIR)/$(BINARY_NAME)
|
||||
@echo "Build complete: $(BUILD_DIR)/$(BINARY_NAME)"
|
||||
|
||||
# Build CLI tool
|
||||
cli: $(BUILD_DIR)
|
||||
@echo "Building CLI tool..."
|
||||
@cd cmd/cli && go build $(LDFLAGS) -o ../../$(BUILD_DIR)/$(BINARY_NAME)-cli
|
||||
@echo "CLI build complete: $(BUILD_DIR)/$(BINARY_NAME)-cli"
|
||||
|
||||
# Create build directory
|
||||
$(BUILD_DIR):
|
||||
@mkdir -p $(BUILD_DIR)
|
||||
|
||||
# Install dependencies
|
||||
deps:
|
||||
@echo "Installing dependencies..."
|
||||
@go mod download
|
||||
@go mod tidy
|
||||
|
||||
# Run tests
|
||||
test:
|
||||
@echo "Running tests..."
|
||||
@go test ./...
|
||||
|
||||
# Run tests with coverage
|
||||
test-coverage:
|
||||
@echo "Running tests with coverage..."
|
||||
@go test -coverprofile=coverage.out ./...
|
||||
@go tool cover -html=coverage.out
|
||||
|
||||
# Clean build artifacts
|
||||
clean:
|
||||
@echo "Cleaning build artifacts..."
|
||||
@rm -rf $(BUILD_DIR)
|
||||
@rm -f coverage.out
|
||||
@go clean -cache
|
||||
|
||||
# Install binary to system
|
||||
install: build
|
||||
@echo "Installing $(BINARY_NAME)..."
|
||||
@sudo cp $(BUILD_DIR)/$(BINARY_NAME) /usr/local/bin/
|
||||
@echo "Installation complete"
|
||||
|
||||
# Uninstall binary from system
|
||||
uninstall:
|
||||
@echo "Uninstalling $(BINARY_NAME)..."
|
||||
@sudo rm -f /usr/local/bin/$(BINARY_NAME)
|
||||
@echo "Uninstallation complete"
|
||||
|
||||
# Run the binary
|
||||
run: build
|
||||
@echo "Running $(BINARY_NAME)..."
|
||||
@./$(BUILD_DIR)/$(BINARY_NAME) --help
|
||||
|
||||
# Run with sample treefile
|
||||
run-sample: build
|
||||
@echo "Running $(BINARY_NAME) with sample treefile..."
|
||||
@./$(BUILD_DIR)/$(BINARY_NAME) --treefile examples/debian-bootc-minimal.json --output ./sample-output
|
||||
|
||||
# Format code
|
||||
fmt:
|
||||
@echo "Formatting code..."
|
||||
@go fmt ./...
|
||||
|
||||
# Lint code
|
||||
lint:
|
||||
@echo "Linting code..."
|
||||
@golangci-lint run
|
||||
|
||||
# Generate documentation
|
||||
docs:
|
||||
@echo "Generating documentation..."
|
||||
@mkdir -p docs
|
||||
@echo "# $(BINARY_NAME) Documentation" > docs/README.md
|
||||
@echo "" >> docs/README.md
|
||||
@echo "Generated on: $(shell date)" >> docs/README.md
|
||||
@echo "Version: $(VERSION)" >> docs/README.md
|
||||
|
||||
# Development helpers
|
||||
dev-setup: deps
|
||||
@echo "Setting up development environment..."
|
||||
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
|
||||
@echo "Development environment ready"
|
||||
|
||||
# Show help
|
||||
help:
|
||||
@echo "Available targets:"
|
||||
@echo " build - Build the binary"
|
||||
@echo " cli - Build CLI tool"
|
||||
@echo " deps - Install dependencies"
|
||||
@echo " test - Run tests"
|
||||
@echo " test-coverage- Run tests with coverage"
|
||||
@echo " clean - Clean build artifacts"
|
||||
@echo " install - Install binary to system"
|
||||
@echo " uninstall - Uninstall binary from system"
|
||||
@echo " run - Run the binary"
|
||||
@echo " run-sample - Run with sample treefile"
|
||||
@echo " fmt - Format code"
|
||||
@echo " lint - Lint code"
|
||||
@echo " docs - Generate documentation"
|
||||
@echo " dev-setup - Set up development environment"
|
||||
@echo " help - Show this help"
|
||||
Loading…
Add table
Add a link
Reference in a new issue