-
Notifications
You must be signed in to change notification settings - Fork 149
Expand file tree
/
Copy pathMakefile
More file actions
183 lines (158 loc) · 7.67 KB
/
Makefile
File metadata and controls
183 lines (158 loc) · 7.67 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
.PHONY: help check-uv dev-setup test-setup test test-all test-eval test-eval-local test-eval-workflow test-eval-remote test-unit test-integration test-migrations clean ui-test ui-build ui-lint install-playwright
# Check if uv is installed
check-uv:
@which uv > /dev/null || (echo "Error: 'uv' is not installed. Install it with: curl -LsSf https://astral.sh/uv/install.sh | sh" && exit 1)
# Default target
help:
@echo "Solace Agent Mesh - Dev Commands"
@echo ""
@echo "Setup:"
@echo " make dev-setup Set up development environment with Python 3.12"
@echo " make test-setup Install all test dependencies (mirrors CI setup)"
@echo " make install-playwright Install Playwright browsers"
@echo ""
@echo "Backend Tests:"
@echo " make test Run all tests (excluding stress/long_soak)"
@echo " make test-all Run all tests including stress and evaluation tests"
@echo " make test-eval Run local evaluation tests (default)"
@echo " make test-eval-local Run local evaluation tests"
@echo " make test-eval-workflow Run workflow evaluation tests"
@echo " make test-eval-remote Run remote evaluation tests"
@echo " make test-unit Run unit tests only"
@echo " make test-integration Run integration tests only"
@echo " make test-migrations Run database migration tests (SQLite, MySQL, PostgreSQL)"
@echo ""
@echo "Frontend Tests:"
@echo " make ui-test Run frontend linting and build"
@echo " make ui-lint Run frontend linting only"
@echo " make ui-build Build frontend packages"
@echo ""
@echo "Cleanup:"
@echo " make clean Clean up test artifacts and cache"
@echo ""
# Set up development environment
dev-setup: check-uv
@echo "Setting up development environment..."
UV_VENV_CLEAR=1 uv venv --python 3.12
@echo "Syncing dependencies with all extras..."
uv sync --all-extras
@echo "Installing test infrastructure..."
uv pip install -e tests/sam-test-infrastructure
@echo "Installing Playwright browsers..."
uv run playwright install
@echo "Development environment setup complete!"
@echo "To activate the virtual environment, run: source .venv/bin/activate"
# Setup test environment
test-setup: check-uv
@echo "Installing test dependencies..."
uv pip install -e ".[gcs,vertex,employee_tools,test]"
uv pip install -e tests/sam-test-infrastructure
@echo "Installing Playwright browsers..."
uv run playwright install
@echo "Test environment setup complete!"
# Setup eval environment
# Note: Uses wheel build instead of editable install because hatchling's editable mode
# doesn't support force-include for cli/, evaluation/, etc. directories outside src/
eval-setup: check-uv
@echo "Setting up evaluation test environment..."
UV_VENV_CLEAR=1 uv venv --python 3.12
@echo "Building wheel directly (skipping UI builds and sdist for speed)..."
SAM_SKIP_UI_BUILD=true uv build --wheel
@echo "Installing Solace Agent Mesh from wheel..."
uv pip install "$$(ls dist/solace_agent_mesh-*.whl | head -1)" --reinstall
@echo "Installing sam-rest-gateway plugin for local evaluations..."
uv pip install "sam-rest-gateway @ git+https://github.com/SolaceLabs/solace-agent-mesh-core-plugins#subdirectory=sam-rest-gateway"
@echo "Installing Playwright browsers..."
.venv/bin/playwright install
# Install Playwright browsers only
install-playwright: check-uv
@echo "Installing Playwright browsers..."
uv run playwright install
# Run tests excluding stress and long_soak (default for development)
test:
@echo "Running tests (excluding stress and long_soak)..."
uv run pytest -m "not stress and not long_soak"
# Run all tests
test-all:
@echo "Running all tests..."
uv run pytest
# Helper target to validate required environment variables
check-eval-env:
@echo "Validating required environment variables..."
@test -n "$(SOLACE_BROKER_URL)" || (echo "ERROR: SOLACE_BROKER_URL not set. Export it before running make" && exit 1)
@test -n "$(SOLACE_BROKER_USERNAME)" || (echo "ERROR: SOLACE_BROKER_USERNAME not set. Export it before running make" && exit 1)
@test -n "$(SOLACE_BROKER_PASSWORD)" || (echo "ERROR: SOLACE_BROKER_PASSWORD not set. Export it before running make" && exit 1)
@test -n "$(SOLACE_BROKER_VPN)" || (echo "ERROR: SOLACE_BROKER_VPN not set. Export it before running make" && exit 1)
@test -n "$(LLM_SERVICE_ENDPOINT)" || (echo "ERROR: LLM_SERVICE_ENDPOINT not set. Export it before running make" && exit 1)
@test -n "$(LLM_SERVICE_API_KEY)" || (echo "ERROR: LLM_SERVICE_API_KEY not set. Export it before running make" && exit 1)
@echo "✓ All required environment variables are set"
check-remote-eval-env:
@echo "Validating required environment variables..."
@test -n "$(EVAL_REMOTE_URL)" || (echo "ERROR: EVAL_REMOTE_URL not set. Export it before running make" && exit 1)
@test -n "$(EVAL_NAMESPACE)" || (echo "ERROR: EVAL_NAMESPACE not set. Export it before running make" && exit 1)
@test -n "$(EVAL_AUTH_TOKEN)" || (echo "ERROR: EVAL_AUTH_TOKEN not set. Export it before running make" && exit 1)
@echo "✓ All required remote environment variables are set"
# Define env vars to pass through to eval commands
EVAL_ENV_VARS = SOLACE_BROKER_URL="$(SOLACE_BROKER_URL)" \
SOLACE_BROKER_USERNAME="$(SOLACE_BROKER_USERNAME)" \
SOLACE_BROKER_PASSWORD="$(SOLACE_BROKER_PASSWORD)" \
SOLACE_BROKER_VPN="$(SOLACE_BROKER_VPN)" \
LLM_SERVICE_ENDPOINT="$(LLM_SERVICE_ENDPOINT)" \
LLM_SERVICE_API_KEY="$(LLM_SERVICE_API_KEY)"
# Define env vars to pass through to eval commands
REMOTE_EVAL_ENV_VARS = EVAL_REMOTE_URL="$(EVAL_REMOTE_URL)" \
EVAL_NAMESPACE="$(EVAL_NAMESPACE)" \
EVAL_AUTH_TOKEN="$(EVAL_AUTH_TOKEN)"
# Run evaluation tests (default: local)
test-eval: test-eval-local
# Run local evaluation tests
test-eval-local: eval-setup check-eval-env
@echo "Running local evaluation tests..."
@echo ""
$(EVAL_ENV_VARS) .venv/bin/sam eval tests/evaluation/local_example.json -v
# Run workflow evaluation tests
test-eval-workflow: eval-setup check-eval-env
@echo "Running workflow evaluation tests..."
@echo ""
$(EVAL_ENV_VARS) .venv/bin/sam eval tests/evaluation/workflow_eval.json
# Run remote evaluation tests
test-eval-remote: eval-setup check-eval-env check-remote-eval-env
@echo "Running remote evaluation tests..."
@echo ""
$(EVAL_ENV_VARS) $(REMOTE_EVAL_ENV_VARS) .venv/bin/sam eval tests/evaluation/remote_example.json -v
# Run unit tests only
test-unit:
@echo "Running unit tests..."
uv run pytest tests/unit -v
# Run integration tests only
test-integration:
@echo "Running integration tests..."
uv run pytest tests/integration -v
# Run database migration tests (auto-installs deps, auto-manages containers)
test-migrations: check-uv
@echo "Installing migration test dependencies..."
@uv pip install pytest testcontainers[postgres] testcontainers[mysql] pymysql psycopg2-binary alembic 2>/dev/null || true
@echo ""
@echo "Running migration tests (containers start automatically)..."
@echo "Testing: SQLite, MySQL, PostgreSQL"
@echo ""
PYTHONPATH=. uv run pytest tests/integration/migrations/ -v -x
# Frontend linting (mirrors ui-ci.yml)
ui-lint:
@echo "Running frontend linting..."
cd client/webui/frontend && npm run lint
# Build frontend packages (mirrors ui-ci.yml)
ui-build:
@echo "Building frontend packages..."
cd client/webui/frontend && npm run build-package
cd client/webui/frontend && npm run build-storybook
# Run frontend tests (lint + build)
ui-test: ui-lint ui-build
@echo "Frontend tests completed!"
# Clean up test artifacts
clean:
@echo "Cleaning up test artifacts..."
find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
find . -type d -name .pytest_cache -exec rm -rf {} + 2>/dev/null || true
find . -type f -name '*.pyc' -delete 2>/dev/null || true
@echo "Cleanup complete!"