-
Notifications
You must be signed in to change notification settings - Fork 68
Expand file tree
/
Copy pathMakefile
More file actions
246 lines (184 loc) · 7.14 KB
/
Makefile
File metadata and controls
246 lines (184 loc) · 7.14 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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
RUST_READTHEDOCS_DOCS_TARGET=docs/source/_rustdoc
###########
# General #
###########
print-version: # this is used by the CI, don't change
@cargo metadata --no-deps --format-version 1 | jq -r '.packages[0].version'
build-all: rust-build
cd python && maturin develop
test-all: rust-test-all python-test
# Tidying
tidy: rust-fmt build-python stubs python-fmt
python-tidy: stubs python-fmt test-graphql-schema
check-pr: tidy test-all
gen-graphql-schema:
raphtory schema > raphtory-graphql/schema.graphql
test-graphql-schema: install-node-tools
npx graphql-schema-linter --rules fields-have-descriptions,types-have-descriptions raphtory-graphql/schema.graphql
# Utilities
activate-storage:
./scripts/activate_private_storage.py
deactivate-storage:
./scripts/deactivate_private_storage.py
pull-storage: activate-storage
git submodule update --init --recursive pometry-storage-private
update-ui-tests:
rm -rf ui-tests
git clone [email protected]:Pometry/ui-tests.git ui-tests
rm -rf ui-tests/.git
install-node-tools:
@if command -v npx >/dev/null 2>&1; then \
echo "npx is already installed."; \
else \
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash && nvm install node; \
fi
########
# Rust #
########
rust-fmt:
cargo +nightly fmt
rust-build:
cargo build -q
rust-build-docs:
cargo doc --no-deps -p raphtory -q
run-graphql:
cargo run --release -p raphtory-graphql
# Testing
rust-test:
cargo test -q
rust-check:
cargo hack check --workspace --all-targets --each-feature --skip extension-module,default
rust-test-all: rust-check
cargo nextest run --all
##########
# Python #
##########
build-wheel:
cd python && maturin build
clean:
cargo clean
install-python: build-wheel
pip install target/wheels/*.whl
build-python:
cd python && maturin develop -r --extras=dev
debug-python:
cd python && maturin develop --profile=dev --extras=dev
# Testing
python-test:
cd python && tox run
python-fmt:
cd python && black .
build-python-rtd:
cd python && maturin build --profile=build-fast && pip install ../target/wheels/*.whl
########
# Docs #
########
install-mkdocs:
pip install mkdocs
install-doc-deps:
pip install -r docs/requirements.txt
install-stub-gen:
python -mpip install -e stub_gen
stubs: install-stub-gen
cd python && ./scripts/gen-stubs.py && mypy -m raphtory
debug-stubs: debug-python stubs
gen-py-doc-pages: install-doc-deps
python docs/scripts/gen_docs_pages.py
gen-graphql-doc-pages: install-node-tools gen-graphql-schema
python docs/scripts/gen_docs_graphql_pages.py
clean-doc-pages:
rm -rf docs/reference && rm -rf docs/tmp/saved_graph
python-docs-serve: install-doc-deps
mkdocs serve
python-docs-build: install-doc-deps
mkdocs build
# Testing
run-docs-tests: install-doc-deps clean-doc-pages
cd docs/user-guide && \
pytest --markdown-docs -m markdown-docs --markdown-docs-syntax=superfences
##########
# Docker #
##########
WORKING_DIR ?= /tmp/graphs
PORT ?= 1736
PACKAGE_VERSION := $(shell grep -m 1 '^version' Cargo.toml | sed 's/version = "\(.*\)"/\1/')
RUST_VERSION := $(shell grep -m 1 '^rust-version' Cargo.toml | sed 's/rust-version = "\(.*\)"/\1/')
print-versions:
@echo "Package Version: $(PACKAGE_VERSION)"
@echo "Rust Version: $(RUST_VERSION)"
BASE_IMAGE_NAME_AMD64 := pometry/raphtory_base:$(RUST_VERSION)-amd64
BASE_IMAGE_NAME_ARM64 := pometry/raphtory_base:$(RUST_VERSION)-arm64
IMAGE_NAME_AMD64 := pometry/raphtory:$(PACKAGE_VERSION)-rust-amd64
IMAGE_NAME_ARM64 := pometry/raphtory:$(PACKAGE_VERSION)-rust-arm64
PY_IMAGE_NAME_AMD64 := pometry/raphtory:$(PACKAGE_VERSION)-python-amd64
PY_IMAGE_NAME_ARM64 := pometry/raphtory:$(PACKAGE_VERSION)-python-arm64
docker-build-pyraphtory-base-amd64:
cd docker/base && docker build --platform linux/amd64 -t $(BASE_IMAGE_NAME_AMD64) .
docker-build-pyraphtory-base-arm64:
cd docker/base && docker build --platform linux/arm64 -t $(BASE_IMAGE_NAME_ARM64) .
docker-build-pyraphtory-amd64:
./scripts/deactivate_private_storage.py
docker build -f docker/dockerfile --build-arg BASE_IMAGE=$(BASE_IMAGE_NAME_AMD64) --platform linux/amd64 -t $(PY_IMAGE_NAME_AMD64) .
docker-build-pyraphtory-arm64:
./scripts/deactivate_private_storage.py
docker build -f docker/dockerfile --build-arg BASE_IMAGE=$(BASE_IMAGE_NAME_ARM64) --platform linux/arm64 -t $(PY_IMAGE_NAME_ARM64) .
docker-build-raphtory-amd64:
./scripts/deactivate_private_storage.py
docker build --platform linux/amd64 -t $(IMAGE_NAME_AMD64) .
docker-build-raphtory-arm64:
./scripts/deactivate_private_storage.py
docker build --platform linux/arm64 -t $(IMAGE_NAME_ARM64) .
# Docker run targets for pyraphtory
docker-run-pyraphtory-amd64:
docker run --rm -p $(PORT):$(PORT) \
-v $(WORKING_DIR):/tmp/graphs \
$(PY_IMAGE_NAME_AMD64) \
$(if $(WORKING_DIR),--working-dir=$(WORKING_DIR)) \
$(if $(PORT),--port=$(PORT)) \
$(if $(CACHE_CAPACITY),--cache-capacity=$(CACHE_CAPACITY)) \
$(if $(CACHE_TTI_SECONDS),--cache-tti-seconds=$(CACHE_TTI_SECONDS)) \
$(if $(LOG_LEVEL),--log-level=$(LOG_LEVEL)) \
$(if $(TRACING),--tracing) \
$(if $(OTLP_AGENT_HOST),--otlp-agent-host=$(OTLP_AGENT_HOST)) \
$(if $(OTLP_AGENT_PORT),--otlp-agent-port=$(OTLP_AGENT_PORT)) \
$(if $(OTLP_TRACING_SERVICE_NAME),--otlp-tracing-service-name=$(OTLP_TRACING_SERVICE_NAME))
docker-run-pyraphtory-arm64:
docker run --rm -p $(PORT):$(PORT) \
-v $(WORKING_DIR):/tmp/graphs \
$(PY_IMAGE_NAME_ARM64) \
$(if $(WORKING_DIR),--working-dir=$(WORKING_DIR)) \
$(if $(PORT),--port=$(PORT)) \
$(if $(CACHE_CAPACITY),--cache-capacity=$(CACHE_CAPACITY)) \
$(if $(CACHE_TTI_SECONDS),--cache-tti-seconds=$(CACHE_TTI_SECONDS)) \
$(if $(LOG_LEVEL),--log-level=$(LOG_LEVEL)) \
$(if $(TRACING),--tracing) \
$(if $(OTLP_AGENT_HOST),--otlp-agent-host=$(OTLP_AGENT_HOST)) \
$(if $(OTLP_AGENT_PORT),--otlp-agent-port=$(OTLP_AGENT_PORT)) \
$(if $(OTLP_TRACING_SERVICE_NAME),--otlp-tracing-service-name=$(OTLP_TRACING_SERVICE_NAME))
# Docker run targets for raphtory
docker-run-raphtory-amd64:
docker run --rm -p $(PORT):$(PORT) \
-v $(WORKING_DIR):/tmp/graphs \
$(IMAGE_NAME_AMD64) \
$(if $(WORKING_DIR),--working-dir=$(WORKING_DIR)) \
$(if $(PORT),--port=$(PORT)) \
$(if $(CACHE_CAPACITY),--cache-capacity=$(CACHE_CAPACITY)) \
$(if $(CACHE_TTI_SECONDS),--cache-tti-seconds=$(CACHE_TTI_SECONDS)) \
$(if $(LOG_LEVEL),--log-level=$(LOG_LEVEL)) \
$(if $(TRACING),--tracing) \
$(if $(OTLP_AGENT_HOST),--otlp-agent-host=$(OTLP_AGENT_HOST)) \
$(if $(OTLP_AGENT_PORT),--otlp-agent-port=$(OTLP_AGENT_PORT)) \
$(if $(OTLP_TRACING_SERVICE_NAME),--otlp-tracing-service-name=$(OTLP_TRACING_SERVICE_NAME))
docker-run-raphtory-arm64:
docker run --rm -p $(PORT):$(PORT) \
-v $(WORKING_DIR):/tmp/graphs \
$(IMAGE_NAME_ARM64) \
$(if $(WORKING_DIR),--working-dir=$(WORKING_DIR)) \
$(if $(PORT),--port=$(PORT)) \
$(if $(CACHE_CAPACITY),--cache-capacity=$(CACHE_CAPACITY)) \
$(if $(CACHE_TTI_SECONDS),--cache-tti-seconds=$(CACHE_TTI_SECONDS)) \
$(if $(LOG_LEVEL),--log-level=$(LOG_LEVEL)) \
$(if $(TRACING),--tracing) \
$(if $(OTLP_AGENT_HOST),--otlp-agent-host=$(OTLP_AGENT_HOST)) \
$(if $(OTLP_AGENT_PORT),--otlp-agent-port=$(OTLP_AGENT_PORT)) \
$(if $(OTLP_TRACING_SERVICE_NAME),--otlp-tracing-service-name=$(OTLP_TRACING_SERVICE_NAME))