-
Notifications
You must be signed in to change notification settings - Fork 189
Expand file tree
/
Copy pathMakefile
More file actions
117 lines (91 loc) · 3.32 KB
/
Copy pathMakefile
File metadata and controls
117 lines (91 loc) · 3.32 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
# Makefile for Go project
default: build
# All target
all: ui-user
$(MAKE) build
ui: ui-user ui-user-node
ui-user:
cd ui/user && \
pnpm install && \
pnpm run build
ui-user-node:
cd ui/user && \
pnpm install && \
BUILD=node pnpm run build
clean:
rm -rf ui/admin/build
rm -rf ui/user/build
serve-docs:
cd docs && \
npm install && \
npm run start
# Build the project
GIT_TAG := $(shell git describe --tags --exact-match 2>/dev/null | xargs -I {} echo -X 'github.com/obot-platform/obot/pkg/version.Tag={}')
GO_LD_FLAGS := "-s -w $(GIT_TAG)"
build:
go build -ldflags=$(GO_LD_FLAGS) -o bin/obot .
dev:
./tools/dev.sh $(ARGS)
dev-open: ARGS=--open-uis
dev-open: dev
otel-jaeger-up:
docker compose -f tools/jaeger-compose.yaml up -d
otel-jaeger-down:
docker compose -f tools/jaeger-compose.yaml down
otel-jaeger-logs:
docker compose -f tools/jaeger-compose.yaml logs -f
telepresence-setup:
kubectl create deployment obot-upstream --image=alpine --dry-run=client -o yaml -- sleep infinity | kubectl apply -f -
kubectl create service clusterip obot-upstream --tcp=8080:8080 --dry-run=client -o yaml | kubectl apply -f -
kubectl patch svc obot-upstream --type='json' -p='[{"op":"replace","path":"/spec/ports/0/name","value":"http"}]'
kubectl apply -f tools/obot-proxy.yaml
telepresence quit -s
telepresence connect
kubectl rollout restart deployment/obot-upstream
telepresence intercept obot-upstream -p 8080:8080
# Lint the project
lint: lint-go
tidy:
go mod tidy
GOLANGCI_LINT_VERSION ?= v2.12.2
setup-env:
if ! command -v golangci-lint >/dev/null 2>&1; then \
echo "Could not find golangci-lint, installing version $(GOLANGCI_LINT_VERSION)."; \
go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION); \
fi
lint-go: setup-env
golangci-lint run
generate:
go generate
test:
go test -v -cover ./...
cd apiclient && go test -v -cover ./... && cd ..
cd logger && go test -v -cover ./... && cd ..
# Runs Go linters and validates that all generated code is committed.
validate-go-code: tidy generate lint-go no-changes
no-changes:
@if [ -n "$$(git status --porcelain)" ]; then \
git status --porcelain; \
git --no-pager diff; \
echo "Encountered dirty repo!"; \
exit 1; \
fi
#cut a new version for release with items in docs/docs
gen-docs-release:
if [ -z ${version} ]; then \
echo "version not set (version=x.x)"; \
exit 1 \
;fi
docker run --rm --workdir=/docs -v $${PWD}/docs:/docs node:24-bookworm yarn docusaurus docs:version ${version}
# Completely remove doc version from docs site
remove-docs-version:
if [ -z ${version} ]; then \
echo "version not set (version=x.x)"; \
exit 1 \
;fi
echo "removing ${version} from documentation completely"
-rm "./docs/versioned_sidebars/version-${version}-sidebars.json"
-rm -r ./docs/versioned_docs/version-${version}
jq 'del(.[] | select(. == "${version}"))' ./docs/versions.json > tmp.json && mv tmp.json ./docs/versions.json
grep -v '"${version}": {label: "${version}", banner: "none", path: "${version}"},' ./docs/docusaurus.config.ts > tmp.config.ts && mv tmp.config.ts ./docs/docusaurus.config.ts
.PHONY: ui ui-user build all clean dev dev-open otel-jaeger-up otel-jaeger-down otel-jaeger-logs telepresence-setup lint lint-admin lint-api no-changes fmt tidy gen-docs-release deprecate-docs-release remove-docs-version