-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJustfile
More file actions
83 lines (71 loc) · 2.38 KB
/
Copy pathJustfile
File metadata and controls
83 lines (71 loc) · 2.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# Project variables
BINARY_NAME := "clean-wizard"
# Build binary for current platform
build:
@echo "🔨 Building {{BINARY_NAME}}..."
go build -o {{BINARY_NAME}} ./cmd/clean-wizard
@echo "✅ Build complete: ./{{BINARY_NAME}}"
# Install binary locally
install-local:
@echo "📦 Installing {{BINARY_NAME}} locally..."
go install ./cmd/clean-wizard
@echo "✅ Installation complete"
# Clean build artifacts
clean:
@echo "🧹 Cleaning build artifacts..."
rm -rf bin/ {{BINARY_NAME}}
find . -name "*.test" -type f -delete
rm -f coverage.out coverage.html
go clean
# Run tests
test:
@echo "🧪 Running tests..."
go test -v ./...
# Run tests with coverage
test-coverage:
@echo "🧪 Running tests with coverage..."
go test -v -race -coverprofile=coverage.out ./...
go tool cover -html=coverage.out -o coverage.html
# Format code
format:
@echo "🎨 Formatting code..."
go fmt ./...
goimports -w .
# Clean everything (including caches)
# NOTE: This skips Go cache cleaning if other Go processes are running to avoid cache corruption.
# This is a safety measure - if you need to clean Go caches, ensure no other Go processes are running first.
clean-all:
@echo "🧹 Cleaning all build artifacts..."
rm -rf bin/ {{BINARY_NAME}}
find . -name "*.test" -type f -delete
rm -f coverage.out coverage.html
rm -rf reports/
go clean
@echo "🧹 Cleaning caches via clean-wizard (skipping Go caches if processes are running)..."
@go build -o {{BINARY_NAME}} ./cmd/clean-wizard 2>&1 > /dev/null || true
@./{{BINARY_NAME}} clean --mode quick --json > /dev/null 2>&1 || echo "ℹ️ clean-wizard skipped"
rm -f {{BINARY_NAME}}
# Install dependencies
deps:
@echo "📦 Installing dependencies..."
go mod download
go mod tidy
# Run application
run: build
@echo "🚀 Running {{BINARY_NAME}}..."
./{{BINARY_NAME}} --help
# Continuous Integration pipeline
ci: build test
@echo "✅ CI pipeline completed successfully"
# Default recipe
default:
@just --list
# Fix module issues
fix-modules: build
@echo "🔧 Fixing module cache via clean-wizard..."
{{BINARY_NAME}} clean --json --mode quick > /dev/null || echo "ℹ️ Go cache cleaned via clean-wizard"
@echo "🔧 Tidying and verifying modules..."
go mod tidy
go mod download
go mod verify
@echo "✅ Modules fixed"