Skip to content

Commit 6ff1828

Browse files
authored
Add test summary to slack notification (#744)
1 parent 0ed9d73 commit 6ff1828

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

.github/workflows/e2e-suite.yml

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,8 @@ jobs:
235235
runs-on: ubuntu-latest
236236
needs: [integration_tests]
237237
if: always() && github.repository == 'linode/linode-cli' # Run even if integration tests fail and only on main repository
238+
outputs:
239+
summary: ${{ steps.set-test-summary.outputs.summary }}
238240

239241
steps:
240242
- name: Checkout code
@@ -275,6 +277,17 @@ jobs:
275277
LINODE_CLI_OBJ_ACCESS_KEY: ${{ secrets.LINODE_CLI_OBJ_ACCESS_KEY }}
276278
LINODE_CLI_OBJ_SECRET_KEY: ${{ secrets.LINODE_CLI_OBJ_SECRET_KEY }}
277279

280+
- name: Generate test summary and save to output
281+
id: set-test-summary
282+
run: |
283+
filename=$(ls | grep -E '^[0-9]{12}_cli_test_report\.xml$')
284+
test_output=$(python3 e2e_scripts/tod_scripts/generate_test_summary.py "${filename}")
285+
{
286+
echo 'summary<<EOF'
287+
echo "$test_output"
288+
echo EOF
289+
} >> "$GITHUB_OUTPUT"
290+
278291
279292
notify-slack:
280293
runs-on: ubuntu-latest
@@ -283,6 +296,7 @@ jobs:
283296

284297
steps:
285298
- name: Notify Slack
299+
id: main_message
286300
uses: slackapi/[email protected]
287301
with:
288302
method: chat.postMessage
@@ -293,7 +307,7 @@ jobs:
293307
- type: section
294308
text:
295309
type: mrkdwn
296-
text: ":rocket: *${{ github.workflow }} Completed in: ${{ github.repository }}* :white_check_mark:"
310+
text: ":rocket: *${{ github.workflow }} Completed in: ${{ github.repository }}* ${{ needs.integration_tests.result == 'success' && ':white_check_mark:' || ':failed:' }}"
297311
- type: divider
298312
- type: section
299313
fields:
@@ -312,3 +326,14 @@ jobs:
312326
elements:
313327
- type: mrkdwn
314328
text: "Triggered by: :bust_in_silhouette: `${{ github.actor }}`"
329+
330+
- name: Test summary thread
331+
if: success()
332+
uses: slackapi/[email protected]
333+
with:
334+
method: chat.postMessage
335+
token: ${{ secrets.SLACK_BOT_TOKEN }}
336+
payload: |
337+
channel: ${{ secrets.SLACK_CHANNEL_ID }}
338+
thread_ts: "${{ steps.main_message.outputs.ts }}"
339+
text: "${{ needs.process-upload-report.outputs.summary }}"

0 commit comments

Comments
 (0)