Skip to content

Commit 1b4bfbd

Browse files
committed
✨ feat: enhance Makefile with parameterized testing and add dev server script
- Update Makefile to include new targets for unit and integration testing with specific app names - Introduce a dev server script for launching LangGraph applications with argument support - Improve help output in Makefile to document new parameterized targets This commit enhances the development workflow by allowing targeted testing and streamlined application development.
1 parent 4a7aebb commit 1b4bfbd

File tree

2 files changed

+104
-2
lines changed

2 files changed

+104
-2
lines changed

Makefile

Lines changed: 70 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: all format lint test test_integration lint_libs lint_apps format_libs format_apps test_libs test_apps test_integration_libs test_integration_apps help
1+
.PHONY: all format lint test test_integration lint_libs lint_apps format_libs format_apps test_libs test_apps test_integration_libs test_integration_apps unit integration dev help
22

33
# Default target executed when no arguments are given to make.
44
all: help
@@ -102,6 +102,69 @@ test_integration_libs:
102102
test_integration_apps:
103103
$(call run_integration_tests,apps)
104104

105+
######################
106+
# PARAMETERIZED TESTING
107+
######################
108+
109+
# Parameterized test targets that accept app names
110+
# Usage: make unit agent1, make integration agent1
111+
unit:
112+
@if [ -z "$(filter-out $@,$(MAKECMDGOALS))" ]; then \
113+
echo "Usage: make unit <app_name>"; \
114+
echo "Example: make unit sample-agent"; \
115+
exit 1; \
116+
fi
117+
@app_name=$(filter-out $@,$(MAKECMDGOALS)); \
118+
if [ -d "apps/$$app_name" ]; then \
119+
echo "Running unit tests for apps/$$app_name..."; \
120+
cd "apps/$$app_name" && uv run python -m pytest tests/unit/ -v; \
121+
else \
122+
echo "❌ App 'apps/$$app_name' not found"; \
123+
exit 1; \
124+
fi
125+
126+
integration:
127+
@if [ -z "$(filter-out $@,$(MAKECMDGOALS))" ]; then \
128+
echo "Usage: make integration <app_name>"; \
129+
echo "Example: make integration sample-agent"; \
130+
exit 1; \
131+
fi
132+
@app_name=$(filter-out $@,$(MAKECMDGOALS)); \
133+
if [ -d "apps/$$app_name" ]; then \
134+
echo "Running integration tests for apps/$$app_name..."; \
135+
cd "apps/$$app_name" && uv run python -m pytest tests/integration/ -v; \
136+
else \
137+
echo "❌ App 'apps/$$app_name' not found"; \
138+
exit 1; \
139+
fi
140+
141+
dev:
142+
@goals="$(filter-out $@,$(MAKECMDGOALS))"; \
143+
if [ -z "$$goals" ]; then \
144+
echo "Usage: make dev <app_name> [-- args...]"; \
145+
echo " or: ./scripts/dev.sh <app_name> [args...] (direct usage)"; \
146+
echo "Example: make dev sample-agent"; \
147+
echo "Example: make dev sample-agent -- --no-browser"; \
148+
echo "Example: make dev sample-agent -- --host 0.0.0.0 --port 3000"; \
149+
echo "Example: ./scripts/dev.sh sample-agent --no-browser"; \
150+
exit 1; \
151+
fi; \
152+
case "$$goals" in \
153+
*" -- "*) \
154+
app_name=$${goals%% -- *}; \
155+
dev_args=$${goals#* -- }; \
156+
./scripts/dev.sh $$app_name $$dev_args; \
157+
;; \
158+
*) \
159+
app_name="$$goals"; \
160+
./scripts/dev.sh $$app_name; \
161+
;; \
162+
esac
163+
164+
# Dummy targets to prevent make from complaining about unknown targets
165+
%:
166+
@:
167+
105168
######################
106169
# LINTING AND FORMATTING
107170
######################
@@ -148,4 +211,9 @@ help:
148211
@echo 'lint_libs - lint libs/ packages only'
149212
@echo 'lint_apps - lint apps/ packages only'
150213
@echo 'format_libs - format libs/ packages only'
151-
@echo 'format_apps - format apps/ packages only'
214+
@echo 'format_apps - format apps/ packages only'
215+
@echo ''
216+
@echo 'PARAMETERIZED TARGETS:'
217+
@echo 'make unit <app_name> - run unit tests for specific app (e.g., make unit sample-agent)'
218+
@echo 'make integration <app_name> - run integration tests for specific app (e.g., make integration agent1)'
219+
@echo 'make dev <app_name> [DEVARGS] - start LangGraph dev server (e.g., make dev agent1 DEVARGS=\"--no-browser\")'

scripts/dev.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/bash
2+
3+
# LangGraph dev server launcher with argument support
4+
# Usage: ./scripts/dev.sh <app_name> [args...]
5+
6+
set -e
7+
8+
if [ $# -eq 0 ]; then
9+
echo "Usage: ./scripts/dev.sh <app_name> [args...]"
10+
echo "Example: ./scripts/dev.sh agent1"
11+
echo "Example: ./scripts/dev.sh agent1 --port 8080"
12+
echo "Example: ./scripts/dev.sh agent1 --host 0.0.0.0 --port 3000 --no-browser"
13+
exit 1
14+
fi
15+
16+
app_name="$1"
17+
shift # Remove app_name from arguments, leaving the rest as langgraph dev args
18+
19+
if [ ! -d "apps/$app_name" ]; then
20+
echo "❌ App 'apps/$app_name' not found"
21+
exit 1
22+
fi
23+
24+
echo "Stopping any existing LangGraph dev servers..."
25+
pkill -f "langgraph dev" || true
26+
sleep 1
27+
28+
if [ $# -gt 0 ]; then
29+
echo "Starting LangGraph dev server for apps/$app_name with args: $*"
30+
cd "apps/$app_name" && uv run langgraph dev "$@"
31+
else
32+
echo "Starting LangGraph dev server for apps/$app_name..."
33+
cd "apps/$app_name" && uv run langgraph dev
34+
fi

0 commit comments

Comments
 (0)