-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMakefile
More file actions
167 lines (126 loc) · 4.25 KB
/
Makefile
File metadata and controls
167 lines (126 loc) · 4.25 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
.PHONY: build release test fmt fmt-check clippy check clean docker-build docker-run \
release-patch release-minor release-major github-release \
publish publish-dry-run bench bench-core bench-protocol bench-compare bench-quick \
helm-lint helm-template proto-gen proto-go proto-py proto-ts \
cluster cluster-stop cluster-status cluster-clean
# extract the workspace version from the root Cargo.toml
VERSION = $(shell sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml)
build:
cargo build
release:
cargo build --release
test:
cargo test --workspace --features protobuf,grpc -- --test-threads=1
fmt:
cargo fmt --all
fmt-check:
cargo fmt --all --check
clippy:
cargo clippy --workspace --features protobuf,grpc -- -D warnings
check: fmt-check clippy test
clean:
cargo clean
docker-build:
docker build -t ember:latest .
docker-run: docker-build
docker run --rm -p 6379:6379 ember:latest
cluster: ## start a 3-node local dev cluster (ports 6379–6381)
@bash scripts/dev-cluster.sh start
cluster-stop: ## stop the local dev cluster
@bash scripts/dev-cluster.sh stop
cluster-status: ## show cluster health
@bash scripts/dev-cluster.sh status
cluster-clean: ## stop cluster and remove all data
@bash scripts/dev-cluster.sh clean
bench:
cargo bench --workspace
bench-core:
cargo bench -p emberkv-core
bench-protocol:
cargo bench -p ember-protocol
bench-compare:
cargo build --release -p ember-server --features jemalloc
bash bench/bench.sh
bench-quick:
cargo build --release -p ember-server --features jemalloc
bash bench/bench-quick.sh
bench-memory:
cargo build --release -p ember-server --features jemalloc
bash bench/bench-memory.sh
bench-full:
cargo build --release -p ember-server --features jemalloc
bash bench/compare-redis.sh
# --- versioning & releases ---
#
# usage:
# make release-patch # 0.1.0 -> 0.1.1
# make release-minor # 0.1.0 -> 0.2.0
# make release-major # 0.1.0 -> 1.0.0
# make github-release # create a github release for the current version
define do-release
@echo "bumping version: $(VERSION) -> $(1)"
@sed -i '' 's/^version = "$(VERSION)"/version = "$(1)"/' Cargo.toml
@$(MAKE) check
git add Cargo.toml Cargo.lock
git commit -m "release: v$(1)"
git tag -a "v$(1)" -m "v$(1)"
@echo ""
@echo "tagged v$(1). push with:"
@echo " git push && git push --tags"
endef
release-patch:
$(eval V := $(subst ., ,$(VERSION)))
$(call do-release,$(word 1,$(V)).$(word 2,$(V)).$(shell expr $(word 3,$(V)) + 1))
release-minor:
$(eval V := $(subst ., ,$(VERSION)))
$(call do-release,$(word 1,$(V)).$(shell expr $(word 2,$(V)) + 1).0)
release-major:
$(eval V := $(subst ., ,$(VERSION)))
$(call do-release,$(shell expr $(word 1,$(V)) + 1).0.0)
github-release:
gh release create "v$(VERSION)" --title "v$(VERSION)" --generate-notes
# --- crates.io publishing ---
#
# usage:
# make publish-dry-run # verify all crates can be packaged
# make publish # publish all crates to crates.io (requires login)
#
# crates are published in dependency order:
# 1. ember-persistence, ember-protocol, ember-cluster (no internal deps)
# 2. emberkv-core (depends on persistence, protocol)
# 3. ember-server (depends on core, protocol, persistence)
# 4. emberkv-cli (standalone)
CRATES_ORDER = ember-persistence ember-protocol ember-cluster emberkv-core ember-server emberkv-cli
publish-dry-run:
@echo "dry run: checking all crates can be packaged..."
@for crate in $(CRATES_ORDER); do \
echo " checking $$crate..."; \
cargo publish --dry-run -p $$crate || exit 1; \
done
@echo "all crates passed dry run"
publish:
@echo "publishing crates to crates.io..."
@echo "note: each crate needs time to index before dependents can be published"
@for crate in $(CRATES_ORDER); do \
echo ""; \
echo "publishing $$crate..."; \
cargo publish -p $$crate || exit 1; \
echo "waiting for crates.io to index $$crate..."; \
sleep 30; \
done
@echo ""
@echo "all crates published successfully"
# --- proto ---
proto-gen:
cargo build -p ember-server --features grpc
proto-go:
cd clients/ember-go && $(MAKE) proto-gen
proto-py:
cd clients/ember-py && $(MAKE) proto-gen
proto-ts:
cd clients/ember-ts && $(MAKE) proto-gen
# --- helm ---
helm-lint:
helm lint helm/ember
helm-template:
helm template ember helm/ember