Skip to content

Commit e1fc485

Browse files
committed
adding the steps
1 parent 63ee480 commit e1fc485

File tree

2 files changed

+175
-27
lines changed

2 files changed

+175
-27
lines changed

.github/workflows/integration-tests.yml

Lines changed: 173 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -337,13 +337,7 @@ jobs:
337337
echo "📋 Agent logs after test attempt $RETRY_COUNT:"
338338
docker logs --tail=30 "${CONTAINER_NAME}"
339339
340-
echo "<details><summary>📋 AgentEx logs after test attempt $RETRY_COUNT (click to expand)</summary>"
341-
echo ""
342-
echo '```'
343-
cd agentex && docker compose logs --tail=30 agentex
344-
cd ..
345-
echo '```'
346-
echo "</details>"
340+
# AgentEx logs are hidden by default - no output to console
347341
348342
if [ $TEST_EXIT_CODE -eq 0 ]; then
349343
echo "✅ Tests passed successfully on attempt $RETRY_COUNT"
@@ -364,39 +358,193 @@ jobs:
364358
echo "❌ All $MAX_RETRIES test attempts failed"
365359
echo "📋 Full agent logs:"
366360
docker logs "${CONTAINER_NAME}"
367-
echo "<details><summary>📋 Full AgentEx logs (click to expand)</summary>"
368-
echo ""
369-
echo '```'
370-
cd agentex && docker compose logs agentex
371-
cd ..
372-
echo '```'
373-
echo "</details>"
361+
# AgentEx logs are hidden by default in failure case too
374362
exit 1
375363
fi
376364
377365
echo "🧹 Cleaning up container..."
378366
docker rm -f "${CONTAINER_NAME}"
379367
368+
- name: Show AgentEx logs
369+
if: always()
370+
working-directory: ./agentex
371+
run: |
372+
echo "📋 AgentEx service logs:"
373+
echo "========================"
374+
docker compose logs agentex
375+
echo "========================"
376+
echo ""
377+
echo "📋 AgentEx worker logs:"
378+
echo "========================"
379+
docker compose logs agentex-temporal-worker
380+
echo "========================"
381+
382+
- name: Record test result
383+
id: test-result
384+
if: always()
385+
run: |
386+
# Create results directory
387+
mkdir -p test-results
388+
389+
# Set variables for this agent
390+
AGENT_NAME="${{ matrix.agent.agent_name }}"
391+
392+
# Determine result based on whether we passed
393+
if [ "${{ job.status }}" == "success" ]; then
394+
result="passed"
395+
echo "result=passed" >> $GITHUB_OUTPUT
396+
echo "agent=${{ matrix.agent.agent_name }}" >> $GITHUB_OUTPUT
397+
else
398+
result="failed"
399+
echo "result=failed" >> $GITHUB_OUTPUT
400+
echo "agent=${{ matrix.agent.agent_name }}" >> $GITHUB_OUTPUT
401+
fi
402+
403+
# Save result to file for artifact upload
404+
# Create a safe filename from agent name
405+
safe_name=$(echo "${{ matrix.agent.agent_name }}" | tr '/' '_' | tr -d ' ' | tr ':' '_')
406+
echo "$result" > "test-results/result-${safe_name}.txt"
407+
echo "${{ matrix.agent.agent_name }}" > "test-results/agent-${safe_name}.txt"
408+
echo "safe_name=${safe_name}" >> $GITHUB_OUTPUT
409+
410+
- name: Upload test result
411+
if: always()
412+
uses: actions/upload-artifact@v4
413+
with:
414+
name: test-result-${{ steps.test-result.outputs.safe_name }}
415+
path: test-results/
416+
retention-days: 1
417+
380418
# Summary job to ensure the workflow fails if any test fails
381419
integration-tests-summary:
382420
name: "Integration Tests Summary"
383421
runs-on: ubuntu-latest
384422
needs: [discover-agent-images, run-integration-tests]
385423
if: always() # Run even if some tests fail
386424
steps:
387-
- name: Check test results
425+
- name: Download all test results
426+
uses: actions/download-artifact@v4
427+
with:
428+
pattern: test-result-*
429+
path: all-results/
430+
merge-multiple: true
431+
continue-on-error: true
432+
433+
- name: Generate Integration Test Summary
388434
run: |
389-
echo "🔍 Checking integration test results..."
435+
echo "# 🧪 AgentEx Integration Tests Summary" >> $GITHUB_STEP_SUMMARY
436+
echo "" >> $GITHUB_STEP_SUMMARY
437+
438+
# Initialize counters
439+
passed_count=0
440+
failed_count=0
441+
skipped_count=0
442+
total_count=0
443+
444+
# Get all agents that were supposed to run
445+
agents='${{ needs.discover-agent-images.outputs.agent-matrix }}'
446+
447+
if [ -d "all-results" ] && [ "$(ls -A all-results 2>/dev/null)" ]; then
448+
echo "📊 Processing individual test results from artifacts..."
449+
450+
echo "## Test Results" >> $GITHUB_STEP_SUMMARY
451+
echo "" >> $GITHUB_STEP_SUMMARY
452+
echo "| Agent | Status | Result |" >> $GITHUB_STEP_SUMMARY
453+
echo "|-------|--------|--------|" >> $GITHUB_STEP_SUMMARY
454+
455+
# Process each result file
456+
for result_file in all-results/result-*.txt; do
457+
if [ -f "$result_file" ]; then
458+
# Extract the safe name from filename
459+
safe_name=$(basename "$result_file" .txt | sed 's/result-//')
460+
461+
# Get corresponding agent name file
462+
agent_file="all-results/agent-${safe_name}.txt"
463+
464+
if [ -f "$agent_file" ]; then
465+
agent_name=$(cat "$agent_file")
466+
result=$(cat "$result_file")
467+
468+
total_count=$((total_count + 1))
469+
470+
if [ "$result" = "passed" ]; then
471+
echo "| \`$agent_name\` | ✅ | Passed |" >> $GITHUB_STEP_SUMMARY
472+
passed_count=$((passed_count + 1))
473+
else
474+
echo "| \`$agent_name\` | ❌ | Failed |" >> $GITHUB_STEP_SUMMARY
475+
failed_count=$((failed_count + 1))
476+
fi
477+
fi
478+
fi
479+
done
480+
481+
# Check for any agents that didn't have results (skipped/cancelled)
482+
# Use process substitution to avoid subshell scoping issues
483+
while IFS= read -r expected_agent; do
484+
safe_expected=$(echo "$expected_agent" | tr '/' '_' | tr -d ' ' | tr ':' '_')
485+
if [ ! -f "all-results/result-${safe_expected}.txt" ]; then
486+
echo "| \`$expected_agent\` | ⏭️ | Skipped/Cancelled |" >> $GITHUB_STEP_SUMMARY
487+
skipped_count=$((skipped_count + 1))
488+
total_count=$((total_count + 1))
489+
fi
490+
done < <(echo "$agents" | jq -r '.[].agent_name')
390491
391-
# Check if the matrix job had any failures
392-
if [ "${{ needs.run-integration-tests.result }}" != "success" ]; then
393-
echo "❌ One or more integration tests failed"
394-
echo "Matrix job result: ${{ needs.run-integration-tests.result }}"
395-
exit 1
396492
else
397-
echo "✅ All integration tests passed successfully"
493+
echo "⚠️ No individual test results found. This could mean:"
494+
echo "- Test jobs were cancelled before completion"
495+
echo "- Artifacts failed to upload"
496+
echo "- No agents were found to test"
497+
echo ""
498+
499+
overall_result="${{ needs.run-integration-tests.result }}"
500+
echo "Overall job status: **$overall_result**"
501+
502+
if [[ "$overall_result" == "success" ]]; then
503+
echo "✅ All tests appear to have passed based on job status."
504+
elif [[ "$overall_result" == "failure" ]]; then
505+
echo "❌ Some tests appear to have failed based on job status."
506+
echo ""
507+
echo "💡 **Tip:** Check individual job logs for specific failure details."
508+
elif [[ "$overall_result" == "cancelled" ]]; then
509+
echo "⏭️ Tests were cancelled."
510+
else
511+
echo "❓ Test status is unclear: $overall_result"
512+
fi
513+
514+
# Don't show detailed breakdown when we don't have individual results
515+
agent_count=$(echo "$agents" | jq -r '. | length')
516+
echo ""
517+
echo "Expected agent count: $agent_count"
398518
fi
399519
400-
- name: Final status
401-
run: |
402-
echo "🎉 All tutorial agent integration tests completed successfully!"
520+
# Only show detailed statistics if we have individual results
521+
if [ -d "all-results" ] && [ "$(ls -A all-results 2>/dev/null)" ]; then
522+
echo "" >> $GITHUB_STEP_SUMMARY
523+
echo "## Summary Statistics" >> $GITHUB_STEP_SUMMARY
524+
echo "" >> $GITHUB_STEP_SUMMARY
525+
echo "- **Total Tests:** $total_count" >> $GITHUB_STEP_SUMMARY
526+
echo "- **Passed:** $passed_count ✅" >> $GITHUB_STEP_SUMMARY
527+
echo "- **Failed:** $failed_count ❌" >> $GITHUB_STEP_SUMMARY
528+
echo "- **Skipped:** $skipped_count ⏭️" >> $GITHUB_STEP_SUMMARY
529+
echo "" >> $GITHUB_STEP_SUMMARY
530+
531+
if [ $failed_count -eq 0 ] && [ $passed_count -gt 0 ]; then
532+
echo "🎉 **All tests passed!**" >> $GITHUB_STEP_SUMMARY
533+
elif [ $failed_count -gt 0 ]; then
534+
echo "⚠️ **Some tests failed.** Check individual job logs for details." >> $GITHUB_STEP_SUMMARY
535+
echo "" >> $GITHUB_STEP_SUMMARY
536+
echo "💡 **Tip:** Look for agent container logs in failed jobs for debugging information." >> $GITHUB_STEP_SUMMARY
537+
else
538+
echo "ℹ️ **Tests were cancelled or skipped.**" >> $GITHUB_STEP_SUMMARY
539+
fi
540+
541+
# Exit with error if any tests failed
542+
if [ $failed_count -gt 0 ]; then
543+
exit 1
544+
fi
545+
else
546+
# Fallback to overall job result when individual results aren't available
547+
if [[ "$overall_result" == "failure" ]]; then
548+
exit 1
549+
fi
550+
fi

.vscode/settings.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"ruff.fixAll": true,
1313
"python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python",
1414
"python.terminal.activateEnvironment": true,
15-
"python.languageServer": "None",
15+
"python.languageServer": "Pylance",
1616
"editor.defaultFormatter": "esbenp.prettier-vscode",
1717
"editor.formatOnSave": true,
1818
"editor.codeActionsOnSave": {
@@ -92,4 +92,4 @@
9292
"editor.formatOnSave": true,
9393
"editor.defaultFormatter": "esbenp.prettier-vscode"
9494
}
95-
}
95+
}

0 commit comments

Comments
 (0)