-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
173 lines (145 loc) · 6.02 KB
/
Copy pathMakefile
File metadata and controls
173 lines (145 loc) · 6.02 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
# SPDX-License-Identifier: MPL-2.0
# Enable JSON v2 for all Go commands
export GOEXPERIMENT := jsonv2
export GOFLAGS := -buildvcs=false
test-clean:
go clean -testcache
test:
go test ./internal/... -v -race -short
go test ./api/... -v -race -short
go test ./system/... -v -race -short
go test ./service/... -v -race -short
go test ./cluster/... -v -race -short
go test --tags "fts5 sqlite_vec treesitter" ./runtime/... -v -race -short
go test ./boot/... -v -race -short
go test --tags "fts5 sqlite_vec treesitter" ./cmd/... -v -race -short
test-system:
go test ./internal/... -v -race
go test ./api/... -v -race
go test ./system/... -v -race
test-runtime:
go test ./internal/... -v -race
go test ./api/... -v -race
go test --tags "fts5 sqlite_vec treesitter" ./runtime/... -v -race
test-service:
go test ./internal/... -v -race
go test ./api/... -v -race
go test ./service/... -v -race
test-cluster:
go test ./internal/... -v -race
go test ./api/... -v -race
go test ./cluster/... -v -race
test-integration:
CGO_ENABLED=1 go test ./tests/... -v -race -timeout 120s
test-network:
go test -v -race -timeout 300s ./service/net/...
.PHONY: lint
lint:
go run github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.8.0 run --timeout=10m --build-tags=race ./...
# Mutation testing with gremlins. Coverage is scoped to the directory gremlins
# runs from, so target a package subtree via MUTATE_DIR. workers=1 keeps per-
# mutant timing free of contention and the generous timeout coefficient stops
# fast packages (whose cached coverage baseline is tiny) from spuriously timing
# out while each mutant recompiles — together these make the score deterministic.
# Example: make mutation MUTATE_DIR=system/topology/namereg/kvbacked
MUTATE_DIR ?= service/store/kv
.PHONY: mutation
mutation:
cd $(MUTATE_DIR) && go run github.com/go-gremlins/gremlins/cmd/gremlins@v0.6.0 unleash --workers 1 --timeout-coefficient 30
mock:
go tool mockgen -destination tests/mock/identityv1connect/identityv1connect.go github.com/wippyai/module-registry-proto-go/registry/identity/v1/identityv1connect OrganizationServiceClient
go tool mockgen -destination tests/mock/modulev1connect/modulev1connect.go github.com/wippyai/module-registry-proto-go/registry/module/v1/modulev1connect ModuleServiceClient,CommitServiceClient,LabelServiceClient,DownloadServiceClient
go tool mockgen -destination tests/mock/deps/moduleloader.go github.com/wippyai/runtime/deps ManifestLoader
otel-up:
cd tests && docker-compose up -d --remove-orphans
otel-down:
cd tests && docker-compose down
# Wippy CLI build targets
WIPPY_VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
WIPPY_COMMIT ?= $(shell git rev-parse --short HEAD 2>/dev/null || echo "unknown")
WIPPY_DATE ?= $(shell date -u '+%Y-%m-%dT%H:%M:%SZ')
WIPPY_BUILDER ?= $(shell whoami)@$(shell hostname)
WIPPY_LDFLAGS := -s -w \
-X github.com/wippyai/runtime/api/version.Version=$(WIPPY_VERSION) \
-X github.com/wippyai/runtime/api/version.Commit=$(WIPPY_COMMIT) \
-X github.com/wippyai/runtime/api/version.Date=$(WIPPY_DATE) \
-X github.com/wippyai/runtime/api/version.BuiltBy=$(WIPPY_BUILDER)
.PHONY: build-wippy
build-wippy: build-wippy-local
.PHONY: build-wippy-local
build-wippy-local:
mkdir -p ./dist
CGO_ENABLED=1 go build --tags "fts5 sqlite_vec treesitter" \
-ldflags="$(WIPPY_LDFLAGS)" \
-trimpath \
-o ./dist/wippy-$(shell go env GOOS)-$(shell go env GOARCH) \
./cmd/wippy/
.PHONY: build-wippy-all
build-wippy-all: build-wippy-linux-amd64 build-wippy-linux-arm64 build-wippy-darwin-amd64 build-wippy-darwin-arm64 build-wippy-windows-amd64
.PHONY: build-wippy-linux-amd64
build-wippy-linux-amd64:
mkdir -p ./dist
CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build --tags "fts5 sqlite_vec treesitter" \
-ldflags="$(WIPPY_LDFLAGS)" \
-trimpath \
-o ./dist/wippy-linux-amd64 \
./cmd/wippy/
.PHONY: build-wippy-linux-arm64
build-wippy-linux-arm64:
mkdir -p ./dist
CGO_LDFLAGS="" CGO_CFLAGS="" CC=aarch64-linux-gnu-gcc \
CGO_ENABLED=1 GOOS=linux GOARCH=arm64 go build --tags "fts5 sqlite_vec treesitter" \
-ldflags="$(WIPPY_LDFLAGS)" \
-trimpath \
-o ./dist/wippy-linux-arm64 \
./cmd/wippy/
.PHONY: build-wippy-darwin-amd64
build-wippy-darwin-amd64:
mkdir -p ./dist
CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 go build --tags "fts5 sqlite_vec treesitter" \
-ldflags="$(WIPPY_LDFLAGS)" \
-trimpath \
-o ./dist/wippy-darwin-amd64 \
./cmd/wippy/
.PHONY: build-wippy-darwin-arm64
build-wippy-darwin-arm64:
mkdir -p ./dist
CGO_ENABLED=1 GOOS=darwin GOARCH=arm64 go build --tags "fts5 sqlite_vec treesitter" \
-ldflags="$(WIPPY_LDFLAGS)" \
-trimpath \
-o ./dist/wippy-darwin-arm64 \
./cmd/wippy/
.PHONY: build-wippy-windows-amd64
build-wippy-windows-amd64:
mkdir -p ./dist
CGO_LDFLAGS="" CGO_CFLAGS="" CC=x86_64-w64-mingw32-gcc \
CGO_ENABLED=1 GOOS=windows GOARCH=amd64 go build --tags "fts5 sqlite_vec treesitter" \
-ldflags="$(WIPPY_LDFLAGS)" \
-trimpath \
-o ./dist/wippy-windows-amd64.exe \
./cmd/wippy/
# Azure Trusted Signing configuration
AZURE_CLIENT_ID ?=
AZURE_CLIENT_SECRET ?=
AZURE_TENANT_ID ?=
AZURE_ENDPOINT ?= https://eus.codesigning.azure.net/
AZURE_ACCOUNT_NAME ?= SpiralScout
AZURE_CERT_PROFILE ?= SpiralScout
AZURE_METADATA_JSON ?= C:\Projects\gen2-electron\metadata.json
AZURE_CODE_SIGNING_DLIB ?= C:\Users\ryots\AppData\Local\Microsoft\MicrosoftTrustedSigningClientTools\Azure.CodeSigning.Dlib.dll
SIGNTOOL_PATH ?= c:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\x64\signtool.exe
.PHONY: sign-wippy-windows
sign-wippy-windows:
AZURE_CLIENT_ID=$(AZURE_CLIENT_ID) \
AZURE_CLIENT_SECRET=$(AZURE_CLIENT_SECRET) \
AZURE_TENANT_ID=$(AZURE_TENANT_ID) \
"$(SIGNTOOL_PATH)" sign /v /fd SHA256 \
/tr "http://timestamp.acs.microsoft.com" /td SHA256 \
/dlib "$(AZURE_CODE_SIGNING_DLIB)" \
/dmdf "$(AZURE_METADATA_JSON)" \
./dist/wippy-windows-amd64.exe
.PHONY: build-sign-wippy-windows
build-sign-wippy-windows: build-wippy-windows-amd64 sign-wippy-windows
.PHONY: run-wippy
run-wippy:
go run --tags "fts5 sqlite_vec treesitter" -ldflags="$(WIPPY_LDFLAGS)" ./cmd/wippy/ $(ARGS)