1616 id : get-tutorials
1717 run : |
1818 cd examples/tutorials
19- tutorials=$(find . -name "manifest.yaml" -exec dirname {} \; | sort | sed 's|^\./||' | jq -R -s -c 'split("\n") | map(select(length > 0))')
19+ # Find all tutorials and exclude specific temporal ones
20+ all_tutorials=$(find . -name "manifest.yaml" -exec dirname {} \; | sort | sed 's|^\./||')
21+
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_)")
24+
25+ # Convert to JSON array
26+ tutorials=$(echo "$filtered_tutorials" | jq -R -s -c 'split("\n") | map(select(length > 0))')
27+
2028 echo "tutorials=$tutorials" >> $GITHUB_OUTPUT
21- echo "Found tutorials: $tutorials"
29+ echo "All tutorials found: $(echo "$all_tutorials" | wc -l)"
30+ echo "Filtered tutorials: $(echo "$filtered_tutorials" | wc -l)"
31+ echo "Excluded tutorials:"
32+ echo "$all_tutorials" | grep -E "(10_temporal/050_|10_temporal/070_|10_temporal/080_)" || echo " (none matched exclusion pattern)"
33+ echo "Final tutorial list: $tutorials"
2234
2335 test-tutorial :
2436 needs : find-tutorials
@@ -101,19 +113,32 @@ jobs:
101113 working-directory : ./examples/tutorials
102114 env :
103115 OPENAI_API_KEY : ${{ secrets.TUTORIAL_OPENAI_API_KEY }}
104- HEALTH_CHECK_PORT : 8080 # Use non-privileged port for temporal worker health checks
116+ HEALTH_CHECK_PORT : 8080 # Use non-privileged port for temporal worker health checks
105117 run : |
106118 echo "Testing tutorial: ${{ matrix.tutorial }}"
107119 AGENTEX_API_BASE_URL="http://localhost:5003" \
108120 ./run_agent_test.sh --build-cli "${{ matrix.tutorial }}"
109121
110122 - name : Upload Test Results
123+ if : always()
124+ 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
111137 if : always()
112138 uses : actions/upload-artifact@v4
113139 with :
114- name : test-results-${{ replace(matrix.tutorial, '/', '-') }}
115- path : |
116- /tmp/agentex-*.log
140+ name : ${{ env.artifact-name }}
141+ path : test-results-*
117142 retention-days : 1
118143
119144 test-summary :
@@ -136,6 +161,17 @@ jobs:
136161 # Get tutorial list from needs context
137162 tutorials='${{ needs.find-tutorials.outputs.tutorials }}'
138163
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+
139175 # Initialize counters
140176 total_tutorials=0
141177 passed_tutorials=0
@@ -156,13 +192,18 @@ jobs:
156192 tutorial_name=$(echo "$sanitized_name" | sed 's/-/\//g')
157193 total_tutorials=$((total_tutorials + 1))
158194
159- # Determine success/failure based on presence of error logs or patterns
160- if find "$tutorial_dir" -name "*.log" -exec grep -l "FAILED\|ERROR\|Traceback" {} \; | head -1 >/dev/null; then
161- failed_tutorials=$((failed_tutorials + 1))
162- failed_tests+=("$tutorial_name")
163- else
164- passed_tutorials=$((passed_tutorials + 1))
165- passed_tests+=("$tutorial_name")
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
166207 fi
167208 fi
168209 done
@@ -185,42 +226,42 @@ jobs:
185226 echo "" >> $GITHUB_STEP_SUMMARY
186227 fi
187228
188- # Show failed tests with details
229+ # Show pytest failures only for failed tests
189230 if [ $failed_tutorials -gt 0 ]; then
190231 echo "## ❌ Failed Tutorials ($failed_tutorials)" >> $GITHUB_STEP_SUMMARY
191232 echo "" >> $GITHUB_STEP_SUMMARY
233+ echo '```' >> $GITHUB_STEP_SUMMARY
192234
235+ # Extract and append pytest failures from each failed test
193236 for test in "${failed_tests[@]}"; do
194- echo "### 🔍 \`$test\`" >> $GITHUB_STEP_SUMMARY
195- echo "" >> $GITHUB_STEP_SUMMARY
196-
197237 # Find the log file for this test (convert back to sanitized name)
198238 sanitized_test_name=$(echo "$test" | sed 's/\//-/g')
199239 log_file=$(find "test-results/test-results-$sanitized_test_name" -name "*.log" | head -1)
200240 if [ -f "$log_file" ]; then
201- # Extract pytest failures
202- if grep -q "FAILED\|ERROR" "$log_file"; then
203- echo "**Failed Tests:**" >> $GITHUB_STEP_SUMMARY
204- echo '```' >> $GITHUB_STEP_SUMMARY
205- grep -A 5 -B 1 "FAILED\|ERROR" "$log_file" | head -20 >> $GITHUB_STEP_SUMMARY
206- echo '```' >> $GITHUB_STEP_SUMMARY
207- echo "" >> $GITHUB_STEP_SUMMARY
208- fi
209-
210- # Show any Python tracebacks
211- if grep -q "Traceback" "$log_file"; then
212- echo "**Error Details:**" >> $GITHUB_STEP_SUMMARY
213- echo '```' >> $GITHUB_STEP_SUMMARY
214- # Get the last traceback in the file
215- awk '/Traceback \(most recent call last\)/{p=1} p{print} /^[^ ]/ && p && !/Traceback/{p=0}' "$log_file" | tail -20 >> $GITHUB_STEP_SUMMARY
216- echo '```' >> $GITHUB_STEP_SUMMARY
217- echo "" >> $GITHUB_STEP_SUMMARY
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
218253 fi
254+ echo "" >> $GITHUB_STEP_SUMMARY
219255 else
220- echo "_No log file found for detailed error analysis_" >> $GITHUB_STEP_SUMMARY
256+ echo "================================================================================================" >> $GITHUB_STEP_SUMMARY
257+ echo "FAILED: $test (No log file found)" >> $GITHUB_STEP_SUMMARY
258+ echo "================================================================================================" >> $GITHUB_STEP_SUMMARY
221259 echo "" >> $GITHUB_STEP_SUMMARY
222260 fi
223261 done
262+
263+ echo '```' >> $GITHUB_STEP_SUMMARY
264+ echo "" >> $GITHUB_STEP_SUMMARY
224265 fi
225266
226267 # Set exit code based on results
0 commit comments