|
20 | 20 | all_tutorials=$(find . -name "manifest.yaml" -exec dirname {} \; | sort | sed 's|^\./||') |
21 | 21 |
|
22 | 22 | # Filter out the specified temporal tutorials that are being updated |
23 | | - filtered_tutorials=$(echo "$all_tutorials" | grep -v -E "(10_temporal/050_|10_temporal/070_|10_temporal/080_)") |
| 23 | + filtered_tutorials=$(echo "$all_tutorials" | grep -v -E "(temporal)") |
24 | 24 |
|
25 | 25 | # Convert to JSON array |
26 | 26 | tutorials=$(echo "$filtered_tutorials" | jq -R -s -c 'split("\n") | map(select(length > 0))') |
@@ -119,155 +119,26 @@ jobs: |
119 | 119 | AGENTEX_API_BASE_URL="http://localhost:5003" \ |
120 | 120 | ./run_agent_test.sh --build-cli "${{ matrix.tutorial }}" |
121 | 121 |
|
122 | | - - name: Upload Test Results |
| 122 | + - name: Record test result |
| 123 | + id: test-result |
123 | 124 | if: always() |
124 | 125 | run: | |
125 | | - # Sanitize tutorial name for artifact upload |
126 | | - SANITIZED_NAME=$(echo "${{ matrix.tutorial }}" | sed 's/\//-/g') |
127 | | - echo "Uploading test results for: ${{ matrix.tutorial }} (as: test-results-$SANITIZED_NAME)" |
128 | | -
|
129 | | - # Create a temporary directory with the sanitized name |
130 | | - mkdir -p "test-results-$SANITIZED_NAME" |
131 | | - cp /tmp/agentex-*.log "test-results-$SANITIZED_NAME/" 2>/dev/null || echo "No log files to copy" |
132 | | -
|
133 | | - # Upload using the actions/upload-artifact action |
134 | | - echo "artifact-name=test-results-$SANITIZED_NAME" >> $GITHUB_ENV |
135 | | -
|
136 | | - - name: Upload Artifact |
137 | | - if: always() |
138 | | - uses: actions/upload-artifact@v4 |
139 | | - with: |
140 | | - name: ${{ env.artifact-name }} |
141 | | - path: test-results-* |
142 | | - retention-days: 1 |
| 126 | + if [ "${{ steps.run-test.outcome }}" == "success" ]; then |
| 127 | + echo "result=passed" >> $GITHUB_OUTPUT |
| 128 | + else |
| 129 | + echo "result=failed" >> $GITHUB_OUTPUT |
| 130 | + fi |
143 | 131 |
|
144 | 132 | test-summary: |
145 | 133 | if: always() |
146 | 134 | needs: [find-tutorials, test-tutorial] |
147 | 135 | runs-on: ubuntu-latest |
148 | 136 | name: Test Summary |
149 | 137 | steps: |
150 | | - - name: Download All Test Results |
151 | | - uses: actions/download-artifact@v4 |
152 | | - with: |
153 | | - path: test-results |
154 | | - pattern: test-results-* |
155 | | - |
156 | 138 | - name: Generate Test Summary |
157 | 139 | run: | |
158 | 140 | echo "# 🧪 Tutorial Tests Summary" >> $GITHUB_STEP_SUMMARY |
159 | 141 | echo "" >> $GITHUB_STEP_SUMMARY |
160 | 142 |
|
161 | 143 | # Get tutorial list from needs context |
162 | 144 | tutorials='${{ needs.find-tutorials.outputs.tutorials }}' |
163 | | -
|
164 | | - # Debug: Show what we're working with |
165 | | - echo "🔍 DEBUG: Tutorial list from find-tutorials job:" |
166 | | - echo "$tutorials" |
167 | | - echo "" |
168 | | - echo "🔍 DEBUG: Downloaded artifacts:" |
169 | | - ls -la test-results/ || echo "No test-results directory found" |
170 | | - echo "" |
171 | | - echo "🔍 DEBUG: Artifact contents:" |
172 | | - find test-results/ -type f -name "*.log" || echo "No log files found" |
173 | | - echo "" |
174 | | -
|
175 | | - # Initialize counters |
176 | | - total_tutorials=0 |
177 | | - passed_tutorials=0 |
178 | | - failed_tutorials=0 |
179 | | -
|
180 | | - # Arrays to track results |
181 | | - passed_tests=() |
182 | | - failed_tests=() |
183 | | -
|
184 | | - echo "## 📊 Overall Results" >> $GITHUB_STEP_SUMMARY |
185 | | - echo "" >> $GITHUB_STEP_SUMMARY |
186 | | -
|
187 | | - # Process each tutorial result |
188 | | - for tutorial_dir in test-results/test-results-*/; do |
189 | | - if [ -d "$tutorial_dir" ]; then |
190 | | - # Extract sanitized name and convert back to original tutorial path |
191 | | - sanitized_name=$(basename "$tutorial_dir" | sed 's/test-results-//') |
192 | | - tutorial_name=$(echo "$sanitized_name" | sed 's/-/\//g') |
193 | | - total_tutorials=$((total_tutorials + 1)) |
194 | | -
|
195 | | - # Check if there are any log files in this directory |
196 | | - if find "$tutorial_dir" -name "*.log" -type f | grep -q .; then |
197 | | - # Determine success/failure based on pytest-specific failure patterns |
198 | | - if find "$tutorial_dir" -name "*.log" -exec grep -l "FAILED.*::" {} \; | head -1 >/dev/null || \ |
199 | | - find "$tutorial_dir" -name "*.log" -exec grep -l "=== FAILURES ===" {} \; | head -1 >/dev/null || \ |
200 | | - find "$tutorial_dir" -name "*.log" -exec grep -l "AssertionError" {} \; | head -1 >/dev/null; then |
201 | | - failed_tutorials=$((failed_tutorials + 1)) |
202 | | - failed_tests+=("$tutorial_name") |
203 | | - else |
204 | | - passed_tutorials=$((passed_tutorials + 1)) |
205 | | - passed_tests+=("$tutorial_name") |
206 | | - fi |
207 | | - fi |
208 | | - fi |
209 | | - done |
210 | | -
|
211 | | - # Show summary stats |
212 | | - echo "| Status | Count |" >> $GITHUB_STEP_SUMMARY |
213 | | - echo "|--------|-------|" >> $GITHUB_STEP_SUMMARY |
214 | | - echo "| ✅ **Passed** | **$passed_tutorials** |" >> $GITHUB_STEP_SUMMARY |
215 | | - echo "| ❌ **Failed** | **$failed_tutorials** |" >> $GITHUB_STEP_SUMMARY |
216 | | - echo "| 📊 **Total** | **$total_tutorials** |" >> $GITHUB_STEP_SUMMARY |
217 | | - echo "" >> $GITHUB_STEP_SUMMARY |
218 | | -
|
219 | | - # Show passed tests |
220 | | - if [ $passed_tutorials -gt 0 ]; then |
221 | | - echo "## ✅ Passed Tutorials ($passed_tutorials)" >> $GITHUB_STEP_SUMMARY |
222 | | - echo "" >> $GITHUB_STEP_SUMMARY |
223 | | - for test in "${passed_tests[@]}"; do |
224 | | - echo "- ✅ \`$test\`" >> $GITHUB_STEP_SUMMARY |
225 | | - done |
226 | | - echo "" >> $GITHUB_STEP_SUMMARY |
227 | | - fi |
228 | | -
|
229 | | - # Show pytest failures only for failed tests |
230 | | - if [ $failed_tutorials -gt 0 ]; then |
231 | | - echo "## ❌ Failed Tutorials ($failed_tutorials)" >> $GITHUB_STEP_SUMMARY |
232 | | - echo "" >> $GITHUB_STEP_SUMMARY |
233 | | - echo '```' >> $GITHUB_STEP_SUMMARY |
234 | | -
|
235 | | - # Extract and append pytest failures from each failed test |
236 | | - for test in "${failed_tests[@]}"; do |
237 | | - # Find the log file for this test (convert back to sanitized name) |
238 | | - sanitized_test_name=$(echo "$test" | sed 's/\//-/g') |
239 | | - log_file=$(find "test-results/test-results-$sanitized_test_name" -name "*.log" | head -1) |
240 | | - if [ -f "$log_file" ]; then |
241 | | - echo "================================================================================================" >> $GITHUB_STEP_SUMMARY |
242 | | - echo "FAILED: $test" >> $GITHUB_STEP_SUMMARY |
243 | | - echo "================================================================================================" >> $GITHUB_STEP_SUMMARY |
244 | | -
|
245 | | - # Extract pytest output between the delimiters, or show pytest summary if no delimiters |
246 | | - if grep -q "========== PYTEST OUTPUT ==========" "$log_file"; then |
247 | | - sed -n '/========== PYTEST OUTPUT ==========/,/========== END PYTEST OUTPUT ==========/p' "$log_file" | \ |
248 | | - sed '1d;$d' >> $GITHUB_STEP_SUMMARY |
249 | | - else |
250 | | - # If no delimiters, try to extract pytest-related lines |
251 | | - grep -E "(FAILED|ERROR|AssertionError|collected.*items|=====.*=====|::.*FAILED)" "$log_file" >> $GITHUB_STEP_SUMMARY || \ |
252 | | - echo "No pytest output found in log file" >> $GITHUB_STEP_SUMMARY |
253 | | - fi |
254 | | - echo "" >> $GITHUB_STEP_SUMMARY |
255 | | - else |
256 | | - echo "================================================================================================" >> $GITHUB_STEP_SUMMARY |
257 | | - echo "FAILED: $test (No log file found)" >> $GITHUB_STEP_SUMMARY |
258 | | - echo "================================================================================================" >> $GITHUB_STEP_SUMMARY |
259 | | - echo "" >> $GITHUB_STEP_SUMMARY |
260 | | - fi |
261 | | - done |
262 | | -
|
263 | | - echo '```' >> $GITHUB_STEP_SUMMARY |
264 | | - echo "" >> $GITHUB_STEP_SUMMARY |
265 | | - fi |
266 | | -
|
267 | | - # Set exit code based on results |
268 | | - if [ $failed_tutorials -gt 0 ]; then |
269 | | - echo "❌ Some tutorials failed. Check the details above." >> $GITHUB_STEP_SUMMARY |
270 | | - exit 1 |
271 | | - else |
272 | | - echo "🎉 All tutorials passed successfully!" >> $GITHUB_STEP_SUMMARY |
273 | | - fi |
0 commit comments