-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
60 lines (45 loc) · 1.59 KB
/
Copy pathMakefile
File metadata and controls
60 lines (45 loc) · 1.59 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
BINARY := bitrise-cli
MODULE := github.com/bitrise-io/bitrise-cli
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
COMMIT ?= $(shell git rev-parse --short HEAD 2>/dev/null || echo "unknown")
LDFLAGS := -s -w -X $(MODULE)/cmd.version=$(VERSION) -X $(MODULE)/cmd.commit=$(COMMIT)
GOLANGCI_LINT := go run github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.12.2
GORELEASER := go run github.com/goreleaser/goreleaser/v2@v2.16.0
.PHONY: build fmt vet lint lint-fix test tidy docs docs-check release-check release-snapshot release-ci clean
build:
go build -ldflags "$(LDFLAGS)" -o ./$(BINARY) .
fmt:
gofmt -l .
vet:
go vet ./...
lint:
$(GOLANGCI_LINT) run ./...
lint-fix:
$(GOLANGCI_LINT) run --fix ./...
test:
go test -race -count=1 -timeout=5m ./...
tidy:
go mod tidy && git diff --exit-code go.mod go.sum
docs:
go run ./tools/gendocs
docs-check: docs
@status=$$(git status --porcelain docs/cli README.md); \
if [ -n "$$status" ]; then \
echo "Generated CLI docs are out of date — run 'make docs' and commit the result:"; \
echo "$$status"; \
exit 1; \
fi
# Validate .goreleaser.yaml.
release-check:
$(GORELEASER) check
# Build every release platform into dist/ without tagging or publishing.
release-snapshot:
$(GORELEASER) release --snapshot --clean
# Real release: builds all platforms and publishes a draft GitHub release.
# Run by the `release` workflow in bitrise.yml on vX.Y.Z tag pushes; needs
# GITHUB_TOKEN with contents:write. Not intended for laptops.
release-ci:
$(GORELEASER) release --clean
clean:
rm -f ./$(BINARY)
rm -rf ./dist