forked from databendlabs/databend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
168 lines (130 loc) · 5.62 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
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
HUB ?= datafuselabs
TAG ?= latest
PLATFORM ?= linux/amd64,linux/arm64
VERSION ?= latest
ADD_NODES ?= 0
NUM_CPUS ?= 2
TENANT_ID ?= "tenant"
CLUSTER_ID ?= "test"
# yamllint vars
YAML_FILES ?= $(shell find . -path ./target -prune -type f -name '*.yaml' -or -name '*.yml')
YAML_DOCKER_ARGS ?= run --rm --user "$$(id -u)" -v "$${PWD}:/component" --workdir /component
YAMLLINT_ARGS ?= --no-warnings
YAMLLINT_CONFIG ?= .yamllint.yml
YAMLLINT_IMAGE ?= docker.io/cytopia/yamllint:latest
YAMLLINT_DOCKER ?= docker $(YAML_DOCKER_ARGS) $(YAMLLINT_IMAGE)
CARGO_TARGET_DIR ?= $(CURDIR)/target
# Setup dev toolchain
setup:
bash ./scripts/setup/dev_setup.sh
fmt:
cargo fmt
lint:
cargo fmt
cargo clippy --tests -- -D warnings
# Python file formatter(make setup to install)
yapf -ri tests/
# Bash file formatter(make setup to install)
shfmt -l -w scripts/*
lint-yaml: $(YAML_FILES)
$(YAMLLINT_DOCKER) -f parsable -c $(YAMLLINT_CONFIG) $(YAMLLINT_ARGS) -- $?
miri:
cargo miri setup
MIRIFLAGS="-Zmiri-disable-isolation" cargo miri test
run: build
bash ./scripts/deploy/databend-query-standalone.sh release
run-debug: build-debug
bash ./scripts/deploy/databend-query-standalone.sh
build:
bash ./scripts/build/build-release.sh
ifeq ($(shell uname),Linux) # Macs don't have objcopy
# Reduce binary size by compressing binaries.
objcopy --compress-debug-sections=zlib-gnu ${CARGO_TARGET_DIR}/release/databend-query
objcopy --compress-debug-sections=zlib-gnu ${CARGO_TARGET_DIR}/release/databend-benchmark
objcopy --compress-debug-sections=zlib-gnu ${CARGO_TARGET_DIR}/release/databend-meta
endif
build-native:
bash ./scripts/build/build-native.sh
build-debug:
bash ./scripts/build/build-debug.sh
cross-compile-debug:
cross build --target aarch64-unknown-linux-gnu
cross-compile-release:
RUSTFLAGS="-C link-arg=-Wl,--compress-debug-sections=zlib-gabi" cross build --target aarch64-unknown-linux-gnu --release
cli-build:
bash ./scripts/build/build-cli.sh build-cli
ifeq ($(shell uname),Linux) # Macs don't have objcopy
# Reduce binary size by compressing binaries.
objcopy --compress-debug-sections=zlib-gnu ${CARGO_TARGET_DIR}/release/bendctl
endif
cli-build-debug:
bash ./scripts/build/build-cli.sh build-cli-debug
cli-install:
bash ./scripts/build/build-cli.sh install-cli
cli-test:
bash ./scripts/ci/ci-run-cli-unit-tests.sh
unit-test:
ulimit -n 10000;ulimit -s 16384; bash ./scripts/ci/ci-run-unit-tests.sh
# Bendctl with cluster for stateful test.
cluster: build cli-build
mkdir -p ./.databend/local/bin/test/ && mkdir ./.databend/local/configs/local/ && make cluster_stop || echo "stop"
cp ./target/release/databend-query ./.databend/local/bin/test/databend-query
cp ./target/release/databend-meta ./.databend/local/bin/test/databend-meta
./target/release/bendctl cluster create --databend_dir ./.databend --group local --version test --num-cpus ${NUM_CPUS} --query-tenant-id ${TENANT_ID} --query-cluster-id ${CLUSTER_ID} --force
for i in `seq 1 ${ADD_NODES}`; do make cluster_add; done;
make cluster_view
cluster_add:
./target/release/bendctl cluster add --databend_dir ./.databend --group local --num-cpus ${NUM_CPUS}
cluster_view:
./target/release/bendctl cluster view --databend_dir ./.databend --group local
cluster_stop:
@if find ./.databend/local/configs/local/ -maxdepth 0 -empty | read v ; then echo there is no cluster exists; else ./target/release/bendctl cluster stop --databend_dir ./.databend --group local; fi
embedded-meta-test: build-debug
rm -rf ./_meta_embedded*
bash ./scripts/ci/ci-run-tests-embedded-meta.sh
stateless-test: build-debug
rm -rf ./_meta*/
ulimit -n 10000;ulimit -s 16384; bash ./scripts/ci/ci-run-stateless-tests-standalone.sh
stateful-ctl-test:
rm -rf ./_meta*/
rm -rf ./.databend/
ulimit -n 10000;ulimit -s 16384; bash ./scripts/ci/ci-run-stateful-tests-standalone-ctl.sh
stateful-ctl-cluster-test:
rm -rf ./_meta*/
rm -rf ./.databend/
bash ./scripts/ci/ci-run-stateful-tests-cluster-ctl.sh
stateless-cluster-test: build-debug
rm -rf ./_meta*/
bash ./scripts/ci/ci-run-stateless-tests-cluster.sh
stateless-cluster-test-tls: build-debug
rm -rf ./_meta*/
bash ./scripts/ci/ci-run-stateless-tests-cluster-tls.sh
test: unit-test stateless-test
docker:
docker build --network host -f docker/Dockerfile -t ${HUB}/databend-query:${TAG} .
k8s-docker:
bash ./scripts/build/build-k8s-runner.sh
docker_release:
docker buildx build . -f ./docker/release/Dockerfile --platform ${PLATFORM} --allow network.host --builder host -t ${HUB}/databend:${TAG} --build-arg VERSION=${VERSION} --push
# experiment feature: take a look at docker/README.md for detailed multi architecture image build support
dockerx:
docker buildx build . -f ./docker/Dockerfile --platform ${PLATFORM} --allow network.host --builder host -t ${HUB}/databend-query:${TAG} --build-arg VERSION=${VERSION} --push
build-tool:
bash ./scripts/build/build-tool-runner.sh
build-perf-tool:
cargo build --target x86_64-unknown-linux-gnu --bin databend-benchmark
mkdir -p ./distro
mv ./target/x86_64-unknown-linux-gnu/debug/databend-benchmark ./distro
# generate common/functions/src/scalars/arithmetics/result_type.rs
run-codegen:
cargo run --manifest-path=common/codegen/Cargo.toml
perf-tool: build-perf-tool
docker buildx build . -f ./docker/perf-tool/Dockerfile --platform linux/amd64 --allow network.host --builder host -t ${HUB}/perf-tool:${TAG} --push
profile:
bash ./scripts/ci/ci-run-profile.sh
clean:
cargo clean
rm -f ./nohup.out ./tests/suites/0_stateless/*.stdout-e
rm -rf ./_meta*/ ./_logs/ ./query/_logs/ ./metasrv/_logs/
rm -rf ./common/base/_logs/ ./common/meta/raft-store/_logs/ ./common/meta/sled-store/_logs/
.PHONY: setup test run build fmt lint docker clean