-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMakefile
More file actions
200 lines (152 loc) · 6.66 KB
/
Copy pathMakefile
File metadata and controls
200 lines (152 loc) · 6.66 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
SRC_DIRS = src/quickapp src/scripts src/tests
MYPY_DIRS = src/quickapp src/scripts
FILES ?= $(SRC_DIRS)
POETRY ?= poetry
PYTHON ?= python3
WORKERS ?= 4
# Any non-empty CI value (even 'false' or '0') means that CI is enabled
CI ?=
-include .env
export
# AI DIAL SDK: pydantic v2 mode
export PYDANTIC_V2=True
.PHONY: init_venv install install_dev install_integration install_all clean \
lint mypy format install_pre_commit_hooks run_chat run_error_injection_app test test_cov \
dump_app_schema dump_internal_tools dump_config_support_openapi generate_dial_config generate_certs start_test_server stop_test_server \
integration_test integration_test_run integration_test_ci integration_test_all print-integration-test-models \
e2e_test run_python \
black black_check isort isort_check autoflake autoflake_check flake8
init_venv:
$(if $(CI),,$(POETRY) env use $(PYTHON))
install: init_venv
$(POETRY) install
install_dev: init_venv
$(POETRY) install --with dev
install_integration: init_venv
$(POETRY) install --with integration
install_all: init_venv
$(POETRY) install --with dev,integration
clean:
-$(POETRY) run python -m src.scripts.clean
-$(POETRY) env remove --all
# --- Linting ---
lint: install_dev
$(POETRY) check --lock
$(POETRY) run flake8 $(SRC_DIRS)
$(POETRY) run black $(SRC_DIRS) --check
$(POETRY) run isort $(SRC_DIRS) --check-only --diff
$(POETRY) run autoflake $(SRC_DIRS) --check
$(POETRY) run mypy --show-error-codes $(MYPY_DIRS)
ENABLE_PREVIEW_FEATURES=true $(POETRY) run python src/scripts/dump_app_schema.py docs/generated-app-schema.json --check
ENABLE_PREVIEW_FEATURES=true $(POETRY) run python src/scripts/dump_internal_tools.py docs/generated-internal-tools.json --check
ENABLE_PREVIEW_FEATURES=true $(POETRY) run python src/scripts/dump_config_support_openapi.py docs/generated-config-support-openapi.json --check
mypy: install_dev
$(POETRY) run mypy --show-error-codes $(MYPY_DIRS)
# --- Formatting ---
format: install_dev
$(POETRY) run autoflake $(FILES)
$(POETRY) run black $(FILES)
$(POETRY) run isort $(FILES)
ifeq ($(FILES), $(SRC_DIRS))
ENABLE_PREVIEW_FEATURES=true $(POETRY) run python src/scripts/dump_app_schema.py docs/generated-app-schema.json
ENABLE_PREVIEW_FEATURES=true $(POETRY) run python src/scripts/dump_internal_tools.py docs/generated-internal-tools.json
ENABLE_PREVIEW_FEATURES=true $(POETRY) run python src/scripts/dump_config_support_openapi.py docs/generated-config-support-openapi.json
endif
# --- Individual tool targets (honor FILES variable) ---
black: install_dev
$(POETRY) run black $(FILES)
black_check: install_dev
$(POETRY) run black $(FILES) --check
isort: install_dev
$(POETRY) run isort $(FILES)
isort_check: install_dev
$(POETRY) run isort $(FILES) --check-only --diff
autoflake: install_dev
$(POETRY) run autoflake $(FILES)
autoflake_check: install_dev
$(POETRY) run autoflake $(FILES) --check
flake8: install_dev
$(POETRY) run flake8 $(FILES)
# --- Running ---
install_pre_commit_hooks:
pre-commit install
run_chat: install_dev
$(POETRY) run python src/quickapp/app.py
# Error-injection sample model for testing QuickApps error handling end-to-end.
# Listens on :5002; Core reaches it via host.docker.internal (see docker-compose.yml).
# Override host/port with ERROR_INJECTION_APP_HOST / ERROR_INJECTION_APP_PORT.
run_error_injection_app: install_dev
$(POETRY) run python src/tests/sample_apps/error_injection_app/error_injection_app.py
run_python: install_dev
$(if $(SCRIPT),,$(error SCRIPT is required, e.g. make run_python SCRIPT=path/to/script.py))
$(POETRY) run python $(SCRIPT)
# --- Testing ---
PYTEST_UNIT = $(POETRY) run pytest src/tests/unit_tests -m "not integration and not e2e"
test: install_dev
$(PYTEST_UNIT) --junitxml=reports/tests-unit.xml $(ARGS)
test_cov: install_dev
$(PYTEST_UNIT) --cov=src/quickapp --cov-report=term-missing $(ARGS)
dump_app_schema: install_dev
ENABLE_PREVIEW_FEATURES=true $(POETRY) run python src/scripts/dump_app_schema.py docs/generated-app-schema.json
dump_internal_tools: install_dev
ENABLE_PREVIEW_FEATURES=true $(POETRY) run python src/scripts/dump_internal_tools.py docs/generated-internal-tools.json
dump_config_support_openapi: install_dev
ENABLE_PREVIEW_FEATURES=true $(POETRY) run python src/scripts/dump_config_support_openapi.py docs/generated-config-support-openapi.json
generate_dial_config: install_dev
$(POETRY) run python src/scripts/generate_dial_config.py --models \
--template docker_compose_files/core/configuration/models-template.json \
--config docker_compose_files/core/configuration/generated/models.json \
--applications dial-rag,dial-web-rag
# TLS certificate for the local Keycloak used by the docker-compose stack.
generate_certs:
./docker_compose_files/keycloak/generate-certs.sh
start_test_server: stop_test_server
echo "Starting MCP + REST servers..."
$(POETRY) run python src/tests/integration_tests/data_server_for_tests.py & echo $$! > .mcp_rest_server.pid
sleep 1
echo "Servers started with PID `cat .mcp_rest_server.pid`"
stop_test_server:
@$(POETRY) run python src/tests/integration_tests/stop_data_server_for_tests.py stop || true
# Canonical integration-test matrix (one per provider family). Update when DIAL deployments change.
INTEGRATION_TEST_MODELS ?= \
gemini-3.5-flash \
gpt-5.5-2026-04-24 \
anthropic.claude-opus-4-6-v1
# Filesystem-safe JUnit report suffix (Claude deployment IDs may contain ':').
MODEL_REPORT_SUFFIX = $(subst /,-,$(subst :,-,$(MODEL)))
INTEGRATION_PYTEST = ENABLE_PREVIEW_FEATURES=true $(POETRY) run pytest -n $(or ${WORKERS},logical) \
src/tests/integration_tests --model=$(MODEL) \
--junitxml=reports/tests-integration-$(MODEL_REPORT_SUFFIX).xml \
-m "integration" $(ARGS)
print-integration-test-models:
@printf '%s\n' $(INTEGRATION_TEST_MODELS)
integration_test: install_integration
$(MAKE) start_test_server
@status=0; \
$(INTEGRATION_PYTEST) || status=$$?; \
$(MAKE) stop_test_server; \
exit $$status
integration_test_run:
$(INTEGRATION_PYTEST)
integration_test_ci:
ifndef MODEL
$(error MODEL is required, e.g. make integration_test_ci MODEL=gemini-2.5-pro)
endif
$(MAKE) integration_test MODEL=$(MODEL)
integration_test_all: install_integration
$(MAKE) start_test_server
@failed=""; \
for model in $(INTEGRATION_TEST_MODELS); do \
echo "=== Integration tests: $$model ==="; \
if ! $(MAKE) integration_test_run MODEL="$$model"; then \
echo "=== FAILED: $$model ==="; \
failed="$$failed $$model"; \
fi; \
done; \
$(MAKE) stop_test_server; \
if [ -n "$$failed" ]; then \
echo "Integration tests failed for:$$failed"; \
exit 1; \
fi
e2e_test: install_integration
ENABLE_PREVIEW_FEATURES=true $(POETRY) run pytest -n $(or ${WORKERS},logical) --no-cache --junitxml=reports/tests-e2e.xml -m "e2e" $(ARGS)