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