-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJustfile
More file actions
109 lines (90 loc) · 3.1 KB
/
Justfile
File metadata and controls
109 lines (90 loc) · 3.1 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# Fast Celery Ping - Development Tasks
#
# Use `just --list` to see all available commands
# Variables
APP_NAME := env_var_or_default("APP_NAME", "fast-celery-ping")
VERSION := env_var_or_default("VERSION", "1.0.0")
BUILD_TIME := `date -u +%Y-%m-%dT%H:%M:%SZ`
LDFLAGS := "-s -w -X 'fast-celery-ping/cmd.Version=" + VERSION + "' -X 'fast-celery-ping/cmd.BuildTime=" + BUILD_TIME + "'"
# Default recipe - show help
default:
@just --list
# Build the application
build:
@echo "Building {{APP_NAME}}..."
CGO_ENABLED=0 go build -ldflags="{{LDFLAGS}}" -o {{APP_NAME}} .
# Build for multiple platforms
build-all:
@echo "Building for multiple platforms..."
mkdir -p dist
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags="{{LDFLAGS}}" -o dist/{{APP_NAME}}-linux-amd64 .
GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -ldflags="{{LDFLAGS}}" -o dist/{{APP_NAME}}-linux-arm64 .
GOOS=darwin GOARCH=amd64 CGO_ENABLED=0 go build -ldflags="{{LDFLAGS}}" -o dist/{{APP_NAME}}-darwin-amd64 .
GOOS=darwin GOARCH=arm64 CGO_ENABLED=0 go build -ldflags="{{LDFLAGS}}" -o dist/{{APP_NAME}}-darwin-arm64 .
# Run tests
test:
@echo "Running tests..."
go test -v ./...
# Run tests with coverage
test-coverage:
@echo "Running tests with coverage..."
go test -v -coverprofile=coverage.out ./...
go tool cover -html=coverage.out -o coverage.html
@echo "Coverage report generated: coverage.html"
# Run tests and show coverage in terminal
test-cover:
@echo "Running tests with coverage..."
go test -v -coverprofile=coverage.out ./...
go tool cover -func=coverage.out
# Run benchmarks
bench:
@echo "Running benchmarks..."
go test -bench=. -benchmem ./...
# Format code
fmt:
@echo "Formatting code..."
go fmt ./...
# Run linter (requires golangci-lint)
lint:
@echo "Running linter..."
golangci-lint run
# Tidy dependencies
tidy:
@echo "Tidying dependencies..."
go mod tidy
# Update dependencies
update:
@echo "Updating dependencies..."
go get -u ./...
go mod tidy
# Clean build artifacts
clean:
@echo "Cleaning build artifacts..."
rm -f {{APP_NAME}}
rm -rf dist/
rm -f coverage.out coverage.html
# Install the binary to $GOPATH/bin
install:
@echo "Installing {{APP_NAME}}..."
go install -ldflags="{{LDFLAGS}}" .
# Run the application with default help
run *ARGS:
@echo "Running {{APP_NAME}}..."
go run . {{ARGS}}
# Quick development test - build and run with Redis
dev-test: build
@echo "Testing with local Redis..."
./{{APP_NAME}} --broker-url redis://localhost:6379/0 --verbose --timeout 5s
# Build Docker image
docker-build:
@echo "Building Docker image..."
docker build -t {{APP_NAME}}:{{VERSION}} .
docker build -t {{APP_NAME}}:latest .
# Build Docker image with multi-platform support
docker-build-multi *ARGS:
@echo "Building multi-platform Docker image..."
docker buildx build --platform linux/amd64,linux/arm64 -t {{APP_NAME}}:{{VERSION}} -t {{APP_NAME}}:latest {{ARGS}} .
# Run Docker container
docker-run *ARGS:
@echo "Running Docker container..."
docker run --rm {{APP_NAME}}:latest {{ARGS}}