This repository was archived by the owner on Feb 18, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathMakefile
More file actions
82 lines (57 loc) · 3.02 KB
/
Makefile
File metadata and controls
82 lines (57 loc) · 3.02 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
all: format lint
-include .env
GS_REST_SERVICE_VERSIONM ?= "26.01.0"
GS_REST_SERVICE_VERSION ?= "1.17.0"
GS_REST_DEV_PORT ?= 9000
NUM_WORKERS ?= 1
NUM_THREADS ?= 1
test: install-dev
uv run pytest -x -rx -vv
test-regression:
@export SKIP_REST_CONTAINER_SETUP=True && uv run pytest -m "regression" -s
lint:
uv run ruff check .
format:
uv run ruff check --select I --fix
uv run ruff format
install-dev:
uv sync --all-extras --dev --force-reinstall
pre-commit:
uv run pre-commit run --all-files
serve-old:
uv run python -m aiohttp.web -H localhost -P ${GS_REST_DEV_PORT} gsrest:main
serve:
uv run adev runserver -p ${GS_REST_DEV_PORT} --root . --app-factory main gsrest/__init__.py
build-docker:
docker build -t graphsense-rest .
serve-docker:
docker run --rm -it --network='host' -e NUM_THREADS=1 -e NUM_WORKERS=1 -v "${PWD}/instance/config.yaml:/config.yaml:Z" -e CONFIG_FILE=/config.yaml graphsense-rest:latest
run-codegen: generate-python-client generate-openapi-server
generate-python-client: update-package-version
cd clients/python; make generate-openapi-client
generate-openapi-server: update-package-version
docker run --rm \
-v "${PWD}:/build:Z" \
-v "${PWD}/openapi_spec/templates:/templates" \
-v "${PWD}/openapi_spec/:/graphsense:Z" \
openapitools/openapi-generator-cli:v5.2.1 \
generate -i "/graphsense/graphsense.yaml" \
-g python-aiohttp \
-o /build \
-t /templates \
--additional-properties=packageVersion=$(GS_REST_SERVICE_VERSION)
yq -i 'del(.components.schemas.search_result_level1.example,.components.schemas.search_result_level2.example,.components.schemas.search_result_level3.example,.components.schemas.search_result_level4.example,.components.schemas.search_result_level5.example,.components.schemas.search_result_level6.example,.components.schemas.search_result_leaf.example)' openapi_server/openapi/openapi.yaml
run-designer:
docker run --rm -d -p 8080:8080 swaggerapi/swagger-editor
echo 'Designer UI is running on port 8080'
update-package-version: update-openapi-version
sed -i -r 's/(version = ).*/\1$(GS_REST_SERVICE_VERSION)/' pyproject.toml
sed -i -r 's/(version = ).*/\1$(GS_REST_SERVICE_VERSION)/' clients/python/pyproject.toml
update-openapi-version:
sed -i '/^info:/,/^ version:/s/^\(\s*version:\s*\).*/\1$(GS_REST_SERVICE_VERSION)/' openapi_spec/graphsense.yaml
ensure-versions-alignment:
python scripts/ensure_versions_alignment.py
tag-version: ensure-versions-alignment
-git diff --exit-code && git diff --staged --exit-code && git tag -a v$(GS_REST_SERVICE_VERSIONM) -m 'Release v$(GS_REST_SERVICE_VERSION)' || (echo "Repo is dirty please commit first" && exit 1)
git diff --exit-code && git diff --staged --exit-code && git tag -a v$(GS_REST_SERVICE_VERSION) -m 'Release v$(GS_REST_SERVICE_VERSION)' || (echo "Repo is dirty please commit first" && exit 1)
.PHONY: format lint test test-all-env ensure-versions-alignment run-codegen serve generate-openapi-server get-openapi-spec-from-upstream serve-docker pre-commit install-dev update-openapi-version tag-version generate-python-client