Skip to content

Commit dc4c4c2

Browse files
committed
Add failure notification step for integration tests in nightly workflow
1 parent a676b69 commit dc4c4c2

1 file changed

Lines changed: 82 additions & 0 deletions

File tree

.github/workflows/nightly-parallel.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,88 @@ jobs:
375375
retention-days: 7
376376
if-no-files-found: ignore
377377

378+
- name: Collect failed tests
379+
id: failed_tests
380+
if: always()
381+
run: |
382+
FAILED_LIST=$(grep -hE "^--- FAIL: " retry2_output.log retry1_output.log test_output.log 2>/dev/null \
383+
| awk '{print $3}' | sort -u || true)
384+
385+
if [ -n "$FAILED_LIST" ]; then
386+
FAIL_COUNT=$(echo "$FAILED_LIST" | wc -l | tr -d ' ')
387+
FAILED_FORMATTED=$(echo "$FAILED_LIST" | tr '\n' '\n' | sed 's/^/• /' | paste -sd '\\n' -)
388+
echo "has_failures=true" >> "$GITHUB_OUTPUT"
389+
echo "fail_count=${FAIL_COUNT}" >> "$GITHUB_OUTPUT"
390+
echo "failed_list=${FAILED_FORMATTED}" >> "$GITHUB_OUTPUT"
391+
else
392+
echo "has_failures=false" >> "$GITHUB_OUTPUT"
393+
echo "fail_count=0" >> "$GITHUB_OUTPUT"
394+
echo "failed_list=" >> "$GITHUB_OUTPUT"
395+
fi
396+
397+
- name: Send failure notification to Teams
398+
if: always() && steps.failed_tests.outputs.has_failures == 'true'
399+
uses: Skitionek/notify-microsoft-teams@v1.0.8
400+
with:
401+
webhook_url: ${{ secrets.MS_TEAMS_WEBHOOK_URL_INTEGRATION_TESTS }}
402+
raw: >
403+
{
404+
"type": "message",
405+
"attachments": [
406+
{
407+
"contentType": "application/vnd.microsoft.card.adaptive",
408+
"content": {
409+
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
410+
"type": "AdaptiveCard",
411+
"version": "1.4",
412+
"msteams": {
413+
"width": "Full"
414+
},
415+
"body": [
416+
{
417+
"type": "TextBlock",
418+
"text": "Integration Tests Failed — ${{ matrix.label }}",
419+
"weight": "Bolder",
420+
"size": "Large",
421+
"color": "Attention"
422+
},
423+
{
424+
"type": "FactSet",
425+
"facts": [
426+
{ "title": "Repository:", "value": "${{ github.repository }}" },
427+
{ "title": "Author:", "value": "${{ github.actor }}" },
428+
{ "title": "Branch:", "value": "${{ github.ref_name }}" },
429+
{ "title": "Run ID:", "value": "${{ github.run_id }}" },
430+
{ "title": "Group:", "value": "${{ matrix.label }} (${{ matrix.name }})" },
431+
{ "title": "Failed Tests:", "value": "${{ steps.failed_tests.outputs.fail_count }}" }
432+
]
433+
},
434+
{
435+
"type": "TextBlock",
436+
"text": "**Failed Test Cases:**",
437+
"weight": "Bolder",
438+
"spacing": "Medium"
439+
},
440+
{
441+
"type": "TextBlock",
442+
"text": "${{ steps.failed_tests.outputs.failed_list }}",
443+
"wrap": true,
444+
"fontType": "Monospace",
445+
"spacing": "Small"
446+
}
447+
],
448+
"actions": [
449+
{
450+
"type": "Action.OpenUrl",
451+
"title": "View Workflow Run",
452+
"url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
453+
}
454+
]
455+
}
456+
}
457+
]
458+
}
459+
378460
- name: Stop Squid proxy
379461
if: always()
380462
run: docker stop squid && docker rm squid || true

0 commit comments

Comments
 (0)