-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
66 lines (58 loc) · 1.73 KB
/
Copy pathMakefile
File metadata and controls
66 lines (58 loc) · 1.73 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
GO = go
GOLANGCI_LINT = $(GO) tool golangci-lint
GORELEASER = $(GO) run github.com/goreleaser/goreleaser/v2@latest
.PHONY: go-mod-tidy
go-mod-tidy:
@echo "go mod tidy in all modules" && \
$(GO) mod tidy -compat=1.25.0
.PHONY: lint
lint: go-mod-tidy
@echo "Starting linting..." && \
$(GOLANGCI_LINT) run --concurrency=4 --allow-serial-runners $(ARGS)
lint-fix: ARGS=--fix
lint-fix: lint
@echo "✅ Lint fixing completed"
.PHONY: test
test:
go test ./... -race
@echo "✅ Testing completed"
.PHONY: release-check
release-check:
@echo "Checking GoReleaser configuration..." && \
$(GORELEASER) check
@echo "✅ GoReleaser configuration check completed"
.PHONY: release-snapshot
release-snapshot: release-check
@echo "Building snapshot release artifacts..." && \
$(GORELEASER) release --snapshot --clean --skip=publish
@echo "✅ Snapshot release build completed"
.PHONY: confirm-release
confirm-release:
@tag=$$(git describe --tags --exact-match HEAD 2>/dev/null) || { \
echo; \
echo "Current HEAD is not tagged. Create or checkout a release tag first."; \
echo; \
exit 1; \
}; \
if [ "$(CONFIRM_RELEASE)" != "$$tag" ]; then \
echo; \
echo "Refusing to publish release $$tag without explicit confirmation."; \
echo "Run: CONFIRM_RELEASE=$$tag make release"; \
echo; \
exit 1; \
fi; \
echo "Confirmed release $$tag"
.PHONY: release
release: confirm-release test check-clean-work
@echo "Building and publishing release artifacts..." && \
$(GORELEASER) release --clean
@echo "✅ Release completed"
.PHONY: check-clean-work
check-clean-work:
@if ! git diff --quiet; then \
echo; \
echo 'Working tree is not clean, did you forget to run "git stash" or "git commit"?'; \
echo; \
git status; \
exit 1; \
fi