PROJECT_DIR := $(patsubst %/,%,$(dir $(abspath $(lastword $(MAKEFILE_LIST)))))
ifdef PYTHON_VERSION
export UV_PYTHON ?= $(PYTHON_VERSION)
endif
ifeq ($(OS),Windows_NT)
SHELL := bash.exe
endif
.PHONY: ut st test prepare build start dataagent api web tui deploy check-codespell
TEST_RUNNER := uv run --no-project python scripts/run_product_tests.py
TIER ?= test
ifeq ($(strip $(value UV_RUN_OPTS)),)
TEST_SYNC_OPTION :=
else ifeq ($(strip $(value UV_RUN_OPTS)),--no-sync)
TEST_SYNC_OPTION := --no-sync
else
TEST_SYNC_OPTION = $(error UV_RUN_OPTS only accepts --no-sync)
endif
override PYTEST_ARGS := $(value PYTEST_ARGS)
override NODE_TEST_ARGS := $(value NODE_TEST_ARGS)
quote = '$(subst ','"'"',$(1))'
ut st test:
cd "$(PROJECT_DIR)" && $(TEST_RUNNER) --tier $(if $(filter ut st,$@),$@,$(TIER)) $(if $(SCOPE),--scope "$(SCOPE)") --pytest-args=$(call quote,$(PYTEST_ARGS)) --node-test-args=$(call quote,$(NODE_TEST_ARGS)) $(TEST_SYNC_OPTION)
prepare:
cd "$(PROJECT_DIR)" && npm install --include=dev && uv sync --no-dev
build:
cd "$(PROJECT_DIR)" && \
uv build --project . --wheel --clear --out-dir dist/server && \
npm run build && node scripts/package-tui.mjs
start:
cd "$(PROJECT_DIR)" && ./deploy.sh start
dataagent api web tui deploy:
cd "$(PROJECT_DIR)" && $(TEST_RUNNER) --tier $(TIER) --scope $@ --pytest-args=$(call quote,$(PYTEST_ARGS)) --node-test-args=$(call quote,$(NODE_TEST_ARGS)) $(TEST_SYNC_OPTION)
check-codespell:
@cd "$(PROJECT_DIR)" && codespell