Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
91 lines (70 loc) · 2.69 KB
/
Copy pathMakefile
File metadata and controls
91 lines (70 loc) · 2.69 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
.PHONY: all build test test-race test-cover test-static-smoke test-pi-runtime pi-runtime-version check-pi-runtime-version lint fmt tidy deps check install snapshot package-render-check release clean
# Standard keyring tags: enable 1Password support, keep passage disabled.
GOFLAGS ?= -tags=keyring_nopassage
export GOFLAGS
all: check
build:
go build -v ./...
test:
go test -v ./...
# Exercise SQLite startup/migration contention repeatedly without racing the
# entire suite. Keep package execution and test scheduling bounded in CI.
test-race:
go test -race -count=25 -cpu=4 -parallel=4 -p=1 -timeout=5m ./internal/ledger/... ./internal/dbmig/...
test-cover:
go test -coverprofile=coverage.out ./...
test-static-smoke:
go test -v ./internal/... ./cmd/... -count=1
# Exact Pi version the installed-runtime gate requires. CI installs this
# version; test-pi-runtime fails, rather than skips, when `pi --version` on PATH
# reports anything else or Pi is missing.
PI_RUNTIME_VERSION ?= 1.0.0
# A blank pin would make the runtime tests skip and let npm install the latest
# Pi, so both targets below require exactly one version.
check-pi-runtime-version:
@if [ "$(words $(PI_RUNTIME_VERSION))" != 1 ]; then \
echo "PI_RUNTIME_VERSION must be exactly one Pi version" >&2; \
exit 1; \
fi
test-pi-runtime: check-pi-runtime-version
CR_PI_RUNTIME_VERSION=$(strip $(PI_RUNTIME_VERSION)) go test -v -race -count=1 -run 'TestPiRPCRuntime|TestPiRPCReviewerExtensionLoadsInInstalledPi' ./internal/llmadapters
pi-runtime-version: check-pi-runtime-version
@echo $(strip $(PI_RUNTIME_VERSION))
lint:
golangci-lint run
fmt:
go fmt ./...
tidy:
go mod tidy
@if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then \
if [ -f go.sum ]; then \
git diff --exit-code go.mod go.sum; \
else \
git diff --exit-code go.mod; \
fi; \
fi
deps:
go mod download
go mod verify
check: tidy fmt lint test build
install:
go install ./cmd/cr
# goreleaser wrappers. `snapshot` builds locally without publishing (the same
# build CI's release.yml runs). `release` is the real publish and is intended for
# CI (via the reusable release workflow); it is guarded so a stray local run with
# GITHUB_TOKEN/GORELEASER_* in the environment can't accidentally publish — set
# CONFIRM_RELEASE=1 to override.
snapshot:
goreleaser release --snapshot --clean --skip=publish
scripts/verify-package-render.sh
package-render-check:
scripts/verify-package-render.sh
release:
ifneq ($(CONFIRM_RELEASE),1)
@echo "make release publishes a live release; this is CI-only." >&2
@echo "Re-run with CONFIRM_RELEASE=1 if you really mean to publish locally." >&2
@exit 1
endif
goreleaser release --clean
clean:
rm -rf bin/ dist/ coverage.out coverage.html