Skip to content

Commit 134d3ef

Browse files
committed
testing this
1 parent cebe84d commit 134d3ef

File tree

1 file changed

+66
-36
lines changed

1 file changed

+66
-36
lines changed

.github/workflows/agentex-tutorials-test.yml

Lines changed: 66 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,21 @@ jobs:
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,16 @@ 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 presence of error logs or patterns
198+
if find "$tutorial_dir" -name "*.log" -exec grep -l "FAILED\|ERROR\|Traceback" {} \; | head -1 >/dev/null; then
199+
failed_tutorials=$((failed_tutorials + 1))
200+
failed_tests+=("$tutorial_name")
201+
else
202+
passed_tutorials=$((passed_tutorials + 1))
203+
passed_tests+=("$tutorial_name")
204+
fi
166205
fi
167206
fi
168207
done
@@ -185,42 +224,33 @@ jobs:
185224
echo "" >> $GITHUB_STEP_SUMMARY
186225
fi
187226
188-
# Show failed tests with details
227+
# Show failed tests with all log contents appended together
189228
if [ $failed_tutorials -gt 0 ]; then
190229
echo "## ❌ Failed Tutorials ($failed_tutorials)" >> $GITHUB_STEP_SUMMARY
191230
echo "" >> $GITHUB_STEP_SUMMARY
231+
echo '```' >> $GITHUB_STEP_SUMMARY
192232
233+
# Append all failed test log contents together
193234
for test in "${failed_tests[@]}"; do
194-
echo "### 🔍 \`$test\`" >> $GITHUB_STEP_SUMMARY
195-
echo "" >> $GITHUB_STEP_SUMMARY
196-
197235
# Find the log file for this test (convert back to sanitized name)
198236
sanitized_test_name=$(echo "$test" | sed 's/\//-/g')
199237
log_file=$(find "test-results/test-results-$sanitized_test_name" -name "*.log" | head -1)
200238
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
218-
fi
239+
echo "================================================================================================" >> $GITHUB_STEP_SUMMARY
240+
echo "FAILED: $test" >> $GITHUB_STEP_SUMMARY
241+
echo "================================================================================================" >> $GITHUB_STEP_SUMMARY
242+
cat "$log_file" >> $GITHUB_STEP_SUMMARY
243+
echo "" >> $GITHUB_STEP_SUMMARY
219244
else
220-
echo "_No log file found for detailed error analysis_" >> $GITHUB_STEP_SUMMARY
245+
echo "================================================================================================" >> $GITHUB_STEP_SUMMARY
246+
echo "FAILED: $test (No log file found)" >> $GITHUB_STEP_SUMMARY
247+
echo "================================================================================================" >> $GITHUB_STEP_SUMMARY
221248
echo "" >> $GITHUB_STEP_SUMMARY
222249
fi
223250
done
251+
252+
echo '```' >> $GITHUB_STEP_SUMMARY
253+
echo "" >> $GITHUB_STEP_SUMMARY
224254
fi
225255
226256
# Set exit code based on results

0 commit comments

Comments
 (0)