Skip to content

ci: slack comment with test failures #7711

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/actions/gen-report-dir/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,18 @@ inputs:
description: "Base URL of the S3 bucket or CDN for the report"
required: false
default: "https://d38p2avprg8il3.cloudfront.net"
outputs:
report-dir:
description: "The generated unique report directory name"
value: ${{ steps.generate-report-dir.outputs.report_dir }}
report-url:
description: "The URL to the generated report"
value: ${{ steps.generate-report-dir.outputs.report_url }}
runs:
using: "composite"
steps:
- name: Generate REPORT_DIR
id: generate-report-dir
shell: bash
run: |
# Generate a unique REPORT_DIR
Expand All @@ -17,12 +25,14 @@ runs:

# Export REPORT_DIR for downstream steps
echo "REPORT_DIR=$REPORT_DIR" >> $GITHUB_ENV
echo "report_dir=$REPORT_DIR" >> $GITHUB_OUTPUT
echo "Generated REPORT_DIR: $REPORT_DIR"

# Generate the REPORT_URL
REPORT_URL="${{ inputs.bucket-url }}/$REPORT_DIR/index.html"
echo "Report URL: $REPORT_URL"
echo "REPORT_URL=$REPORT_URL" >> $GITHUB_ENV
echo "report_url=$REPORT_URL" >> $GITHUB_OUTPUT

# Append REPORT_URL to the GitHub Step summary
echo "📄 [Playwright Report]($REPORT_URL) <br>" >> $GITHUB_STEP_SUMMARY
11 changes: 11 additions & 0 deletions .github/workflows/test-e2e-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ jobs:

- name: Send Results to GH Summary
uses: ./.github/actions/gen-report-dir
id: gen_report
if: ${{ !cancelled() }}

- name: Transform to Playwright Tags $PW_TAGS
Expand Down Expand Up @@ -124,6 +125,14 @@ jobs:
role-to-assume: ${{ secrets.AWS_TEST_REPORTS_ROLE }}
report-dir: ${{ env.REPORT_DIR }}

- name: Persist Junit report for Slack Notification
uses: midleman/slack-workflow-status/.github/actions/upload-artifacts@master
if: ${{ !cancelled() }}
with:
job_name: ${{ github.job }}
junit_path: 'test-results/junit.xml'
report_url: ${{ steps.gen_report.outputs.report_url }}

slack-notify:
needs: [e2e-electron]
runs-on: ubuntu-latest
Expand All @@ -140,3 +149,5 @@ jobs:
slack_token: ${{ secrets.SLACK_TOKEN_TEST_STATUS }}
slack_channel: "#positron-test-results"
notify_on: ${{ env.notify_on }}
comment_junit_failures: true
emoji_junit_failures: ":small-red-x:"
9 changes: 9 additions & 0 deletions .github/workflows/test-e2e-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ jobs:
run: npm run gulp node

- name: Send Results to GH Summary
id: gen_report
uses: ./.github/actions/gen-report-dir

- name: Alter AppArmor Restrictions for Playwright (Electron)
Expand Down Expand Up @@ -260,3 +261,11 @@ jobs:
TESTRAIL_TITLE: ${{ inputs.project }}
TESTRAIL_PROJECT: "Positron"
TESTRAIL_API_KEY: ${{ secrets.TESTRAIL_API_KEY }}

- name: Persist Junit report for Slack Notification
uses: midleman/slack-workflow-status/.github/actions/upload-artifacts@master
if: ${{ !cancelled() }}
with:
job_name: ${{ github.job }}
junit_path: 'test-results/junit.xml'
report_url: ${{ steps.gen_report.outputs.report_url }}
8 changes: 8 additions & 0 deletions .github/workflows/test-e2e-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -209,3 +209,11 @@ jobs:
TESTRAIL_TITLE: "e2e-windows"
TESTRAIL_PROJECT: "Positron"
TESTRAIL_API_KEY: ${{ secrets.TESTRAIL_API_KEY }}

- name: Persist Junit report for Slack Notification
uses: midleman/slack-workflow-status/.github/actions/upload-artifacts@master
if: ${{ !cancelled() }}
with:
job_name: ${{ github.job }}
junit_path: 'test-results/junit.xml'
report_url: ${{ steps.gen_report.outputs.report_url }}
2 changes: 2 additions & 0 deletions .github/workflows/test-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,7 @@ jobs:
slack_token: ${{ secrets.SLACK_TOKEN_TEST_STATUS }}
slack_channel: "#positron-test-results"
notify_on: "failure"
comment_junit_failures: true
emoji_junit_failures: ":small-red-x:"