aboutsummaryrefslogtreecommitdiff
path: root/justfile
diff options
context:
space:
mode:
authorFuwn <[email protected]>2026-01-20 04:57:24 -0800
committerFuwn <[email protected]>2026-01-20 04:57:24 -0800
commit6f047d38a49274560474e81ccf0c0b973756050f (patch)
tree60182d63ad291ecb1a03a99362ee1465827c0846 /justfile
parentfix: Prevent flash of light mode on page load (diff)
downloadkaze-6f047d38a49274560474e81ccf0c0b973756050f.tar.xz
kaze-6f047d38a49274560474e81ccf0c0b973756050f.zip
chore: Add justfile
Diffstat (limited to 'justfile')
-rw-r--r--justfile84
1 files changed, 84 insertions, 0 deletions
diff --git a/justfile b/justfile
new file mode 100644
index 0000000..74f9132
--- /dev/null
+++ b/justfile
@@ -0,0 +1,84 @@
+# Build variables
+version := `git describe --tags --always --dirty 2>/dev/null || echo "dev"`
+commit := `git rev-parse --short HEAD 2>/dev/null || echo "none"`
+date := `date -u +"%Y-%m-%dT%H:%M:%SZ"`
+ldflags := "-s -w -X main.version=" + version + " -X main.commit=" + commit + " -X main.date=" + date
+
+# Default target
+default: build
+
+# Build the binary
+build:
+ go build -ldflags "{{ldflags}}" -o kaze ./cmd/kaze
+
+# Build for production (smaller binary)
+build-prod:
+ CGO_ENABLED=0 go build -ldflags "{{ldflags}}" -o kaze ./cmd/kaze
+
+# Run the application
+run: build
+ ./kaze
+
+# Run with debug logging
+dev: build
+ ./kaze --debug
+
+# Clean build artifacts
+clean:
+ rm -f kaze
+ rm -f *.db *.db-shm *.db-wal
+
+# Run tests
+test:
+ go test -v ./...
+
+# Run tests with coverage
+test-cover:
+ go test -v -coverprofile=coverage.out ./...
+ go tool cover -html=coverage.out -o coverage.html
+
+# Format code
+fmt:
+ go fmt ./...
+
+# Lint code
+lint:
+ go vet ./...
+
+# Tidy dependencies
+tidy:
+ go mod tidy
+
+# Build for multiple platforms
+build-all: build-linux build-darwin build-windows
+
+build-linux:
+ GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags "{{ldflags}}" -o dist/kaze-linux-amd64 ./cmd/kaze
+ GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -ldflags "{{ldflags}}" -o dist/kaze-linux-arm64 ./cmd/kaze
+
+build-darwin:
+ GOOS=darwin GOARCH=amd64 CGO_ENABLED=0 go build -ldflags "{{ldflags}}" -o dist/kaze-darwin-amd64 ./cmd/kaze
+ GOOS=darwin GOARCH=arm64 CGO_ENABLED=0 go build -ldflags "{{ldflags}}" -o dist/kaze-darwin-arm64 ./cmd/kaze
+
+build-windows:
+ GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -ldflags "{{ldflags}}" -o dist/kaze-windows-amd64.exe ./cmd/kaze
+
+# Docker build
+docker:
+ docker build -t kaze:{{version}} .
+
+# Help
+help:
+ @echo "Available targets:"
+ @echo " build - Build the binary"
+ @echo " build-prod - Build optimized production binary"
+ @echo " run - Build and run"
+ @echo " dev - Build and run with debug logging"
+ @echo " clean - Remove build artifacts and databases"
+ @echo " test - Run tests"
+ @echo " test-cover - Run tests with coverage report"
+ @echo " fmt - Format code"
+ @echo " lint - Lint code"
+ @echo " tidy - Tidy dependencies"
+ @echo " build-all - Build for all platforms"
+ @echo " docker - Build Docker image"