latest
This commit is contained in:
		
							parent
							
								
									1b8ea9695b
								
							
						
					
					
						commit
						9ac6fcee0c
					
				
							
								
								
									
										89
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										89
									
								
								Makefile
									
									
									
									
									
								
							@ -1,93 +1,26 @@
 | 
			
		||||
# Makefile for Secret Manager - Simple Go CLI Tool
 | 
			
		||||
.PHONY: default build-verbose check vet test lint clean
 | 
			
		||||
 | 
			
		||||
# Configuration
 | 
			
		||||
BINARY_NAME = secret
 | 
			
		||||
default: check
 | 
			
		||||
 | 
			
		||||
default: build
 | 
			
		||||
# Check all code quality (build + vet + lint + unit tests)
 | 
			
		||||
check: ./secret vet lint test
 | 
			
		||||
 | 
			
		||||
# Simple build (no code signing needed)
 | 
			
		||||
build: clean
 | 
			
		||||
	@echo "Building secret manager..."
 | 
			
		||||
	go build -o $(BINARY_NAME) cmd/secret/main.go
 | 
			
		||||
	@echo "Build complete: ./$(BINARY_NAME)"
 | 
			
		||||
./secret: cmd/secret/*.go internal/secret/*.go
 | 
			
		||||
	go build -o $@ cmd/secret/main.go
 | 
			
		||||
 | 
			
		||||
# Build with verbose output
 | 
			
		||||
build-verbose: clean
 | 
			
		||||
	@echo "Building with verbose output..."
 | 
			
		||||
	go build -v -o $(BINARY_NAME) cmd/secret/main.go
 | 
			
		||||
	@echo "Build complete: ./$(BINARY_NAME)"
 | 
			
		||||
build-verbose: cmd/secret/*.go internal/secret/*.go
 | 
			
		||||
	go build -v -o ./secret cmd/secret/main.go
 | 
			
		||||
 | 
			
		||||
# Vet the code
 | 
			
		||||
vet:
 | 
			
		||||
	@echo "Running go vet..."
 | 
			
		||||
	go vet ./...
 | 
			
		||||
 | 
			
		||||
# Test with linting and vetting
 | 
			
		||||
test: vet lint
 | 
			
		||||
	@echo "Running go tests..."
 | 
			
		||||
test:
 | 
			
		||||
	go test -v ./...
 | 
			
		||||
	@bash ./test_secret_manager.sh
 | 
			
		||||
 | 
			
		||||
# Run comprehensive test script
 | 
			
		||||
test-comprehensive: build
 | 
			
		||||
	@echo "Running comprehensive test script..."
 | 
			
		||||
	@chmod +x test_secret_manager.sh
 | 
			
		||||
	@./test_secret_manager.sh
 | 
			
		||||
 | 
			
		||||
# Run all tests (unit tests + comprehensive tests)
 | 
			
		||||
test-all: test test-comprehensive
 | 
			
		||||
 | 
			
		||||
# Lint the code
 | 
			
		||||
lint:
 | 
			
		||||
	@echo "Running linter..."
 | 
			
		||||
	golangci-lint run --timeout 5m
 | 
			
		||||
 | 
			
		||||
# Check all code quality (build + vet + lint + unit tests)
 | 
			
		||||
check: build vet lint test
 | 
			
		||||
 | 
			
		||||
# Clean build artifacts
 | 
			
		||||
clean:
 | 
			
		||||
	rm -f ./$(BINARY_NAME)
 | 
			
		||||
 | 
			
		||||
# Install to /usr/local/bin
 | 
			
		||||
install: build
 | 
			
		||||
	@echo "Installing to /usr/local/bin..."
 | 
			
		||||
	sudo cp $(BINARY_NAME) /usr/local/bin/
 | 
			
		||||
	@echo "Installed to /usr/local/bin/$(BINARY_NAME)"
 | 
			
		||||
 | 
			
		||||
# Uninstall from /usr/local/bin
 | 
			
		||||
uninstall:
 | 
			
		||||
	@echo "Removing from /usr/local/bin..."
 | 
			
		||||
	sudo rm -f /usr/local/bin/$(BINARY_NAME)
 | 
			
		||||
	@echo "Uninstalled $(BINARY_NAME)"
 | 
			
		||||
 | 
			
		||||
# Test keychain functionality
 | 
			
		||||
test-keychain:
 | 
			
		||||
	@echo "Testing keychain functionality..."
 | 
			
		||||
	@./$(BINARY_NAME) --help > /dev/null 2>&1 && echo "Binary runs successfully" || echo "Binary failed to run"
 | 
			
		||||
 | 
			
		||||
# Help target
 | 
			
		||||
help:
 | 
			
		||||
	@echo "Secret Manager - Simple Go CLI Tool"
 | 
			
		||||
	@echo "===================================="
 | 
			
		||||
	@echo ""
 | 
			
		||||
	@echo "Available targets:"
 | 
			
		||||
	@echo "  build              - Build the secret manager (default)"
 | 
			
		||||
	@echo "  build-verbose      - Build with verbose output"
 | 
			
		||||
	@echo "  vet                - Run go vet"
 | 
			
		||||
	@echo "  lint               - Run linter only"
 | 
			
		||||
	@echo "  test               - Run unit tests with vet and lint"
 | 
			
		||||
	@echo "  test-comprehensive - Run comprehensive test script"
 | 
			
		||||
	@echo "  test-all           - Run both unit tests and comprehensive tests"
 | 
			
		||||
	@echo "  check              - Run all code quality checks"
 | 
			
		||||
	@echo "  clean              - Remove build artifacts"
 | 
			
		||||
	@echo "  install            - Install to /usr/local/bin"
 | 
			
		||||
	@echo "  uninstall          - Remove from /usr/local/bin"
 | 
			
		||||
	@echo "  test-keychain      - Test basic functionality"
 | 
			
		||||
	@echo "  help               - Show this help"
 | 
			
		||||
	@echo ""
 | 
			
		||||
	@echo "Usage:"
 | 
			
		||||
	@echo "  make build && ./secret --help"
 | 
			
		||||
	@echo "  make test-all      # Run all tests"
 | 
			
		||||
	@echo "  make check         # Run all quality checks"
 | 
			
		||||
 | 
			
		||||
.PHONY: default build build-verbose vet test test-comprehensive test-all lint check clean install uninstall test-keychain help
 | 
			
		||||
	@rm -f ./secret
 | 
			
		||||
 | 
			
		||||
@ -15,8 +15,12 @@ TEST_PASSPHRASE="test-passphrase-123"
 | 
			
		||||
TEMP_DIR="$(mktemp -d)"
 | 
			
		||||
SECRET_BINARY="./secret"
 | 
			
		||||
 | 
			
		||||
# Enable debug logging for the secret manager
 | 
			
		||||
export GODEBUG="berlin.sneak.pkg.secret"
 | 
			
		||||
 | 
			
		||||
echo -e "${BLUE}=== Secret Manager Comprehensive Test Script ===${NC}"
 | 
			
		||||
echo -e "${YELLOW}Using temporary directory: $TEMP_DIR${NC}"
 | 
			
		||||
echo -e "${YELLOW}Debug logging enabled via GODEBUG=${GODEBUG}${NC}"
 | 
			
		||||
 | 
			
		||||
# Function to print test steps
 | 
			
		||||
print_step() {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user