-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMakefile
More file actions
67 lines (47 loc) · 2.03 KB
/
Makefile
File metadata and controls
67 lines (47 loc) · 2.03 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
# playconsole-cli - Google Play Console CLI
# Makefile for building, testing, and releasing
BINARY_NAME=playconsole-cli
VERSION?=$(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
COMMIT?=$(shell git rev-parse --short HEAD 2>/dev/null || echo "none")
DATE?=$(shell date -u +"%Y-%m-%dT%H:%M:%SZ")
LDFLAGS=-ldflags "-X main.version=$(VERSION) -X main.commit=$(COMMIT) -X main.date=$(DATE)"
.PHONY: all build install clean test lint fmt deps help
all: build
## Build
build: ## Build the binary
go build $(LDFLAGS) -o bin/$(BINARY_NAME) ./cmd/playconsole-cli
build-all: ## Build for all platforms
GOOS=darwin GOARCH=amd64 go build $(LDFLAGS) -o bin/$(BINARY_NAME)-darwin-amd64 ./cmd/playconsole-cli
GOOS=darwin GOARCH=arm64 go build $(LDFLAGS) -o bin/$(BINARY_NAME)-darwin-arm64 ./cmd/playconsole-cli
GOOS=linux GOARCH=amd64 go build $(LDFLAGS) -o bin/$(BINARY_NAME)-linux-amd64 ./cmd/playconsole-cli
GOOS=linux GOARCH=arm64 go build $(LDFLAGS) -o bin/$(BINARY_NAME)-linux-arm64 ./cmd/playconsole-cli
GOOS=windows GOARCH=amd64 go build $(LDFLAGS) -o bin/$(BINARY_NAME)-windows-amd64.exe ./cmd/playconsole-cli
install: build ## Install to $GOPATH/bin
cp bin/$(BINARY_NAME) $(GOPATH)/bin/$(BINARY_NAME)
## Development
deps: ## Download dependencies
go mod download
go mod tidy
fmt: ## Format code
go fmt ./...
lint: ## Run linter
golangci-lint run
test: ## Run tests
go test -v ./...
test-coverage: ## Run tests with coverage
go test -v -coverprofile=coverage.out ./...
go tool cover -html=coverage.out -o coverage.html
## Release
release-snapshot: ## Create a snapshot release (no publish)
goreleaser release --snapshot --clean
release: ## Create a release (requires GITHUB_TOKEN)
goreleaser release --clean
## Utilities
clean: ## Remove build artifacts
rm -rf bin/
rm -rf dist/
rm -f coverage.out coverage.html
version: ## Print version
@echo $(VERSION)
help: ## Show this help
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'