-
Notifications
You must be signed in to change notification settings - Fork 1
Co t #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Co t #4
Changes from all commits
2a44a13
3a18b1e
567a0d0
b0e04ce
d3a5aab
bcda614
7b122fd
7a12e94
e58e176
2c711ba
89812ee
27597e1
1aeadc9
c5c11bc
4745558
8fad787
ee8ea5e
83ce9c7
d840306
bc2a3e4
d54beeb
d6b1817
d1d7786
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| # golangci-lint v2.x configuration | ||
| version: 2 | ||
|
|
||
| linters: | ||
| enable: | ||
| - errcheck | ||
| - govet | ||
| - ineffassign | ||
| - staticcheck | ||
| - unused | ||
|
|
||
| run: | ||
| timeout: 5m | ||
|
|
||
| issues: | ||
| max-issues-per-linter: 0 | ||
| max-same-issues: 0 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,15 +1,45 @@ | ||
| .PHONY: build test lint clean install run | ||
| .PHONY: all build test lint clean install run fmt vet check deps help | ||
| .PHONY: build-all build-linux build-darwin build-windows test-coverage test-integration | ||
| .PHONY: lint-fix security pre-commit ci | ||
|
|
||
| BINARY_NAME=vellumforge2 | ||
| VERSION?=1.5.3 | ||
| VERSION?=1.6.0 | ||
| BUILD_TIME=$(shell date -u '+%Y-%m-%d_%H:%M:%S') | ||
| GIT_COMMIT=$(shell git rev-parse --short HEAD 2>/dev/null || echo "unknown") | ||
|
|
||
| LDFLAGS=-ldflags "-X main.Version=$(VERSION) -X main.BuildTime=$(BUILD_TIME) -X main.GitCommit=$(GIT_COMMIT)" | ||
|
|
||
| # Colors for output | ||
| COLOR_RESET=\033[0m | ||
| COLOR_BOLD=\033[1m | ||
| COLOR_GREEN=\033[32m | ||
| COLOR_YELLOW=\033[33m | ||
| COLOR_BLUE=\033[34m | ||
|
|
||
| define print_step | ||
| @echo -e "$(COLOR_BOLD)$(COLOR_BLUE)==> $(1)$(COLOR_RESET)" | ||
| endef | ||
|
|
||
| ## all: Run all checks and build (optimal order for development) | ||
| all: deps fmt vet lint test build | ||
| $(call print_step,"✅ All checks passed! Binary built successfully.") | ||
|
|
||
| ## check: Run all quality checks without building (faster CI) | ||
| check: fmt-check vet lint test | ||
| $(call print_step,"✅ All quality checks passed!") | ||
|
|
||
| ## pre-commit: Fast checks before committing (skip tests) | ||
| pre-commit: fmt vet lint | ||
| $(call print_step,"✅ Pre-commit checks passed!") | ||
|
|
||
| ## ci: Full CI pipeline (format check + all validations + coverage) | ||
| ci: fmt-check vet lint test-coverage build | ||
| $(call print_step,"✅ CI pipeline completed successfully!") | ||
|
Comment on lines
+35
to
+37
|
||
|
|
||
| build: | ||
| @echo "Building $(BINARY_NAME)..." | ||
| $(call print_step,"Building $(BINARY_NAME)...") | ||
| @go build $(LDFLAGS) -o bin/$(BINARY_NAME) ./cmd/vellumforge2 | ||
| $(call print_step,"Built: bin/$(BINARY_NAME)") | ||
|
|
||
| build-linux: | ||
| @echo "Building $(BINARY_NAME) for Linux..." | ||
|
|
@@ -27,53 +57,132 @@ build-windows: | |
| build-all: build-linux build-darwin build-windows | ||
|
|
||
| test: | ||
| @echo "Running tests..." | ||
| @go test -v -race -coverprofile=coverage.out ./... | ||
| $(call print_step,"Running unit tests - skips integration tests...") | ||
| @go test -short -race -coverprofile=coverage.out ./... | ||
| @echo -e "$(COLOR_GREEN)Total coverage: $$(go tool cover -func=coverage.out | grep total | awk '{print $$3}')$(COLOR_RESET)" | ||
| $(call print_step,"✓ Tests passed") | ||
|
|
||
| test-integration: | ||
| $(call print_step,"Running ALL tests including integration tests - makes real API calls...") | ||
| @go test -race -coverprofile=coverage.out ./... | ||
| @echo -e "$(COLOR_GREEN)Total coverage: $$(go tool cover -func=coverage.out | grep total | awk '{print $$3}')$(COLOR_RESET)" | ||
| $(call print_step,"✓ All tests passed") | ||
|
|
||
| test-coverage: | ||
| @echo "Running tests with coverage report..." | ||
| @go test -v -race -coverprofile=coverage.out ./... | ||
| $(call print_step,"Running ALL tests with coverage report - makes real API calls...") | ||
| @go test -race -coverprofile=coverage.out ./... | ||
| @go tool cover -html=coverage.out -o coverage.html | ||
| @echo "Coverage report generated: coverage.html" | ||
| @echo -e "$(COLOR_GREEN)Total coverage: $$(go tool cover -func=coverage.out | grep total | awk '{print $$3}')$(COLOR_RESET)" | ||
| $(call print_step,"✓ Coverage report generated: coverage.html") | ||
|
|
||
| test-short: | ||
| $(call print_step,"Running short tests - alias for test...") | ||
| @go test -short -race ./... | ||
| $(call print_step,"✓ Short tests passed") | ||
|
|
||
| test-verbose: | ||
| $(call print_step,"Running tests with verbose output...") | ||
| @go test -v -race -coverprofile=coverage.out -count=1 ./... | ||
| $(call print_step,"✓ Verbose tests completed") | ||
|
|
||
| lint: | ||
| @echo "Running linters..." | ||
| $(call print_step,"Running golangci-lint...") | ||
| @golangci-lint run ./... | ||
| $(call print_step,"✓ Linting passed") | ||
|
|
||
| lint-fix: | ||
| $(call print_step,"Running golangci-lint with auto-fix...") | ||
| @golangci-lint run --fix ./... | ||
| $(call print_step,"✓ Linting with auto-fix completed") | ||
|
|
||
| security: | ||
| $(call print_step,"Running security checks...") | ||
| @golangci-lint run --disable-all --enable gosec ./... | ||
| $(call print_step,"✓ Security checks passed") | ||
|
|
||
| clean: | ||
| @echo "Cleaning..." | ||
| $(call print_step,"Cleaning build artifacts...") | ||
| @rm -rf bin/ | ||
| @rm -f coverage.out coverage.html | ||
| $(call print_step,"✓ Clean completed") | ||
|
|
||
| install: | ||
| @echo "Installing dependencies..." | ||
| $(call print_step,"Installing dependencies...") | ||
| @go mod download | ||
| @go mod tidy | ||
| $(call print_step,"✓ Dependencies installed") | ||
|
|
||
| deps: | ||
| $(call print_step,"Verifying dependencies...") | ||
| @go mod download | ||
| @go mod verify | ||
| $(call print_step,"✓ Dependencies verified") | ||
|
|
||
| run: | ||
| @go run ./cmd/vellumforge2 run --config configs/config.example.toml | ||
|
|
||
| fmt: | ||
| @echo "Formatting code..." | ||
| $(call print_step,"Formatting code...") | ||
| @go fmt ./... | ||
| @if command -v goimports >/dev/null 2>&1; then \ | ||
| goimports -w -local github.com/lamim/vellumforge2 .; \ | ||
| elif [ -f "$(shell go env GOPATH)/bin/goimports" ]; then \ | ||
| $(shell go env GOPATH)/bin/goimports -w -local github.com/lamim/vellumforge2 .; \ | ||
| else \ | ||
| echo -e "$(COLOR_YELLOW)Warning: goimports not found, run: go install golang.org/x/tools/cmd/goimports@latest$(COLOR_RESET)"; \ | ||
| fi | ||
| $(call print_step,"✓ Code formatted") | ||
|
|
||
| fmt-check: | ||
| $(call print_step,"Checking code formatting...") | ||
| @test -z "$$(gofmt -l .)" || (echo -e "$(COLOR_YELLOW)Files not formatted:$(COLOR_RESET)" && gofmt -l . && exit 1) | ||
| $(call print_step,"✓ Code formatting check passed") | ||
|
|
||
| vet: | ||
| @echo "Running go vet..." | ||
| $(call print_step,"Running go vet...") | ||
| @go vet ./... | ||
|
|
||
| deps: | ||
| @echo "Downloading dependencies..." | ||
| @go mod download | ||
| $(call print_step,"✓ Go vet passed") | ||
|
|
||
| help: | ||
| @echo "Available targets:" | ||
| @echo " build - Build the binary" | ||
| @echo " build-all - Build for all platforms" | ||
| @echo " test - Run tests" | ||
| @echo " test-coverage - Run tests with coverage report" | ||
| @echo " lint - Run linters" | ||
| @echo " clean - Remove build artifacts" | ||
| @echo " install - Install dependencies" | ||
| @echo " run - Run with example config" | ||
| @echo " fmt - Format code" | ||
| @echo " vet - Run go vet" | ||
| @echo -e "$(COLOR_BOLD)VellumForge2 Makefile Commands$(COLOR_RESET)" | ||
| @echo "" | ||
| @echo -e "$(COLOR_BOLD)Primary Commands:$(COLOR_RESET)" | ||
| @echo -e " $(COLOR_GREEN)make all$(COLOR_RESET) - Run full pipeline: deps → fmt → vet → lint → test → build" | ||
| @echo -e " $(COLOR_GREEN)make check$(COLOR_RESET) - Run quality checks without building (faster)" | ||
| @echo -e " $(COLOR_GREEN)make pre-commit$(COLOR_RESET) - Quick checks before committing (fmt → vet → lint)" | ||
| @echo -e " $(COLOR_GREEN)make ci$(COLOR_RESET) - Full CI pipeline with coverage" | ||
| @echo "" | ||
| @echo -e "$(COLOR_BOLD)Build Commands:$(COLOR_RESET)" | ||
| @echo " make build - Build binary for current platform" | ||
| @echo " make build-all - Build for all platforms (Linux, macOS, Windows)" | ||
| @echo " make build-linux - Build for Linux amd64" | ||
| @echo " make build-darwin - Build for macOS (amd64 + arm64)" | ||
| @echo " make build-windows - Build for Windows amd64" | ||
| @echo "" | ||
| @echo -e "$(COLOR_BOLD)Quality Commands:$(COLOR_RESET)" | ||
| @echo " make fmt - Format code with gofmt and goimports" | ||
| @echo " make fmt-check - Check if code is formatted (CI)" | ||
| @echo " make vet - Run go vet" | ||
| @echo " make lint - Run golangci-lint" | ||
| @echo " make lint-fix - Run golangci-lint with auto-fix" | ||
| @echo " make security - Run security checks (gosec)" | ||
| @echo "" | ||
| @echo -e "$(COLOR_BOLD)Test Commands:$(COLOR_RESET)" | ||
| @echo " make test - Run unit tests (fast, skips integration tests)" | ||
| @echo " make test-integration - Run ALL tests including integration tests (slow, makes API calls)" | ||
| @echo " make test-coverage - Run ALL tests and generate HTML coverage report (slow)" | ||
| @echo " make test-short - Alias for 'make test'" | ||
| @echo " make test-verbose - Run tests with verbose output" | ||
| @echo "" | ||
| @echo -e "$(COLOR_BOLD)Utility Commands:$(COLOR_RESET)" | ||
| @echo " make deps - Verify and download dependencies" | ||
| @echo " make install - Install and tidy dependencies" | ||
| @echo " make clean - Remove build artifacts and coverage files" | ||
| @echo " make run - Run with example config" | ||
| @echo " make help - Show this help message" | ||
| @echo "" | ||
| @echo -e "$(COLOR_BOLD)Examples:$(COLOR_RESET)" | ||
| @echo " make all # Run everything before pushing" | ||
| @echo " make pre-commit # Quick check before commit" | ||
| @echo " make test-coverage # Generate coverage report" | ||
| @echo " make lint-fix # Auto-fix linting issues" | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
echo -eis not portable across/bin/shimplementations (e.g., dash prints-eliterally). Sinceprint_stepis used by most targets, consider usingprintffor ANSI color output to keep the Makefile working consistently across environments.