forked from bluesky-social/indigo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
143 lines (114 loc) · 4.35 KB
/
Makefile
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
SHELL = /bin/bash
.SHELLFLAGS = -o pipefail -c
# base path for Lexicon document tree (for lexgen)
LEXDIR?=../atproto/lexicons
# https://github.com/golang/go/wiki/LoopvarExperiment
export GOEXPERIMENT := loopvar
.PHONY: help
help: ## Print info about all commands
@echo "Commands:"
@echo
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[01;32m%-20s\033[0m %s\n", $$1, $$2}'
.PHONY: build
build: ## Build all executables
go build ./cmd/gosky
go build ./cmd/laputa
go build ./cmd/bigsky
go build ./cmd/beemo
go build ./cmd/lexgen
go build ./cmd/stress
go build ./cmd/fakermaker
go build ./cmd/labelmaker
go build ./cmd/hepa
go build ./cmd/supercollider
go build -o ./sonar-cli ./cmd/sonar
go build ./cmd/palomar
.PHONY: all
all: build
.PHONY: test
test: ## Run tests
go test ./...
.PHONY: test-short
test-short: ## Run tests, skipping slower integration tests
go test -test.short ./...
.PHONY: test-interop
test-interop: ## Run tests, including local interop (requires services running)
go clean -testcache && go test -tags=localinterop ./...
.PHONY: coverage-html
coverage-html: ## Generate test coverage report and open in browser
go test ./... -coverpkg=./... -coverprofile=test-coverage.out
go tool cover -html=test-coverage.out
.PHONY: lint
lint: ## Verify code style and run static checks
go vet -asmdecl -assign -atomic -bools -buildtag -cgocall -copylocks -httpresponse -loopclosure -lostcancel -nilfunc -printf -shift -stdmethods -structtag -tests -unmarshal -unreachable -unsafeptr -unusedresult ./...
test -z $(gofmt -l ./...)
.PHONY: fmt
fmt: ## Run syntax re-formatting (modify in place)
go fmt ./...
.PHONY: check
check: ## Compile everything, checking syntax (does not output binaries)
go build ./...
.PHONY: lexgen
lexgen: ## Run codegen tool for lexicons (lexicon JSON to Go packages)
go run ./cmd/lexgen/ --package bsky --prefix app.bsky --outdir api/bsky $(LEXDIR)
go run ./cmd/lexgen/ --package atproto --prefix com.atproto --outdir api/atproto $(LEXDIR)
.PHONY: cborgen
cborgen: ## Run codegen tool for CBOR serialization
go run ./gen
.env:
if [ ! -f ".env" ]; then cp example.dev.env .env; fi
.PHONY: run-dev-bgs
run-dev-bgs: .env ## Runs 'bigsky' BGS for local dev
GOLOG_LOG_LEVEL=info go run ./cmd/bigsky --admin-key localdev
# --crawl-insecure-ws
.PHONY: build-bgs-image
build-bgs-image: ## Builds 'bigsky' BGS docker image
docker build -t bigsky -f cmd/bigsky/Dockerfile .
.PHONY: run-bgs-image
run-bgs-image:
docker run -p 2470:2470 bigsky /bigsky --admin-key localdev
# --crawl-insecure-ws
.PHONY: run-dev-labelmaker
run-dev-labelmaker: .env ## Runs labelmaker for local dev
GOLOG_LOG_LEVEL=info go run ./cmd/labelmaker --subscribe-insecure-ws
.PHONY: run-dev-search
run-dev-search: .env ## Runs search daemon for local dev
GOLOG_LOG_LEVEL=info go run ./cmd/palomar run
.PHONY: sonar-up
sonar-up: # Runs sonar docker container
docker compose -f cmd/sonar/docker-compose.yml up --build -d || docker-compose -f cmd/sonar/docker-compose.yml up --build -d
.PHONY: sc-reload
sc-reload: # Reloads supercollider
go run cmd/supercollider/main.go \
reload \
--port 6125 --total-events 2000000 \
--hostname alpha.supercollider.jazco.io \
--key-file out/alpha.pem \
--output-file out/alpha_in.cbor
.PHONY: sc-fire
sc-fire: # Fires supercollider
go run cmd/supercollider/main.go \
fire \
--port 6125 --events-per-second 10000 \
--hostname alpha.supercollider.jazco.io \
--key-file out/alpha.pem \
--input-file out/alpha_in.cbor
.PHONY: run-netsync
run-netsync: .env ## Runs netsync for local dev
go run ./cmd/netsync --checkout-limit 30 --worker-count 60 --out-dir ../netsync-out
SCYLLA_VERSION := latest
SCYLLA_CPU := 0
SCYLLA_NODES := 127.0.0.1:9042
.PHONY: netsync-playback
netsync-playback: .env ## Runs netsync for local dev
go run ./cmd/netsync --worker-count 96 --out-dir ../netsync-out_2023_08_25 playback --scylla-nodes $(SCYLLA_NODES)
.PHONY: run-scylla
run-scylla:
@echo "==> Running test instance of Scylla $(SCYLLA_VERSION)"
@docker pull scylladb/scylla:$(SCYLLA_VERSION)
@docker run --name scylla -p 9042:9042 --cpuset-cpus=$(SCYLLA_CPU) --memory 1G --rm -d scylladb/scylla:$(SCYLLA_VERSION)
@until docker exec scylla cqlsh -e "DESCRIBE SCHEMA"; do sleep 2; done
.PHONY: stop-scylla
stop-scylla:
@echo "==> Stopping test instance of Scylla $(SCYLLA_VERSION)"
@docker stop scylla