-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathMakefile
More file actions
55 lines (46 loc) · 1.83 KB
/
Makefile
File metadata and controls
55 lines (46 loc) · 1.83 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
generate:
buf generate
test:
go test ./...
# Dockerized MariaDB integration harness (testdb/). Tests opt into the
# real database via TESTDB_ADDR; without it they skip.
# The compose project is unique per checkout and the host port ephemeral
# (discovered via `docker compose port`), so parallel worktrees can run
# harnesses side by side.
TESTDB_PROJECT ?= testdb-$(notdir $(CURDIR))
TESTDB_COMPOSE := docker compose -p $(TESTDB_PROJECT) -f testdb/compose.yaml
testdb-up:
$(TESTDB_COMPOSE) up -d --wait
testdb-down:
$(TESTDB_COMPOSE) down -v
# Fail loudly if port discovery comes back empty: an empty TESTDB_ADDR
# would silently skip the whole integration suite and exit 0.
test-integration: testdb-up
@set -eu; addr=$$($(TESTDB_COMPOSE) port mariadb 3306); \
test -n "$$addr" || { echo "harness port discovery failed" >&2; exit 1; }; \
TESTDB_ADDR=$$addr go test ./...
lint:
buf lint
buf breaking --against 'https://github.com/7cav/api.git#branch=develop'
certs:
rm -rf out/
certstrap init --common-name "ExampleCA" --passphrase ""
certstrap request-cert --common-name localhost --ip 0.0.0.0,127.0.0.1 --passphrase ""
certstrap sign localhost --CA "ExampleCA"
install:
go install \
google.golang.org/protobuf/cmd/protoc-gen-go \
google.golang.org/grpc/cmd/protoc-gen-go-grpc \
github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway \
github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2
go get \
github.com/bufbuild/buf/cmd/buf \
github.com/square/certstrap \
github.com/spf13/cobra
evans:
evans \
--tls -cert out/localhost.crt --certkey out/localhost.key --cacert out/ExampleCA.crt \
--path /home/jarvis/.cache/buf/mod/grpc-ecosystem/grpc-gateway/240eb01580e34380ae1d138426e0174f/ \
--path /home/jarvis/.cache/buf/mod/beta/googleapis/1dc4674e3cb949b388204fa2dc321be7 \
--path . proto/milpacs.proto \
-p 10000