forked from avivsinai/bitbucket-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
74 lines (60 loc) · 2.12 KB
/
Copy pathMakefile
File metadata and controls
74 lines (60 loc) · 2.12 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
GO ?= go
BIN_DIR ?= bin
CMD := ./cmd/bkt
SOURCES := $(shell find cmd internal pkg -name '*.go')
VERSION ?= $(shell \
if git describe --tags --exact-match >/dev/null 2>&1; then \
git describe --tags --exact-match; \
else \
short=$$(git rev-parse --short HEAD 2>/dev/null || echo "unknown"); \
if git diff-index --quiet HEAD 2>/dev/null; then \
echo "dev-$$short"; \
else \
echo "dev-$$short-dirty"; \
fi; \
fi \
)
COMMIT ?= $(shell git rev-parse HEAD 2>/dev/null || echo unknown)
BUILD_DATE ?= $(shell date -u +%Y-%m-%dT%H:%M:%SZ)
LDFLAGS := -s -w \
-X github.com/qrstuff/bitbucket-cli/internal/build.versionFromLdflags=$(VERSION) \
-X github.com/qrstuff/bitbucket-cli/internal/build.commitFromLdflags=$(COMMIT) \
-X github.com/qrstuff/bitbucket-cli/internal/build.dateFromLdflags=$(BUILD_DATE)
.PHONY: build fmt lint test tidy sbom release snapshot clean sync-skills check-skills
build: $(BIN_DIR)/bkt
# Skill sync: .claude/skills/ is source of truth
sync-skills:
@echo "Syncing skills from .claude/skills/ to .codex/skills/ and skills/..."
@mkdir -p .codex/skills/bkt skills/bkt
@cp -R .claude/skills/bkt/* .codex/skills/bkt/
@cp -R .claude/skills/bkt/* skills/bkt/
@echo "✓ Skills synced"
check-skills:
@echo "Checking skill sync..."
@diff -rq .claude/skills/bkt .codex/skills/bkt || (echo "❌ .codex/skills/bkt out of sync" && exit 1)
@diff -rq .claude/skills/bkt skills/bkt || (echo "❌ skills/bkt out of sync" && exit 1)
@echo "✓ Skills in sync"
$(BIN_DIR)/bkt: $(SOURCES) go.mod go.sum
@mkdir -p $(BIN_DIR)
$(GO) build -trimpath -ldflags "$(LDFLAGS)" -o $(BIN_DIR)/bkt $(CMD)
fmt:
$(GO) fmt ./...
lint:
golangci-lint run
test:
$(GO) test ./...
tidy:
$(GO) mod tidy
sbom:
@if ! command -v syft >/dev/null 2>&1; then \
echo "syft not installed; install from https://github.com/anchore/syft" >&2; \
exit 1; \
fi
syft dir:. -o cyclonedx-json=sbom.cdx.json
release:
goreleaser release --clean
snapshot:
@command -v goreleaser >/dev/null 2>&1 || { echo "goreleaser not installed. Run: brew install goreleaser"; exit 1; }
goreleaser release --snapshot --clean --skip=publish
clean:
rm -rf $(BIN_DIR) dist/