@@ -43,3 +43,103 @@ jobs:
4343
4444 # Verify all deps are up
4545 docker compose ps
46+
47+ - name : Run Parallel Tutorial Tests
48+ run : |
49+ cd scale-agentex/agentex/examples/tutorials
50+
51+ # Find all tutorial directories
52+ tutorial_paths=()
53+ for dir in $(find . -name "manifest.yaml" -exec dirname {} \; | sort); do
54+ tutorial_paths+=("${dir#./}") # Remove leading ./
55+ done
56+
57+ echo "Found ${#tutorial_paths[@]} tutorials:"
58+ printf ' %s\n' "${tutorial_paths[@]}"
59+
60+ # Run tests in parallel with unique ports
61+ pids=()
62+ failed_tests=()
63+ passed_tests=()
64+
65+ for i in "${!tutorial_paths[@]}"; do
66+ tutorial="${tutorial_paths[$i]}"
67+ port=$((8000 + i))
68+
69+ echo ""
70+ echo "========================================="
71+ echo "Starting test $((i+1))/${#tutorial_paths[@]}: $tutorial (port $port)"
72+ echo "========================================="
73+
74+ # Modify manifest.yaml to use unique port
75+ manifest_path="$tutorial/manifest.yaml"
76+ if [ -f "$manifest_path" ]; then
77+ # Backup original manifest
78+ cp "$manifest_path" "$manifest_path.backup"
79+
80+ # Update port in manifest (modify the line containing 'port: 8000' or 'port: XXXX')
81+ sed -i "s/port: [0-9]*/port: $port/" "$manifest_path"
82+
83+ echo "Updated $manifest_path to use port $port"
84+ fi
85+
86+ # Run test in background with unique port
87+ (
88+ cd "../../../agentex-python/examples/tutorials"
89+ AGENTEX_API_BASE_URL="http://localhost:5003" \
90+ ./run_agent_test.sh "../../scale-agentex/agentex/examples/tutorials/$tutorial"
91+
92+ if [ $? -eq 0 ]; then
93+ echo "✅ PASSED: $tutorial (port $port)"
94+ echo "$tutorial" > "/tmp/passed_$i.txt"
95+ else
96+ echo "❌ FAILED: $tutorial (port $port)"
97+ echo "$tutorial" > "/tmp/failed_$i.txt"
98+ fi
99+
100+ # Restore original manifest
101+ cd "../../scale-agentex/agentex/examples/tutorials"
102+ if [ -f "$tutorial/manifest.yaml.backup" ]; then
103+ mv "$tutorial/manifest.yaml.backup" "$tutorial/manifest.yaml"
104+ fi
105+ ) &
106+
107+ pids+=($!)
108+ done
109+
110+ # Wait for all tests to complete
111+ echo ""
112+ echo "Waiting for all tests to complete..."
113+ for pid in "${pids[@]}"; do
114+ wait "$pid"
115+ done
116+
117+ # Collect results
118+ for i in "${!tutorial_paths[@]}"; do
119+ if [ -f "/tmp/passed_$i.txt" ]; then
120+ passed_tests+=($(cat "/tmp/passed_$i.txt"))
121+ elif [ -f "/tmp/failed_$i.txt" ]; then
122+ failed_tests+=($(cat "/tmp/failed_$i.txt"))
123+ fi
124+ done
125+
126+ # Print summary
127+ echo ""
128+ echo "========================================="
129+ echo "TEST SUMMARY"
130+ echo "========================================="
131+ echo "Total: ${#tutorial_paths[@]}"
132+ echo "Passed: ${#passed_tests[@]}"
133+ echo "Failed: ${#failed_tests[@]}"
134+
135+ if [ ${#failed_tests[@]} -gt 0 ]; then
136+ echo ""
137+ echo "Failed tests:"
138+ for test in "${failed_tests[@]}"; do
139+ echo " ❌ $test"
140+ done
141+ exit 1
142+ else
143+ echo ""
144+ echo "🎉 All tests passed!"
145+ fi
0 commit comments