120 lines
3.8 KiB
Makefile
120 lines
3.8 KiB
Makefile
# ATCR Makefile
|
|
# Build targets for the ATProto Container Registry
|
|
|
|
.PHONY: all build build-appview build-hold build-credential-helper build-oauth-helper \
|
|
generate test test-race test-verbose lint clean help install-credential-helper \
|
|
develop develop-detached develop-down dev
|
|
|
|
.DEFAULT_GOAL := help
|
|
|
|
help: ## Show this help message
|
|
@echo "ATCR Build Targets:"
|
|
@echo ""
|
|
@awk 'BEGIN {FS = ":.*##"; printf ""} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-28s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
|
|
|
|
all: generate build ## Generate assets and build all binaries (default)
|
|
|
|
# Generated asset files
|
|
GENERATED_ASSETS = \
|
|
pkg/appview/static/js/htmx.min.js \
|
|
pkg/appview/static/js/lucide.min.js \
|
|
pkg/appview/licenses/spdx-licenses.json
|
|
|
|
generate: $(GENERATED_ASSETS) ## Run go generate to download vendor assets
|
|
|
|
$(GENERATED_ASSETS):
|
|
@echo "→ Generating vendor assets and code..."
|
|
go generate ./...
|
|
|
|
##@ Build Targets
|
|
|
|
build: build-appview build-hold build-credential-helper ## Build all binaries
|
|
|
|
build-appview: $(GENERATED_ASSETS) ## Build appview binary only
|
|
@echo "→ Building appview..."
|
|
@mkdir -p bin
|
|
go build -o bin/atcr-appview ./cmd/appview
|
|
|
|
build-hold: $(GENERATED_ASSETS) ## Build hold binary only
|
|
@echo "→ Building hold..."
|
|
@mkdir -p bin
|
|
go build -o bin/atcr-hold ./cmd/hold
|
|
|
|
build-credential-helper: $(GENERATED_ASSETS) ## Build credential helper only
|
|
@echo "→ Building credential helper..."
|
|
@mkdir -p bin
|
|
go build -o bin/docker-credential-atcr ./cmd/credential-helper
|
|
|
|
build-oauth-helper: $(GENERATED_ASSETS) ## Build OAuth helper only
|
|
@echo "→ Building OAuth helper..."
|
|
@mkdir -p bin
|
|
go build -o bin/oauth-helper ./cmd/oauth-helper
|
|
|
|
##@ Test Targets
|
|
|
|
test: ## Run all tests
|
|
@echo "→ Running tests..."
|
|
go test -cover ./...
|
|
|
|
test-race: ## Run tests with race detector
|
|
@echo "→ Running tests with race detector..."
|
|
go test -race ./...
|
|
|
|
test-verbose: ## Run tests with verbose output
|
|
@echo "→ Running tests with verbose output..."
|
|
go test -v ./...
|
|
|
|
##@ Quality Targets
|
|
|
|
.PHONY: check-golangci-lint
|
|
check-golangci-lint:
|
|
@which golangci-lint > /dev/null || (echo "→ Installing golangci-lint..." && go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest)
|
|
|
|
lint: check-golangci-lint ## Run golangci-lint
|
|
@echo "→ Running golangci-lint..."
|
|
golangci-lint run ./...
|
|
|
|
##@ Install Targets
|
|
|
|
install-credential-helper: build-credential-helper ## Install credential helper to /usr/local/sbin
|
|
@echo "→ Installing credential helper to /usr/local/sbin..."
|
|
install -m 755 bin/docker-credential-atcr /usr/local/sbin/docker-credential-atcr
|
|
@echo "✓ Installed docker-credential-atcr to /usr/local/sbin/"
|
|
|
|
##@ Development Targets
|
|
|
|
dev: $(GENERATED_ASSETS) ## Run AppView locally with Air hot reload
|
|
@which air > /dev/null || (echo "→ Installing Air..." && go install github.com/air-verse/air@latest)
|
|
air -c .air.toml
|
|
|
|
##@ Docker Targets
|
|
|
|
develop: ## Build and start docker-compose with Air hot reload
|
|
@echo "→ Building Docker images..."
|
|
docker-compose build
|
|
@echo "→ Starting docker-compose with hot reload..."
|
|
docker-compose up
|
|
|
|
develop-detached: ## Build and start docker-compose with hot reload (detached)
|
|
@echo "→ Building Docker images..."
|
|
docker-compose build
|
|
@echo "→ Starting docker-compose with hot reload (detached)..."
|
|
docker-compose up -d
|
|
@echo "✓ Services started in background with hot reload"
|
|
@echo " AppView: http://localhost:5000"
|
|
@echo " Hold: http://localhost:8080"
|
|
|
|
develop-down: ## Stop docker-compose services
|
|
@echo "→ Stopping docker-compose..."
|
|
docker-compose down
|
|
|
|
##@ Utility Targets
|
|
|
|
clean: ## Remove built binaries and generated assets
|
|
@echo "→ Cleaning build artifacts..."
|
|
rm -rf bin/
|
|
rm -f pkg/appview/static/js/htmx.min.js
|
|
rm -f pkg/appview/static/js/lucide.min.js
|
|
rm -f pkg/appview/licenses/spdx-licenses.json
|
|
@echo "✓ Clean complete"
|